From 28baac29e7d8b3754f2899fcdef2727decdddef9 Mon Sep 17 00:00:00 2001 From: mav Date: Fri, 26 Dec 2014 09:09:50 +0000 Subject: 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. --- sys/dev/isp/isp_library.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sys/dev/isp/isp_library.c') 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) { -- cgit v1.1