Skip to contentSkip to conversation

multipath: display average priority as group priority

PATCH Applied Nikanth Karthikesan 3 participants 3 messages Mar 17, 2010 Device mapper

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 multipath: display average priority as group priority

Display avg priority as group priority

Now average priority is used as path group priority, instead of sum of priorities of the paths. But while displaying group priority, sum is being displayed. Change it to print the average priority.

When there are no enabled paths, print 0 as priority.

---

libmultipath/print.c +4 -1
index 10e5ce5..9753fe2 100644
@@ -378,6 +378,7 @@ snprint_pg_selector (char * buff, size_t len, struct pathgroup * pgp)
 static int
 snprint_pg_pri (char * buff, size_t len, struct pathgroup * pgp)
 {
+	int avg_priority = 0;
 	/*
 	 * path group priority is not updated for every path prio change,
 	 * but only on switch group code path.
@@ -385,7 +386,9 @@ snprint_pg_pri (char * buff, size_t len, struct pathgroup * pgp)
 	 * Printing is another reason to update.
 	 */
 	path_group_prio_update(pgp);
-	return snprint_int(buff, len, pgp->priority);
+	if (pgp->enabled_paths)
+		avg_priority = pgp->priority / pgp->enabled_paths;
+	return snprint_int(buff, len, avg_priority);
 }
 
 static int
Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · Nikanth Karthikesan

Display avg priority as group priority

Now average priority is used as path group priority, instead of sum of priorities of the paths. But while displaying group priority, sum is being displayed. Change it to print the average priority.

When there are no enabled paths, print 0 as priority.

Cheers,

Hannes

Signature · 4 lines
Dr. Hannes Reinecke		      zSeries & Storage
[email protected]			      +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Markus Rex, HRB 16746 (AG Nürnberg)
#2 lore raw
In reply to Nikanth Karthikesan
Quoted 6 lines

Now average priority is used as path group priority, instead of sum of priorities of the paths. But while displaying group priority, sum is being displayed. Change it to print the average priority.

When there are no enabled paths, print 0 as priority.

Applied.
Thanks.