svn commit: r276232 - stable/10/sys/dev/isp

Alexander Motin mav at FreeBSD.org
Fri Dec 26 09:09:51 UTC 2014


Author: mav
Date: Fri Dec 26 09:09:50 2014
New Revision: 276232
URL: https://svnweb.freebsd.org/changeset/base/276232

Log:
  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.

Modified:
  stable/10/sys/dev/isp/isp_library.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/isp/isp_library.c
==============================================================================
--- stable/10/sys/dev/isp/isp_library.c	Fri Dec 26 07:36:42 2014	(r276231)
+++ stable/10/sys/dev/isp/isp_library.c	Fri Dec 26 09:09:50 2014	(r276232)
@@ -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) {


More information about the svn-src-stable mailing list