aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--block/blk-cgroup.c17
-rw-r--r--block/blk-cgroup.h3
-rw-r--r--block/blk-throttle.c2
-rw-r--r--block/cfq-iosched.c2
4 files changed, 14 insertions, 10 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}
diff --git a/block/blk-cgroup.h b/block/blk-cgroup.h
index be80d6eb6531..df1c7b290c22 100644
--- a/block/blk-cgroup.h
+++ b/block/blk-cgroup.h
@@ -128,7 +128,8 @@ struct blkg_conf_ctx {
128 u64 v; 128 u64 v;
129}; 129};
130 130
131int blkg_conf_prep(struct blkio_cgroup *blkcg, const char *input, 131int blkg_conf_prep(struct blkio_cgroup *blkcg,
132 const struct blkio_policy_type *pol, const char *input,
132 struct blkg_conf_ctx *ctx); 133 struct blkg_conf_ctx *ctx);
133void blkg_conf_finish(struct blkg_conf_ctx *ctx); 134void blkg_conf_finish(struct blkg_conf_ctx *ctx);
134 135
diff --git a/block/blk-throttle.c b/block/blk-throttle.c
index 0dc4645aa7fe..6f1bfdf9a1b7 100644
--- a/block/blk-throttle.c
+++ b/block/blk-throttle.c
@@ -993,7 +993,7 @@ static int tg_set_conf(struct cgroup *cgrp, struct cftype *cft, const char *buf,
993 struct throtl_grp *tg; 993 struct throtl_grp *tg;
994 int ret; 994 int ret;
995 995
996 ret = blkg_conf_prep(blkcg, buf, &ctx); 996 ret = blkg_conf_prep(blkcg, &blkio_policy_throtl, buf, &ctx);
997 if (ret) 997 if (ret)
998 return ret; 998 return ret;
999 999
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index 08db2fc70c29..de95f9a2acf8 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -1400,7 +1400,7 @@ static int cfqg_set_weight_device(struct cgroup *cgrp, struct cftype *cft,
1400 struct cfq_group *cfqg; 1400 struct cfq_group *cfqg;
1401 int ret; 1401 int ret;
1402 1402
1403 ret = blkg_conf_prep(blkcg, buf, &ctx); 1403 ret = blkg_conf_prep(blkcg, &blkio_policy_cfq, buf, &ctx);
1404 if (ret) 1404 if (ret)
1405 return ret; 1405 return ret;
1406 1406