From patchwork Mon May 18 22:33:40 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "IKEDA, Munehiro" X-Patchwork-Id: 26251 Received: from hormel.redhat.com (hormel1.redhat.com [209.132.177.33]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n4R0JX9x009873 for ; Wed, 27 May 2009 00:19:33 GMT Received: from listman.util.phx.redhat.com (listman.util.phx.redhat.com [10.8.4.110]) by hormel.redhat.com (Postfix) with ESMTP id 809AB619E19; Tue, 26 May 2009 20:19:32 -0400 (EDT) Received: from int-mx2.corp.redhat.com ([172.16.27.26]) by listman.util.phx.redhat.com (8.13.1/8.13.1) with ESMTP id n4IMZ6BO008526 for ; Mon, 18 May 2009 18:35:06 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n4IMZ0xp012889; Mon, 18 May 2009 18:35:03 -0400 Received: from dhcp-100-2-140.bos.redhat.com (dhcp-100-2-140.bos.redhat.com [10.16.2.140]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n4IMYrfg005987; Mon, 18 May 2009 18:34:54 -0400 Message-ID: <4A11E244.2000305@ds.jp.nec.com> Date: Mon, 18 May 2009 18:33:40 -0400 From: "IKEDA, Munehiro" User-Agent: Thunderbird 2.0.0.19 (X11/20090105) MIME-Version: 1.0 To: Gui Jianfeng References: <1241553525-28095-1-git-send-email-vgoyal@redhat.com> <4A0A29B5.7030109@cn.fujitsu.com> <20090513190929.GB18371@redhat.com> <4A0BC7AB.8030703@cn.fujitsu.com> In-Reply-To: <4A0BC7AB.8030703@cn.fujitsu.com> X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 X-loop: dm-devel@redhat.com X-Mailman-Approved-At: Tue, 26 May 2009 20:19:28 -0400 Cc: dhaval@linux.vnet.ibm.com, snitzer@redhat.com, dm-devel@redhat.com, dpshah@google.com, jens.axboe@oracle.com, agk@redhat.com, balbir@linux.vnet.ibm.com, paolo.valente@unimore.it, fernando@oss.ntt.co.jp, mikew@google.com, jmoyer@redhat.com, nauman@google.com, Vivek Goyal , righi.andrea@gmail.com, lizf@cn.fujitsu.com, fchecconi@gmail.com, s-uchida@ap.jp.nec.com, containers@lists.linux-foundation.org, linux-kernel@vger.kernel.org, akpm@linux-foundation.org Subject: [dm-devel] Re: [PATCH] IO Controller: Add per-device weight and ioprio_class handling X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.5 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 Hi Gui, Gui Jianfeng wrote: > Hi Vivek, > > This patch enables per-cgroup per-device weight and ioprio_class handling. > A new cgroup interface "policy" is introduced. You can make use of this > file to configure weight and ioprio_class for each device in a given cgroup. > The original "weight" and "ioprio_class" files are still available. If you > don't do special configuration for a particular device, "weight" and > "ioprio_class" are used as default values in this device. > > You can use the following format to play with the new interface. > #echo DEV:weight:ioprio_class > /patch/to/cgroup/policy > weight=0 means removing the policy for DEV. > > Examples: > Configure weight=300 ioprio_class=2 on /dev/hdb in this cgroup > # echo /dev/hdb:300:2 > io.policy > # cat io.policy > dev weight class > /dev/hdb 300 2 Users can specify a device file of a partition for io.policy. In this case, io_policy_node::dev_name is set as a name of the partition device like /dev/sda2. ex) # cd /mnt/cgroup # cat /dev/sda2:500:2 > io.policy # echo io.policy dev weight class /dev/sda2 500 2 I believe io_policy_node::dev_name should be set a generic device name like /dev/sda. What do you think about it? Signed-off-by: Munehiro "Muuhh" Ikeda --- block/elevator-fq.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/block/elevator-fq.c b/block/elevator-fq.c index 39fa2a1..5d3d55c 100644 --- a/block/elevator-fq.c +++ b/block/elevator-fq.c @@ -1631,11 +1631,12 @@ static struct io_policy_node *policy_search_node(const struct io_cgroup *iocg, return NULL; } -static int devname_to_devnum(const char *buf, dev_t *dev) +static int devname_to_devnum(char *buf, dev_t *dev) { struct block_device *bdev; struct gendisk *disk; int part; + char *c; bdev = lookup_bdev(buf); if (IS_ERR(bdev)) @@ -1645,6 +1646,10 @@ static int devname_to_devnum(const char *buf, dev_t *dev) *dev = MKDEV(disk->major, disk->first_minor); bdput(bdev); + c = strrchr(buf, '/'); + if (c) + strcpy(c+1, disk->disk_name); + return 0; }