From patchwork Fri May 8 09:45:32 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gui Jianfeng X-Patchwork-Id: 26260 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 n4R0Teqr010859 for ; Wed, 27 May 2009 00:29:48 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 A6F9C8E01D6; Tue, 26 May 2009 20:29:44 -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 n489m9QG010693 for ; Fri, 8 May 2009 05:48:09 -0400 Received: from mx3.redhat.com (mx3.redhat.com [172.16.48.32]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n489m8GN028024; Fri, 8 May 2009 05:48:08 -0400 Received: from song.cn.fujitsu.com (cn.fujitsu.com [222.73.24.84] (may be forged)) by mx3.redhat.com (8.13.8/8.13.8) with ESMTP id n489lAnQ027826; Fri, 8 May 2009 05:47:44 -0400 Received: from tang.cn.fujitsu.com (tang.cn.fujitsu.com [10.167.250.3]) by song.cn.fujitsu.com (Postfix) with ESMTP id A069217008D; Fri, 8 May 2009 18:54:00 +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 n489lJwj016669; Fri, 8 May 2009 17:47:19 +0800 Received: from [127.0.0.1] (unknown [10.167.141.226]) by fnst.cn.fujitsu.com (Postfix) with ESMTPA id D6CB8D4032; Fri, 8 May 2009 17:54:58 +0800 (CST) Message-ID: <4A03FF3C.4020506@cn.fujitsu.com> Date: Fri, 08 May 2009 17:45:32 +0800 From: Gui Jianfeng User-Agent: Thunderbird 2.0.0.5 (Windows/20070716) MIME-Version: 1.0 To: Vivek Goyal References: <1241553525-28095-1-git-send-email-vgoyal@redhat.com> In-Reply-To: <1241553525-28095-1-git-send-email-vgoyal@redhat.com> X-RedHat-Spam-Score: -0.708 X-Scanned-By: MIMEDefang 2.58 on 172.16.52.254 X-Scanned-By: MIMEDefang 2.63 on 172.16.48.32 X-loop: dm-devel@redhat.com X-Mailman-Approved-At: Tue, 26 May 2009 20:29:29 -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, m-ikeda@ds.jp.nec.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, righi.andrea@gmail.com Subject: [dm-devel] [PATCH] io-controller: Add io group reference handling for request 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 Vivek, This patch adds io group reference handling when allocating and removing a request. Signed-off-by: Gui Jianfeng --- elevator-fq.c | 15 ++++++++++++++- elevator-fq.h | 5 +++++ elevator.c | 2 ++ 3 files changed, 21 insertions(+), 1 deletion(-) -- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel diff --git a/block/elevator-fq.c b/block/elevator-fq.c index 9500619..e6d6712 100644 --- a/block/elevator-fq.c +++ b/block/elevator-fq.c @@ -1968,11 +1968,24 @@ void elv_fq_set_request_io_group(struct request_queue *q, struct request *rq, spin_unlock_irqrestore(q->queue_lock, flags); BUG_ON(!iog); - /* Store iog in rq. TODO: take care of referencing */ + elv_get_iog(iog); rq->iog = iog; } /* + * This request has been serviced. Clean up iog info and drop the reference. + */ +void elv_fq_unset_request_io_group(struct request *rq) +{ + struct io_group *iog = rq->iog; + + if (iog) { + rq->iog = NULL; + elv_put_iog(iog); + } +} + +/* * Find/Create the io queue the rq should go in. This is an optimization * for the io schedulers (noop, deadline and AS) which maintain only single * io queue per cgroup. In this case common layer can just maintain a diff --git a/block/elevator-fq.h b/block/elevator-fq.h index db3a347..96a28e9 100644 --- a/block/elevator-fq.h +++ b/block/elevator-fq.h @@ -512,6 +512,7 @@ static inline struct io_group *ioq_to_io_group(struct io_queue *ioq) extern int io_group_allow_merge(struct request *rq, struct bio *bio); extern void elv_fq_set_request_io_group(struct request_queue *q, struct request *rq, struct bio *bio); +extern void elv_fq_unset_request_io_group(struct request *rq); static inline bfq_weight_t iog_weight(struct io_group *iog) { return iog->entity.weight; @@ -571,6 +572,10 @@ static inline void elv_fq_set_request_io_group(struct request_queue *q, { } +static inline void elv_fq_unset_request_io_group(struct request *rq) +{ +} + static inline bfq_weight_t iog_weight(struct io_group *iog) { /* Just root group is present and weight is immaterial. */ diff --git a/block/elevator.c b/block/elevator.c index 44c9fad..d75eec7 100644 --- a/block/elevator.c +++ b/block/elevator.c @@ -992,6 +992,8 @@ void elv_put_request(struct request_queue *q, struct request *rq) { struct elevator_queue *e = q->elevator; + elv_fq_unset_request_io_group(rq); + /* * Optimization for noop, deadline and AS which maintain only single * ioq per io group