aboutsummaryrefslogtreecommitdiffstats
path: root/block/blk.h
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2011-10-19 08:33:01 -0400
committerJens Axboe <axboe@kernel.dk>2011-10-19 08:33:01 -0400
commitbc16a4f933bc5ed50826b20561e4c3515061998b (patch)
tree07c0dc65408932176c32df08e7a8adbbc2ca1d07 /block/blk.h
parente3c78ca524d230bc145e902625e88c392a58ddf3 (diff)
block: reorganize throtl_get_tg() and blk_throtl_bio()
blk_throtl_bio() and throtl_get_tg() have rather unusual interface. * throtl_get_tg() returns pointer to a valid tg or ERR_PTR(-ENODEV), and drops queue_lock in the latter case. Different locking context depending on return value is error-prone and DEAD state is scheduled to be protected by queue_lock anyway. Move DEAD check inside queue_lock and return valid tg or NULL. * blk_throtl_bio() indicates return status both with its return value and in/out param **@bio. The former is used to indicate whether queue is found to be dead during throtl processing. The latter whether the bio is throttled. There's no point in returning DEAD check result from blk_throtl_bio(). The queue can die after blk_throtl_bio() is finished but before make_request_fn() grabs queue lock. Make it take *@bio instead and return boolean result indicating whether the request is throttled or not. This patch doesn't cause any visible functional 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.h')
-rw-r--r--block/blk.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/block/blk.h b/block/blk.h
index 2b66dc21a493..c018dba4e335 100644
--- a/block/blk.h
+++ b/block/blk.h
@@ -190,13 +190,13 @@ static inline int blk_do_io_stat(struct request *rq)
190} 190}
191 191
192#ifdef CONFIG_BLK_DEV_THROTTLING 192#ifdef CONFIG_BLK_DEV_THROTTLING
193extern int blk_throtl_bio(struct request_queue *q, struct bio **bio); 193extern bool blk_throtl_bio(struct request_queue *q, struct bio *bio);
194extern int blk_throtl_init(struct request_queue *q); 194extern int blk_throtl_init(struct request_queue *q);
195extern void blk_throtl_exit(struct request_queue *q); 195extern void blk_throtl_exit(struct request_queue *q);
196#else /* CONFIG_BLK_DEV_THROTTLING */ 196#else /* CONFIG_BLK_DEV_THROTTLING */
197static inline int blk_throtl_bio(struct request_queue *q, struct bio **bio) 197static inline bool blk_throtl_bio(struct request_queue *q, struct bio *bio)
198{ 198{
199 return 0; 199 return false;
200} 200}
201static inline int blk_throtl_init(struct request_queue *q) { return 0; } 201static inline int blk_throtl_init(struct request_queue *q) { return 0; }
202static inline void blk_throtl_exit(struct request_queue *q) { } 202static inline void blk_throtl_exit(struct request_queue *q) { }