]> Pileus Git - ~andy/linux/commitdiff
blkcg: make blkg_conf_prep() take @pol and return with queue lock held
authorTejun Heo <tj@kernel.org>
Fri, 13 Apr 2012 20:11:29 +0000 (13:11 -0700)
committerJens Axboe <axboe@kernel.dk>
Fri, 20 Apr 2012 08:06:06 +0000 (10:06 +0200)
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>
block/blk-cgroup.c
block/blk-cgroup.h
block/blk-throttle.c
block/cfq-iosched.c

index 2d4d7d6d9ae9441ea791d83424cf7be80eed1960..f6581a090b9d27452cf94324f33b6307641b207c 100644 (file)
@@ -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);
 }
index be80d6eb6531d4880f37ff1611c5a2eab6a7affd..df1c7b290c22b5344fcb47fe334c8cbd0671a623 100644 (file)
@@ -128,7 +128,8 @@ struct blkg_conf_ctx {
        u64                     v;
 };
 
-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);
 void blkg_conf_finish(struct blkg_conf_ctx *ctx);
 
index 0dc4645aa7fe169b446380bad4bf6206f5e503c2..6f1bfdf9a1b75dad2390ad23057eaa7ad63fb39f 100644 (file)
@@ -993,7 +993,7 @@ static int tg_set_conf(struct cgroup *cgrp, struct cftype *cft, const char *buf,
        struct throtl_grp *tg;
        int ret;
 
-       ret = blkg_conf_prep(blkcg, buf, &ctx);
+       ret = blkg_conf_prep(blkcg, &blkio_policy_throtl, buf, &ctx);
        if (ret)
                return ret;
 
index 08db2fc70c2900bfad9eb64ac143eb2714cf3b0f..de95f9a2acf89050c14a37dff113d98bc76b7a0c 100644 (file)
@@ -1400,7 +1400,7 @@ static int cfqg_set_weight_device(struct cgroup *cgrp, struct cftype *cft,
        struct cfq_group *cfqg;
        int ret;
 
-       ret = blkg_conf_prep(blkcg, buf, &ctx);
+       ret = blkg_conf_prep(blkcg, &blkio_policy_cfq, buf, &ctx);
        if (ret)
                return ret;