File multipath-tools-display-leastpending-loadbalancing of Package multipath-tools

commit cae93b98205cbb699bdd0e208a906ce0334b85b2
Author: Hannes Reinecke <hare@suse.de>
Date:   Fri Feb 6 14:57:12 2009 +0100

    leastpending IO loadbalancing is not displayed properly
    
    While using least pending IO lb policy for the LUN, the
    dm_least_pending module is getting loaded and devices
    are getting created properly. But multipath
    display command does not display the paths for this LUN.
    
    This is due to some explicit parsing for 'round-robin' in
    dmparser.c, which has to be updated to accomodate other
    load-balancing policies.
    
    References: 444199
    
    Signed-off-by: Hannes Reinecke <hare@suse.de>

diff --git a/libmultipath/dmparser.c b/libmultipath/dmparser.c
index 98e8d7c..9476343 100644
--- a/libmultipath/dmparser.c
+++ b/libmultipath/dmparser.c
@@ -323,16 +323,20 @@ disassemble_map (vector pathvec, char * params, struct multipath * mpp)
 			pp->pgindex = i + 1;
 
 			for (k = 0; k < num_paths_args; k++)
-				if (k == 0 && !strncmp(mpp->selector,
-						       "round-robin", 11)) {
-					p += get_word(p, &word);
-					def_minio = atoi(word);
+				if (k == 0) {
+					if (!strncmp(mpp->selector,
+						     "round-robin", 11)) {
+						p += get_word(p, &word);
+						def_minio = atoi(word);
+
+						if (mpp->rr_weight == RR_WEIGHT_PRIO
+						    && pp->priority > 0)
+							def_minio /= pp->priority;
 
-					if (mpp->rr_weight == RR_WEIGHT_PRIO
-					    && pp->priority > 0)
-						def_minio /= pp->priority;
+						FREE(word);
+					} else
+						def_minio = 0;
 
-					FREE(word);
 					if (def_minio != mpp->minio)
 						mpp->minio = def_minio;
 				}
@@ -361,6 +365,7 @@ disassemble_status (char * params, struct multipath * mpp)
 	int num_pg;
 	int num_pg_args;
 	int num_paths;
+	int def_minio = 0;
 	struct path * pp;
 	struct pathgroup * pgp;
 
@@ -456,7 +461,7 @@ disassemble_status (char * params, struct multipath * mpp)
 		FREE(word);
 
 		/*
-		 * undef ?
+		 * PG Status (discarded, would be '0' anyway)
 		 */
 		p += get_word(p, NULL);
 
@@ -519,8 +524,17 @@ disassemble_status (char * params, struct multipath * mpp)
 			/*
 			 * selector args
 			 */
-			for (k = 0; k < num_pg_args; k++)
-				p += get_word(p, NULL);
+			for (k = 0; k < num_pg_args; k++) {
+				if (!strncmp(mpp->selector,
+					     "least-pending", 13)) {
+					p += get_word(p, &word);
+					if (sscanf(word,"%d:*d",
+						   &def_minio) == 1 &&
+					    def_minio != mpp->minio)
+							mpp->minio = def_minio;
+				} else
+					p += get_word(p, NULL);
+			}
 		}
 	}
 	return 0;
openSUSE Build Service is sponsored by