From patchwork Wed Mar 17 07:14:25 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikanth Karthikesan X-Patchwork-Id: 86270 X-Patchwork-Delegate: christophe.varoqui@free.fr Received: from mx02.colomx.prod.int.phx2.redhat.com (mx4-phx2.redhat.com [209.132.183.25]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o2H7F2Vm026523 for ; Wed, 17 Mar 2010 07:15:40 GMT Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx02.colomx.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o2H7DQkd010760; Wed, 17 Mar 2010 03:13:27 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o2H7DNXM007676 for ; Wed, 17 Mar 2010 03:13:23 -0400 Received: from mx1.redhat.com (ext-mx06.extmail.prod.ext.phx2.redhat.com [10.5.110.10]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o2H7DHv9017406 for ; Wed, 17 Mar 2010 03:13:18 -0400 Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o2H7D6hY028807 for ; Wed, 17 Mar 2010 03:13:07 -0400 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.221.2]) by mx2.suse.de (Postfix) with ESMTP id 357D186391; Wed, 17 Mar 2010 08:13:06 +0100 (CET) From: Nikanth Karthikesan Organization: suse.de To: Christophe Varoqui Date: Wed, 17 Mar 2010 12:44:25 +0530 User-Agent: KMail/1.12.4 (Linux/2.6.31.12-0.1-desktop; KDE/4.3.5; x86_64; ; ) MIME-Version: 1.0 Message-Id: <201003171244.25957.knikanth@suse.de> X-RedHat-Spam-Score: -2.31 (RCVD_IN_DNSWL_MED,T_RP_MATCHES_RCVD) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-Scanned-By: MIMEDefang 2.67 on 10.5.110.10 X-loop: dm-devel@redhat.com Cc: device-mapper development Subject: [dm-devel] [PATCH] multipath: display average priority as group priority X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk Reply-To: device-mapper development List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Wed, 17 Mar 2010 07:15:40 +0000 (UTC) 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