svn commit: r275112 - head/sys/dev/isp

Alexander Motin mav at FreeBSD.org
Wed Nov 26 12:25:01 UTC 2014


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) {


More information about the svn-src-all mailing list