summaryrefslogtreecommitdiffstats
path: root/sys/dev/isp/isp_library.c
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2014-12-26 09:09:50 +0000
committermav <mav@FreeBSD.org>2014-12-26 09:09:50 +0000
commit28baac29e7d8b3754f2899fcdef2727decdddef9 (patch)
tree04459992286cea1ad9fe4628f7483df2d14b2d39 /sys/dev/isp/isp_library.c
parent5d78bffe2b06e0aa6f7cd8c4dcd19ec5fcea8606 (diff)
downloadFreeBSD-src-28baac29e7d8b3754f2899fcdef2727decdddef9.zip
FreeBSD-src-28baac29e7d8b3754f2899fcdef2727decdddef9.tar.gz
MFC r275112:
Make isp_find_pdb_by_*() search for targets in portdb in reverse order. 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.
Diffstat (limited to 'sys/dev/isp/isp_library.c')
-rw-r--r--sys/dev/isp/isp_library.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/dev/isp/isp_library.c b/sys/dev/isp/isp_library.c
index b6d5945..cb9c4ff 100644
--- a/sys/dev/isp/isp_library.c
+++ b/sys/dev/isp/isp_library.c
@@ -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) {
@@ -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) {
@@ -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) {
OpenPOWER on IntegriCloud