aboutsummaryrefslogtreecommitdiffstats
path: root/block/elevator.c
diff options
context:
space:
mode:
authorNick Piggin <npiggin@suse.de>2008-04-29 08:48:33 -0400
committerJens Axboe <jens.axboe@oracle.com>2008-04-29 08:48:33 -0400
commit75ad23bc0fcb4f992a5d06982bf0857ab1738e9e (patch)
tree8668ef63b1f420252ae41aed9e13737d49fd8054 /block/elevator.c
parent68154e90c9d1492d570671ae181d9a8f8530da55 (diff)
block: make queue flags non-atomic
We can save some atomic ops in the IO path, if we clearly define the rules of how to modify the queue flags. Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'block/elevator.c')
-rw-r--r--block/elevator.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/block/elevator.c b/block/elevator.c
index 88318c383608..e8a90fe23424 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -1070,7 +1070,7 @@ static int elevator_switch(struct request_queue *q, struct elevator_type *new_e)
1070 */ 1070 */
1071 spin_lock_irq(q->queue_lock); 1071 spin_lock_irq(q->queue_lock);
1072 1072
1073 set_bit(QUEUE_FLAG_ELVSWITCH, &q->queue_flags); 1073 queue_flag_set(QUEUE_FLAG_ELVSWITCH, q);
1074 1074
1075 elv_drain_elevator(q); 1075 elv_drain_elevator(q);
1076 1076
@@ -1104,7 +1104,10 @@ static int elevator_switch(struct request_queue *q, struct elevator_type *new_e)
1104 * finally exit old elevator and turn off BYPASS. 1104 * finally exit old elevator and turn off BYPASS.
1105 */ 1105 */
1106 elevator_exit(old_elevator); 1106 elevator_exit(old_elevator);
1107 clear_bit(QUEUE_FLAG_ELVSWITCH, &q->queue_flags); 1107 spin_lock_irq(q->queue_lock);
1108 queue_flag_clear(QUEUE_FLAG_ELVSWITCH, q);
1109 spin_unlock_irq(q->queue_lock);
1110
1108 return 1; 1111 return 1;
1109 1112
1110fail_register: 1113fail_register:
@@ -1115,7 +1118,11 @@ fail_register:
1115 elevator_exit(e); 1118 elevator_exit(e);
1116 q->elevator = old_elevator; 1119 q->elevator = old_elevator;
1117 elv_register_queue(q); 1120 elv_register_queue(q);
1118 clear_bit(QUEUE_FLAG_ELVSWITCH, &q->queue_flags); 1121
1122 spin_lock_irq(q->queue_lock);
1123 queue_flag_clear(QUEUE_FLAG_ELVSWITCH, q);
1124 spin_unlock_irq(q->queue_lock);
1125
1119 return 0; 1126 return 0;
1120} 1127}
1121 1128