diff options
author | Jens Axboe <jens.axboe@oracle.com> | 2008-10-14 03:51:06 -0400 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2008-10-17 02:46:57 -0400 |
commit | 80a4b58e36b63d7b0b592beb1bd6410aadeeb63c (patch) | |
tree | a37df7feb2db67254cc8927730828e87706b2205 /block/blk-core.c | |
parent | ee2e992cc28553f6c4dd1ab5483c8733c393626b (diff) |
block: only call ->request_fn when the queue is not stopped
Callers should use either blk_run_queue/__blk_run_queue, or
blk_start_queueing() to invoke request handling instead of calling
->request_fn() directly as that does not take the queue stopped
flag into account.
Also add appropriate comments on the above functions to detail
their usage.
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'block/blk-core.c')
-rw-r--r-- | block/blk-core.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/block/blk-core.c b/block/blk-core.c index 2d053b584410..91532f2d2fa7 100644 --- a/block/blk-core.c +++ b/block/blk-core.c | |||
@@ -325,6 +325,9 @@ EXPORT_SYMBOL(blk_unplug); | |||
325 | 325 | ||
326 | static void blk_invoke_request_fn(struct request_queue *q) | 326 | static void blk_invoke_request_fn(struct request_queue *q) |
327 | { | 327 | { |
328 | if (unlikely(blk_queue_stopped(q))) | ||
329 | return; | ||
330 | |||
328 | /* | 331 | /* |
329 | * one level of recursion is ok and is much faster than kicking | 332 | * one level of recursion is ok and is much faster than kicking |
330 | * the unplug handling | 333 | * the unplug handling |
@@ -399,8 +402,13 @@ void blk_sync_queue(struct request_queue *q) | |||
399 | EXPORT_SYMBOL(blk_sync_queue); | 402 | EXPORT_SYMBOL(blk_sync_queue); |
400 | 403 | ||
401 | /** | 404 | /** |
402 | * blk_run_queue - run a single device queue | 405 | * __blk_run_queue - run a single device queue |
403 | * @q: The queue to run | 406 | * @q: The queue to run |
407 | * | ||
408 | * Description: | ||
409 | * See @blk_run_queue. This variant must be called with the queue lock | ||
410 | * held and interrupts disabled. | ||
411 | * | ||
404 | */ | 412 | */ |
405 | void __blk_run_queue(struct request_queue *q) | 413 | void __blk_run_queue(struct request_queue *q) |
406 | { | 414 | { |
@@ -418,6 +426,12 @@ EXPORT_SYMBOL(__blk_run_queue); | |||
418 | /** | 426 | /** |
419 | * blk_run_queue - run a single device queue | 427 | * blk_run_queue - run a single device queue |
420 | * @q: The queue to run | 428 | * @q: The queue to run |
429 | * | ||
430 | * Description: | ||
431 | * Invoke request handling on this queue, if it has pending work to do. | ||
432 | * May be used to restart queueing when a request has completed. Also | ||
433 | * See @blk_start_queueing. | ||
434 | * | ||
421 | */ | 435 | */ |
422 | void blk_run_queue(struct request_queue *q) | 436 | void blk_run_queue(struct request_queue *q) |
423 | { | 437 | { |
@@ -884,7 +898,8 @@ EXPORT_SYMBOL(blk_get_request); | |||
884 | * | 898 | * |
885 | * This is basically a helper to remove the need to know whether a queue | 899 | * This is basically a helper to remove the need to know whether a queue |
886 | * is plugged or not if someone just wants to initiate dispatch of requests | 900 | * is plugged or not if someone just wants to initiate dispatch of requests |
887 | * for this queue. | 901 | * for this queue. Should be used to start queueing on a device outside |
902 | * of ->request_fn() context. Also see @blk_run_queue. | ||
888 | * | 903 | * |
889 | * The queue lock must be held with interrupts disabled. | 904 | * The queue lock must be held with interrupts disabled. |
890 | */ | 905 | */ |