diff options
author | Tejun Heo <tj@kernel.org> | 2012-03-05 16:14:58 -0500 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2012-03-06 15:27:21 -0500 |
commit | d732580b4eb31553c63744a47d590f770cafb8f0 (patch) | |
tree | ea4e8e21df1b639603693e6f5fdfc5a620cd8737 /block/elevator.c | |
parent | b2fab5acd28ead6f0dd6c3996ba23f0ef1772f15 (diff) |
block: implement blk_queue_bypass_start/end()
Rename and extend elv_queisce_start/end() to
blk_queue_bypass_start/end() which are exported and supports nesting
via @q->bypass_depth. Also add blk_queue_bypass() to test bypass
state.
This will be further extended and used for blkio_group management.
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/elevator.c')
-rw-r--r-- | block/elevator.c | 25 |
1 files changed, 3 insertions, 22 deletions
diff --git a/block/elevator.c b/block/elevator.c index f81c061dad15..0bdea0ed03a3 100644 --- a/block/elevator.c +++ b/block/elevator.c | |||
@@ -553,25 +553,6 @@ void elv_drain_elevator(struct request_queue *q) | |||
553 | } | 553 | } |
554 | } | 554 | } |
555 | 555 | ||
556 | void elv_quiesce_start(struct request_queue *q) | ||
557 | { | ||
558 | if (!q->elevator) | ||
559 | return; | ||
560 | |||
561 | spin_lock_irq(q->queue_lock); | ||
562 | queue_flag_set(QUEUE_FLAG_ELVSWITCH, q); | ||
563 | spin_unlock_irq(q->queue_lock); | ||
564 | |||
565 | blk_drain_queue(q, false); | ||
566 | } | ||
567 | |||
568 | void elv_quiesce_end(struct request_queue *q) | ||
569 | { | ||
570 | spin_lock_irq(q->queue_lock); | ||
571 | queue_flag_clear(QUEUE_FLAG_ELVSWITCH, q); | ||
572 | spin_unlock_irq(q->queue_lock); | ||
573 | } | ||
574 | |||
575 | void __elv_add_request(struct request_queue *q, struct request *rq, int where) | 556 | void __elv_add_request(struct request_queue *q, struct request *rq, int where) |
576 | { | 557 | { |
577 | trace_block_rq_insert(q, rq); | 558 | trace_block_rq_insert(q, rq); |
@@ -903,7 +884,7 @@ static int elevator_switch(struct request_queue *q, struct elevator_type *new_e) | |||
903 | * using INSERT_BACK. All requests have SOFTBARRIER set and no | 884 | * using INSERT_BACK. All requests have SOFTBARRIER set and no |
904 | * merge happens either. | 885 | * merge happens either. |
905 | */ | 886 | */ |
906 | elv_quiesce_start(q); | 887 | blk_queue_bypass_start(q); |
907 | 888 | ||
908 | /* unregister and clear all auxiliary data of the old elevator */ | 889 | /* unregister and clear all auxiliary data of the old elevator */ |
909 | if (registered) | 890 | if (registered) |
@@ -933,7 +914,7 @@ static int elevator_switch(struct request_queue *q, struct elevator_type *new_e) | |||
933 | 914 | ||
934 | /* done, kill the old one and finish */ | 915 | /* done, kill the old one and finish */ |
935 | elevator_exit(old); | 916 | elevator_exit(old); |
936 | elv_quiesce_end(q); | 917 | blk_queue_bypass_end(q); |
937 | 918 | ||
938 | blk_add_trace_msg(q, "elv switch: %s", new_e->elevator_name); | 919 | blk_add_trace_msg(q, "elv switch: %s", new_e->elevator_name); |
939 | 920 | ||
@@ -945,7 +926,7 @@ fail_init: | |||
945 | /* switch failed, restore and re-register old elevator */ | 926 | /* switch failed, restore and re-register old elevator */ |
946 | q->elevator = old; | 927 | q->elevator = old; |
947 | elv_register_queue(q); | 928 | elv_register_queue(q); |
948 | elv_quiesce_end(q); | 929 | blk_queue_bypass_end(q); |
949 | 930 | ||
950 | return err; | 931 | return err; |
951 | } | 932 | } |