aboutsummaryrefslogtreecommitdiff
path: root/block/blk-cgroup.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2012-04-13 13:11:29 -0700
committerJens Axboe <axboe@kernel.dk>2012-04-20 10:06:06 +0200
commitda8b066262e12d1d0a3b1e6d3486e500169bf730 (patch)
tree048eee7101b526017bbd295366bf2e95dd65e5a7 /block/blk-cgroup.c
parent8bd435b30ecacb69bbb8b2d3e251f770b807c5b2 (diff)
blkcg: make blkg_conf_prep() take @pol and return with queue lock held
Add @pol to blkg_conf_prep() and let it return with queue lock held (to be released by blkg_conf_finish()). Note that @pol isn't used yet. This is to prepare for per-queue policy activation and doesn't cause any visible difference. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Vivek Goyal <vgoyal@redhat.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/blk-cgroup.c')
-rw-r--r--block/blk-cgroup.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index 2d4d7d6d9ae..f6581a090b9 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -464,17 +464,19 @@ EXPORT_SYMBOL_GPL(blkg_prfill_rwstat);
/**
* blkg_conf_prep - parse and prepare for per-blkg config update
* @blkcg: target block cgroup
+ * @pol: target policy
* @input: input string
* @ctx: blkg_conf_ctx to be filled
*
* Parse per-blkg config update from @input and initialize @ctx with the
* result. @ctx->blkg points to the blkg to be updated and @ctx->v the new
- * value. This function returns with RCU read locked and must be paired
- * with blkg_conf_finish().
+ * value. This function returns with RCU read lock and queue lock held and
+ * must be paired with blkg_conf_finish().
*/
-int blkg_conf_prep(struct blkio_cgroup *blkcg, const char *input,
+int blkg_conf_prep(struct blkio_cgroup *blkcg,
+ const struct blkio_policy_type *pol, const char *input,
struct blkg_conf_ctx *ctx)
- __acquires(rcu)
+ __acquires(rcu) __acquires(disk->queue->queue_lock)
{
struct gendisk *disk;
struct blkio_group *blkg;
@@ -490,14 +492,14 @@ int blkg_conf_prep(struct blkio_cgroup *blkcg, const char *input,
return -EINVAL;
rcu_read_lock();
-
spin_lock_irq(disk->queue->queue_lock);
+
blkg = blkg_lookup_create(blkcg, disk->queue, false);
- spin_unlock_irq(disk->queue->queue_lock);
if (IS_ERR(blkg)) {
ret = PTR_ERR(blkg);
rcu_read_unlock();
+ spin_unlock_irq(disk->queue->queue_lock);
put_disk(disk);
/*
* If queue was bypassing, we should retry. Do so after a
@@ -527,8 +529,9 @@ EXPORT_SYMBOL_GPL(blkg_conf_prep);
* with blkg_conf_prep().
*/
void blkg_conf_finish(struct blkg_conf_ctx *ctx)
- __releases(rcu)
+ __releases(ctx->disk->queue->queue_lock) __releases(rcu)
{
+ spin_unlock_irq(ctx->disk->queue->queue_lock);
rcu_read_unlock();
put_disk(ctx->disk);
}