From: Ryo Tsuruta <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, agk@redhat.com
Subject: [PATCH 4/9] blkio-cgroup-v12: Refactoring io-context initialization
Date: Mon, 14 Sep 2009 21:29:46 +0900 (JST) [thread overview]
Message-ID: <20090914.212946.104038099.ryov@valinux.co.jp> (raw)
In-Reply-To: <20090914.212909.71094050.ryov@valinux.co.jp>
This patch refactors io_context initialization.
Signed-off-by: Hirokazu Takahashi <taka@valinux.co.jp>
Signed-off-by: Ryo Tsuruta <ryov@valinux.co.jp>
---
block/blk-ioc.c | 30 +++++++++++++++++-------------
include/linux/iocontext.h | 1 +
2 files changed, 18 insertions(+), 13 deletions(-)
Index: linux-2.6.31/block/blk-ioc.c
===================================================================
--- linux-2.6.31.orig/block/blk-ioc.c
+++ linux-2.6.31/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/include/linux/iocontext.h
===================================================================
--- linux-2.6.31.orig/include/linux/iocontext.h
+++ linux-2.6.31/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)
next prev parent reply other threads:[~2009-09-14 12:29 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-14 12:28 [PATCH 1/9] I/O bandwidth controller and BIO tracking Ryo Tsuruta
2009-09-14 12:28 ` [PATCH 2/9] dm-ioband-1.13.0: All-in-one patch Ryo Tsuruta
2009-09-14 12:29 ` [PATCH 3/9] blkio-cgroup-v12: The new page_cgroup framework Ryo Tsuruta
2009-09-14 12:29 ` Ryo Tsuruta [this message]
2009-09-14 12:30 ` [PATCH 5/9] blkio-cgroup-v12: The body of blkio-cgroup Ryo Tsuruta
2009-09-14 12:30 ` [PATCH 6/9] blkio-cgroup-v12: Page tracking hooks Ryo Tsuruta
2009-09-14 12:31 ` [PATCH 7/9] blkio-cgroup-v12: The document of blkio-cgroup Ryo Tsuruta
2009-09-14 12:31 ` [PATCH 8/9] blkio-cgroup-v12: Add a cgroup support to dm-ioband Ryo Tsuruta
2009-09-14 12:32 ` [PATCH 9/9] blkio-cgroup-v12: The document of a cgroup support for dm-ioband Ryo Tsuruta
2009-09-14 14:11 ` [PATCH 1/9] I/O bandwidth controller and BIO tracking Daniel Walker
2009-09-14 15:06 ` Ryo Tsuruta
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090914.212946.104038099.ryov@valinux.co.jp \
--to=ryov@valinux.co.jp \
--cc=agk@redhat.com \
--cc=containers@lists.linux-foundation.org \
--cc=dm-devel@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=virtualization@lists.linux-foundation.org \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®