All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] multipath: display average priority as group priority
@ 2010-03-17  7:14 Nikanth Karthikesan
  2010-03-17  7:26 ` Hannes Reinecke
  2010-03-17 21:49 ` Christophe Varoqui
  0 siblings, 2 replies; 3+ messages in thread
From: Nikanth Karthikesan @ 2010-03-17  7:14 UTC (permalink / raw)
  To: Christophe Varoqui; +Cc: device-mapper development

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.

Signed-off-by: Nikanth Karthikesan <knikanth@suse.de>

---

diff --git a/libmultipath/print.c b/libmultipath/print.c
index 10e5ce5..9753fe2 100644
--- a/libmultipath/print.c
+++ b/libmultipath/print.c
@@ -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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] multipath: display average priority as group priority
  2010-03-17  7:14 [PATCH] multipath: display average priority as group priority Nikanth Karthikesan
@ 2010-03-17  7:26 ` Hannes Reinecke
  2010-03-17 21:49 ` Christophe Varoqui
  1 sibling, 0 replies; 3+ messages in thread
From: Hannes Reinecke @ 2010-03-17  7:26 UTC (permalink / raw)
  To: Nikanth Karthikesan; +Cc: device-mapper development

Nikanth Karthikesan wrote:
> 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.
> 
> Signed-off-by: Nikanth Karthikesan <knikanth@suse.de>
Acked-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		      zSeries & Storage
hare@suse.de			      +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Markus Rex, HRB 16746 (AG Nürnberg)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] multipath: display average priority as group priority
  2010-03-17  7:14 [PATCH] multipath: display average priority as group priority Nikanth Karthikesan
  2010-03-17  7:26 ` Hannes Reinecke
@ 2010-03-17 21:49 ` Christophe Varoqui
  1 sibling, 0 replies; 3+ messages in thread
From: Christophe Varoqui @ 2010-03-17 21:49 UTC (permalink / raw)
  To: Nikanth Karthikesan; +Cc: dm-devel

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-03-17 21:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-17  7:14 [PATCH] multipath: display average priority as group priority Nikanth Karthikesan
2010-03-17  7:26 ` Hannes Reinecke
2010-03-17 21:49 ` Christophe Varoqui

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.