aboutsummaryrefslogtreecommitdiffstats
path: root/block/blk-cgroup.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2012-03-05 16:15:12 -0500
committerJens Axboe <axboe@kernel.dk>2012-03-06 15:27:23 -0500
commit5efd611351d1a847c72d74fb12ff4bd187c0cb2c (patch)
treebac28206d088426ab872eea98155cc100bd8d9b1 /block/blk-cgroup.c
parent7ee9c5620504906e98451dc9a1945b2b9e892cb8 (diff)
blkcg: add blkcg_{init|drain|exit}_queue()
Currently block core calls directly into blk-throttle for init, drain and exit. This patch adds blkcg_{init|drain|exit}_queue() which wraps the blk-throttle functions. This is to give more control and visiblity to blkcg core layer for proper layering. Further patches will add logic common to blkcg policies to the functions. While at it, collapse blk_throtl_release() into blk_throtl_exit(). There's no reason to keep them separate. 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.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index d42d826ece39..b302ce1d662b 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -20,6 +20,7 @@
20#include <linux/genhd.h> 20#include <linux/genhd.h>
21#include <linux/delay.h> 21#include <linux/delay.h>
22#include "blk-cgroup.h" 22#include "blk-cgroup.h"
23#include "blk.h"
23 24
24#define MAX_KEY_LEN 100 25#define MAX_KEY_LEN 100
25 26
@@ -1459,6 +1460,47 @@ done:
1459 return &blkcg->css; 1460 return &blkcg->css;
1460} 1461}
1461 1462
1463/**
1464 * blkcg_init_queue - initialize blkcg part of request queue
1465 * @q: request_queue to initialize
1466 *
1467 * Called from blk_alloc_queue_node(). Responsible for initializing blkcg
1468 * part of new request_queue @q.
1469 *
1470 * RETURNS:
1471 * 0 on success, -errno on failure.
1472 */
1473int blkcg_init_queue(struct request_queue *q)
1474{
1475 might_sleep();
1476
1477 return blk_throtl_init(q);
1478}
1479
1480/**
1481 * blkcg_drain_queue - drain blkcg part of request_queue
1482 * @q: request_queue to drain
1483 *
1484 * Called from blk_drain_queue(). Responsible for draining blkcg part.
1485 */
1486void blkcg_drain_queue(struct request_queue *q)
1487{
1488 lockdep_assert_held(q->queue_lock);
1489
1490 blk_throtl_drain(q);
1491}
1492
1493/**
1494 * blkcg_exit_queue - exit and release blkcg part of request_queue
1495 * @q: request_queue being released
1496 *
1497 * Called from blk_release_queue(). Responsible for exiting blkcg part.
1498 */
1499void blkcg_exit_queue(struct request_queue *q)
1500{
1501 blk_throtl_exit(q);
1502}
1503
1462/* 1504/*
1463 * We cannot support shared io contexts, as we have no mean to support 1505 * We cannot support shared io contexts, as we have no mean to support
1464 * two tasks with the same ioc in two different groups without major rework 1506 * two tasks with the same ioc in two different groups without major rework