From patchwork Mon Aug 24 08:55:01 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryo Tsuruta X-Patchwork-Id: 43578 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 n7O8tAln005460 for ; Mon, 24 Aug 2009 08:55:10 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 D743061905B; Mon, 24 Aug 2009 04:55:09 -0400 (EDT) Received: from int-mx01.intmail.prod.int.phx2.redhat.com (nat-pool.util.phx.redhat.com [10.8.5.200]) by listman.util.phx.redhat.com (8.13.1/8.13.1) with ESMTP id n7O8t89a004312 for ; Mon, 24 Aug 2009 04:55:08 -0400 Received: from mx1.redhat.com (ext-mx10.extmail.prod.ext.phx2.redhat.com [10.5.110.14]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n7O8t8jc009723 for ; Mon, 24 Aug 2009 04:55:08 -0400 Received: from mail.valinux.co.jp (mail.valinux.co.jp [210.128.90.3]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n7O8t15H004003 for ; Mon, 24 Aug 2009 04:55:01 -0400 Received: from localhost (kappa.local.valinux.co.jp [172.16.2.46]) by mail.valinux.co.jp (Postfix) with ESMTP id 3848A496C9; Mon, 24 Aug 2009 17:55:01 +0900 (JST) Date: Mon, 24 Aug 2009 17:55:01 +0900 (JST) Message-Id: <20090824.175501.71097896.ryov@valinux.co.jp> To: linux-kernel@vger.kernel.org, dm-devel@redhat.com, containers@lists.linux-foundation.org, virtualization@lists.linux-foundation.org, xen-devel@lists.xensource.com From: Ryo Tsuruta In-Reply-To: <20090824.175437.226794671.ryov@valinux.co.jp> References: <20090824.175402.193692180.ryov@valinux.co.jp> <20090824.175437.226794671.ryov@valinux.co.jp> Mime-Version: 1.0 X-Virus-Scanned: clamav-milter 0.95.2 at va-mail.local.valinux.co.jp X-Virus-Status: Clean X-RedHat-Spam-Score: -0.5 (AWL) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-Scanned-By: MIMEDefang 2.67 on 10.5.110.14 X-loop: dm-devel@redhat.com Cc: Subject: [dm-devel] [PATCH 3/8] blkio-cgroup-v11: Refactoring io-context initialization 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 This patch refactors io_context initialization. Signed-off-by: Hirokazu Takahashi Signed-off-by: Ryo Tsuruta --- block/blk-ioc.c | 30 +++++++++++++++++------------- include/linux/iocontext.h | 1 + 2 files changed, 18 insertions(+), 13 deletions(-) -- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel Index: linux-2.6.31-rc7/block/blk-ioc.c =================================================================== --- linux-2.6.31-rc7.orig/block/blk-ioc.c +++ linux-2.6.31-rc7/block/blk-ioc.c @@ -84,24 +84,28 @@ void exit_io_context(void) } } +void init_io_context(struct io_context *ioc) +{ + atomic_long_set(&ioc->refcount, 1); + atomic_set(&ioc->nr_tasks, 1); + spin_lock_init(&ioc->lock); + ioc->ioprio_changed = 0; + ioc->ioprio = 0; + ioc->last_waited = jiffies; /* doesn't matter... */ + ioc->nr_batch_requests = 0; /* because this is 0 */ + ioc->aic = NULL; + INIT_RADIX_TREE(&ioc->radix_root, GFP_ATOMIC | __GFP_HIGH); + INIT_HLIST_HEAD(&ioc->cic_list); + ioc->ioc_data = NULL; +} + struct io_context *alloc_io_context(gfp_t gfp_flags, int node) { struct io_context *ret; ret = kmem_cache_alloc_node(iocontext_cachep, gfp_flags, node); - if (ret) { - atomic_long_set(&ret->refcount, 1); - atomic_set(&ret->nr_tasks, 1); - spin_lock_init(&ret->lock); - ret->ioprio_changed = 0; - ret->ioprio = 0; - ret->last_waited = jiffies; /* doesn't matter... */ - ret->nr_batch_requests = 0; /* because this is 0 */ - ret->aic = NULL; - INIT_RADIX_TREE(&ret->radix_root, GFP_ATOMIC | __GFP_HIGH); - INIT_HLIST_HEAD(&ret->cic_list); - ret->ioc_data = NULL; - } + if (ret) + init_io_context(ret); return ret; } Index: linux-2.6.31-rc7/include/linux/iocontext.h =================================================================== --- linux-2.6.31-rc7.orig/include/linux/iocontext.h +++ linux-2.6.31-rc7/include/linux/iocontext.h @@ -104,6 +104,7 @@ int put_io_context(struct io_context *io void exit_io_context(void); struct io_context *get_io_context(gfp_t gfp_flags, int node); struct io_context *alloc_io_context(gfp_t gfp_flags, int node); +void init_io_context(struct io_context *ioc); void copy_io_context(struct io_context **pdst, struct io_context **psrc); #else static inline void exit_io_context(void)