Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 26 Nov 2014 12:25:00 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r275112 - head/sys/dev/isp
Message-ID:  <201411261225.sAQCP0xr018492@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Wed Nov 26 12:25:00 2014
New Revision: 275112
URL: https://svnweb.freebsd.org/changeset/base/275112

Log:
  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.
  
  MFC after:	1 month

Modified:
  head/sys/dev/isp/isp_library.c

Modified: head/sys/dev/isp/isp_library.c
==============================================================================
--- head/sys/dev/isp/isp_library.c	Wed Nov 26 11:41:12 2014	(r275111)
+++ head/sys/dev/isp/isp_library.c	Wed Nov 26 12:25:00 2014	(r275112)
@@ -2369,7 +2369,7 @@ isp_find_pdb_by_wwn(ispsoftc_t *isp, int
 
 	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, 
 
 	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
 	}
 
 	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) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201411261225.sAQCP0xr018492>