aboutsummaryrefslogtreecommitdiffstats
path: root/block/cfq-iosched.c
diff options
context:
space:
mode:
authorVivek Goyal <vgoyal@redhat.com>2009-12-04 10:36:42 -0500
committerJens Axboe <jens.axboe@oracle.com>2009-12-04 10:38:14 -0500
commit3e2520668970aab5a764044a298e987aafc1f63d (patch)
tree088ebf7c4576d597774c8c332bab590dc3a472d6 /block/cfq-iosched.c
parent9d6a986c0b276085f7944cd8ad65f4f82aff7536 (diff)
blkio: Implement dynamic io controlling policy registration
o One of the goals of block IO controller is that it should be able to support mulitple io control policies, some of which be operational at higher level in storage hierarchy. o To begin with, we had one io controlling policy implemented by CFQ, and I hard coded the CFQ functions called by blkio. This created issues when CFQ is compiled as module. o This patch implements a basic dynamic io controlling policy registration functionality in blkio. This is similar to elevator functionality where ioschedulers register the functions dynamically. o Now in future, when more IO controlling policies are implemented, these can dynakically register with block IO controller. Signed-off-by: Vivek Goyal <vgoyal@redhat.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'block/cfq-iosched.c')
-rw-r--r--block/cfq-iosched.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index 7f3f343b0c65..78f4829895bd 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -14,7 +14,6 @@
14#include <linux/ioprio.h> 14#include <linux/ioprio.h>
15#include <linux/blktrace_api.h> 15#include <linux/blktrace_api.h>
16#include "blk-cgroup.h" 16#include "blk-cgroup.h"
17#include "cfq-iosched.h"
18 17
19/* 18/*
20 * tunables 19 * tunables
@@ -3855,6 +3854,17 @@ static struct elevator_type iosched_cfq = {
3855 .elevator_owner = THIS_MODULE, 3854 .elevator_owner = THIS_MODULE,
3856}; 3855};
3857 3856
3857#ifdef CONFIG_CFQ_GROUP_IOSCHED
3858static struct blkio_policy_type blkio_policy_cfq = {
3859 .ops = {
3860 .blkio_unlink_group_fn = cfq_unlink_blkio_group,
3861 .blkio_update_group_weight_fn = cfq_update_blkio_group_weight,
3862 },
3863};
3864#else
3865static struct blkio_policy_type blkio_policy_cfq;
3866#endif
3867
3858static int __init cfq_init(void) 3868static int __init cfq_init(void)
3859{ 3869{
3860 /* 3870 /*
@@ -3869,6 +3879,7 @@ static int __init cfq_init(void)
3869 return -ENOMEM; 3879 return -ENOMEM;
3870 3880
3871 elv_register(&iosched_cfq); 3881 elv_register(&iosched_cfq);
3882 blkio_policy_register(&blkio_policy_cfq);
3872 3883
3873 return 0; 3884 return 0;
3874} 3885}
@@ -3876,6 +3887,7 @@ static int __init cfq_init(void)
3876static void __exit cfq_exit(void) 3887static void __exit cfq_exit(void)
3877{ 3888{
3878 DECLARE_COMPLETION_ONSTACK(all_gone); 3889 DECLARE_COMPLETION_ONSTACK(all_gone);
3890 blkio_policy_unregister(&blkio_policy_cfq);
3879 elv_unregister(&iosched_cfq); 3891 elv_unregister(&iosched_cfq);
3880 ioc_gone = &all_gone; 3892 ioc_gone = &all_gone;
3881 /* ioc_gone's update must be visible before reading ioc_count */ 3893 /* ioc_gone's update must be visible before reading ioc_count */