From patchwork Wed May 20 01:44:48 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gui Jianfeng X-Patchwork-Id: 26257 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 n4R0SePU010747 for ; Wed, 27 May 2009 00:28:41 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 7ED1B8E0173; Tue, 26 May 2009 20:28:40 -0400 (EDT) Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by listman.util.phx.redhat.com (8.13.1/8.13.1) with ESMTP id n4K1kHhI000520 for ; Tue, 19 May 2009 21:46:17 -0400 Received: from mx1.redhat.com (mx1.redhat.com [172.16.48.31]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n4K1kCYe017198; Tue, 19 May 2009 21:46:12 -0400 Received: from song.cn.fujitsu.com (cn.fujitsu.com [222.73.24.84] (may be forged)) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n4K1jwwg019512; Tue, 19 May 2009 21:45:59 -0400 Received: from tang.cn.fujitsu.com (tang.cn.fujitsu.com [10.167.250.3]) by song.cn.fujitsu.com (Postfix) with ESMTP id AF2D617008D; Wed, 20 May 2009 09:52:20 +0800 (CST) Received: from fnst.cn.fujitsu.com (localhost.localdomain [127.0.0.1]) by tang.cn.fujitsu.com (8.13.1/8.13.1) with ESMTP id n4K1kD4A026557; Wed, 20 May 2009 09:46:13 +0800 Received: from [127.0.0.1] (unknown [10.167.141.226]) by fnst.cn.fujitsu.com (Postfix) with ESMTPA id AAABBD402F; Wed, 20 May 2009 09:55:55 +0800 (CST) Message-ID: <4A136090.5090705@cn.fujitsu.com> Date: Wed, 20 May 2009 09:44:48 +0800 From: Gui Jianfeng User-Agent: Thunderbird 2.0.0.5 (Windows/20070716) MIME-Version: 1.0 To: "IKEDA, Munehiro" , Vivek Goyal References: <1241553525-28095-1-git-send-email-vgoyal@redhat.com> <4A0A29B5.7030109@cn.fujitsu.com> <20090513190929.GB18371@redhat.com> <4A0BC7AB.8030703@cn.fujitsu.com> <4A11E244.2000305@ds.jp.nec.com> In-Reply-To: <4A11E244.2000305@ds.jp.nec.com> X-RedHat-Spam-Score: -0.704 X-Scanned-By: MIMEDefang 2.58 on 172.16.52.254 X-Scanned-By: MIMEDefang 2.63 on 172.16.48.31 X-loop: dm-devel@redhat.com X-Mailman-Approved-At: Tue, 26 May 2009 20:28:27 -0400 Cc: paolo.valente@unimore.it, dhaval@linux.vnet.ibm.com, dm-devel@redhat.com, linux-kernel@vger.kernel.org, fernando@oss.ntt.co.jp, lizf@cn.fujitsu.com, jmoyer@redhat.com, akpm@linux-foundation.org, mikew@google.com, fchecconi@gmail.com, dpshah@google.com, snitzer@redhat.com, jens.axboe@oracle.com, nauman@google.com, s-uchida@ap.jp.nec.com, righi.andrea@gmail.com, containers@lists.linux-foundation.org, agk@redhat.com, balbir@linux.vnet.ibm.com 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 IKEDA, Munehiro wrote: > 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? Hi Ikeda-san, Sorry for the late reply. Thanks for pointing this out. yes, it does the right thing but shows a wrong name. IMHO, Inputing a sigle partition should not be allowed since the policy is disk basis. So how about the following patch? Signed-off-by: Gui Jianfeng --- > > 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; > } > diff --git a/block/elevator-fq.c b/block/elevator-fq.c index 1a0ca07..b620768 100644 --- a/block/elevator-fq.c +++ b/block/elevator-fq.c @@ -1650,6 +1650,9 @@ static int devname_to_devnum(const char *buf, dev_t *dev) return -ENODEV; disk = get_gendisk(bdev->bd_dev, &part); + if (part) + return -EINVAL; + *dev = MKDEV(disk->major, disk->first_minor); bdput(bdev);