aboutsummaryrefslogtreecommitdiffstats
path: root/block/blk-cgroup.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2012-04-13 16:11:29 -0400
committerJens Axboe <axboe@kernel.dk>2012-04-20 04:06:06 -0400
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 2d4d7d6d9ae9..f6581a090b9d 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -464,17 +464,19 @@ EXPORT_SYMBOL_GPL(blkg_prfill_rwstat);
464/** 464/**
465 * blkg_conf_prep - parse and prepare for per-blkg config update 465 * blkg_conf_prep - parse and prepare for per-blkg config update
466 * @blkcg: target block cgroup 466 * @blkcg: target block cgroup
467 * @pol: target policy
467 * @input: input string 468 * @input: input string
468 * @ctx: blkg_conf_ctx to be filled 469 * @ctx: blkg_conf_ctx to be filled
469 * 470 *
470 * Parse per-blkg config update from @input and initialize @ctx with the 471 * Parse per-blkg config update from @input and initialize @ctx with the
471 * result. @ctx->blkg points to the blkg to be updated and @ctx->v the new 472 * result. @ctx->blkg points to the blkg to be updated and @ctx->v the new
472 * value. This function returns with RCU read locked and must be paired 473 * value. This function returns with RCU read lock and queue lock held and
473 * with blkg_conf_finish(). 474 * must be paired with blkg_conf_finish().
474 */ 475 */
475int blkg_conf_prep(struct blkio_cgroup *blkcg, const char *input, 476int blkg_conf_prep(struct blkio_cgroup *blkcg,
477 const struct blkio_policy_type *pol, const char *input,
476 struct blkg_conf_ctx *ctx) 478 struct blkg_conf_ctx *ctx)
477 __acquires(rcu) 479 __acquires(rcu) __acquires(disk->queue->queue_lock)
478{ 480{
479 struct gendisk *disk; 481 struct gendisk *disk;
480 struct blkio_group *blkg; 482 struct blkio_group *blkg;
@@ -490,14 +492,14 @@ int blkg_conf_prep(struct blkio_cgroup *blkcg, const char *input,
490 return -EINVAL; 492 return -EINVAL;
491 493
492 rcu_read_lock(); 494 rcu_read_lock();
493
494 spin_lock_irq(disk->queue->queue_lock); 495 spin_lock_irq(disk->queue->queue_lock);
496
495 blkg = blkg_lookup_create(blkcg, disk->queue, false); 497 blkg = blkg_lookup_create(blkcg, disk->queue, false);
496 spin_unlock_irq(disk->queue->queue_lock);
497 498
498 if (IS_ERR(blkg)) { 499 if (IS_ERR(blkg)) {
499 ret = PTR_ERR(blkg); 500 ret = PTR_ERR(blkg);
500 rcu_read_unlock(); 501 rcu_read_unlock();
502 spin_unlock_irq(disk->queue->queue_lock);
501 put_disk(disk); 503 put_disk(disk);
502 /* 504 /*
503 * If queue was bypassing, we should retry. Do so after a 505 * If queue was bypassing, we should retry. Do so after a
@@ -527,8 +529,9 @@ EXPORT_SYMBOL_GPL(blkg_conf_prep);
527 * with blkg_conf_prep(). 529 * with blkg_conf_prep().
528 */ 530 */
529void blkg_conf_finish(struct blkg_conf_ctx *ctx) 531void blkg_conf_finish(struct blkg_conf_ctx *ctx)
530 __releases(rcu) 532 __releases(ctx->disk->queue->queue_lock) __releases(rcu)
531{ 533{
534 spin_unlock_irq(ctx->disk->queue->queue_lock);
532 rcu_read_unlock(); 535 rcu_read_unlock();
533 put_disk(ctx->disk); 536 put_disk(ctx->disk);
534} 537}