Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 26 Dec 2014 09:09:51 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r276232 - stable/10/sys/dev/isp
Message-ID:  <201412260909.sBQ99pbj083768@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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) {



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