aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/blkdev.h
diff options
context:
space:
mode:
authorVivek Goyal <vgoyal@redhat.com>2010-09-15 17:06:35 -0400
committerJens Axboe <jaxboe@fusionio.com>2010-09-16 02:42:52 -0400
commite43473b7f223ec866f7db273697e76c337c390f9 (patch)
treee90b52dbe4ec4ae37263a00e2bd9eaf5367cf72f /include/linux/blkdev.h
parent4c9eefa16c6f124ffcc736cb719b24ea27f85017 (diff)
blkio: Core implementation of throttle policy
o Actual implementation of throttling policy in block layer. Currently it implements READ and WRITE bytes per second throttling logic. IOPS throttling comes in later patches. Signed-off-by: Vivek Goyal <vgoyal@redhat.com> Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Diffstat (limited to 'include/linux/blkdev.h')
-rw-r--r--include/linux/blkdev.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 780824edac16..1341df5806df 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -371,6 +371,11 @@ struct request_queue
371#if defined(CONFIG_BLK_DEV_BSG) 371#if defined(CONFIG_BLK_DEV_BSG)
372 struct bsg_class_device bsg_dev; 372 struct bsg_class_device bsg_dev;
373#endif 373#endif
374
375#ifdef CONFIG_BLK_DEV_THROTTLING
376 /* Throttle data */
377 struct throtl_data *td;
378#endif
374}; 379};
375 380
376#define QUEUE_FLAG_CLUSTER 0 /* cluster several segments into 1 */ 381#define QUEUE_FLAG_CLUSTER 0 /* cluster several segments into 1 */
@@ -1131,6 +1136,7 @@ static inline void put_dev_sector(Sector p)
1131 1136
1132struct work_struct; 1137struct work_struct;
1133int kblockd_schedule_work(struct request_queue *q, struct work_struct *work); 1138int kblockd_schedule_work(struct request_queue *q, struct work_struct *work);
1139int kblockd_schedule_delayed_work(struct request_queue *q, struct delayed_work *dwork, unsigned long delay);
1134 1140
1135#ifdef CONFIG_BLK_CGROUP 1141#ifdef CONFIG_BLK_CGROUP
1136/* 1142/*
@@ -1174,6 +1180,24 @@ static inline uint64_t rq_io_start_time_ns(struct request *req)
1174} 1180}
1175#endif 1181#endif
1176 1182
1183#ifdef CONFIG_BLK_DEV_THROTTLING
1184extern int blk_throtl_init(struct request_queue *q);
1185extern void blk_throtl_exit(struct request_queue *q);
1186extern int blk_throtl_bio(struct request_queue *q, struct bio **bio);
1187extern void throtl_schedule_delayed_work(struct request_queue *q, unsigned long delay);
1188extern void throtl_shutdown_timer_wq(struct request_queue *q);
1189#else /* CONFIG_BLK_DEV_THROTTLING */
1190static inline int blk_throtl_bio(struct request_queue *q, struct bio **bio)
1191{
1192 return 0;
1193}
1194
1195static inline int blk_throtl_init(struct request_queue *q) { return 0; }
1196static inline int blk_throtl_exit(struct request_queue *q) { return 0; }
1197static inline void throtl_schedule_delayed_work(struct request_queue *q, unsigned long delay) {}
1198static inline void throtl_shutdown_timer_wq(struct request_queue *q) {}
1199#endif /* CONFIG_BLK_DEV_THROTTLING */
1200
1177#define MODULE_ALIAS_BLOCKDEV(major,minor) \ 1201#define MODULE_ALIAS_BLOCKDEV(major,minor) \
1178 MODULE_ALIAS("block-major-" __stringify(major) "-" __stringify(minor)) 1202 MODULE_ALIAS("block-major-" __stringify(major) "-" __stringify(minor))
1179#define MODULE_ALIAS_BLOCKDEV_MAJOR(major) \ 1203#define MODULE_ALIAS_BLOCKDEV_MAJOR(major) \