Skip to content

Commit

Permalink
Make isp_find_pdb_by_*() search for targets in portdb in reverse order.
Browse files Browse the repository at this point in the history
Records with target_mode == 1 are allocated from the end of portdb, so it
seems logical to start search from the end not traverse whole array.

MFC after:	1 month
  • Loading branch information
amotin committed Nov 26, 2014
1 parent 6cbccb2 commit 7b9c16e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sys/dev/isp/isp_library.c
Original file line number Diff line number Diff line change
Expand Up @@ -2369,7 +2369,7 @@ isp_find_pdb_by_wwn(ispsoftc_t *isp, int chan, uint64_t wwn, fcportdb_t **lptr)

if (chan < isp->isp_nchan) {
fcp = FCPARAM(isp, chan);
for (i = 0; i < MAX_FC_TARG; i++) {
for (i = MAX_FC_TARG - 1; i >= 0; i--) {
fcportdb_t *lp = &fcp->portdb[i];

if (lp->target_mode == 0) {
Expand All @@ -2392,7 +2392,7 @@ isp_find_pdb_by_loopid(ispsoftc_t *isp, int chan, uint32_t loopid, fcportdb_t **

if (chan < isp->isp_nchan) {
fcp = FCPARAM(isp, chan);
for (i = 0; i < MAX_FC_TARG; i++) {
for (i = MAX_FC_TARG - 1; i >= 0; i--) {
fcportdb_t *lp = &fcp->portdb[i];

if (lp->target_mode == 0) {
Expand All @@ -2418,7 +2418,7 @@ isp_find_pdb_by_sid(ispsoftc_t *isp, int chan, uint32_t sid, fcportdb_t **lptr)
}

fcp = FCPARAM(isp, chan);
for (i = 0; i < MAX_FC_TARG; i++) {
for (i = MAX_FC_TARG - 1; i >= 0; i--) {
fcportdb_t *lp = &fcp->portdb[i];

if (lp->target_mode == 0) {
Expand Down

0 comments on commit 7b9c16e

Please sign in to comment.