diff options
author | Jens Axboe <jens.axboe@oracle.com> | 2008-07-03 13:18:54 +0200 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2008-07-03 13:21:15 +0200 |
commit | e48ec69005f02b70b7ecfde1bc39a599086d16ef (patch) | |
tree | 1868fc162e00af21332a82cdf348229c6b985d2f /block | |
parent | e180f5949327e897bc35a816f4f4010186632df9 (diff) | |
download | kernel-crypto-e48ec69005f02b70b7ecfde1bc39a599086d16ef.tar.gz kernel-crypto-e48ec69005f02b70b7ecfde1bc39a599086d16ef.tar.xz kernel-crypto-e48ec69005f02b70b7ecfde1bc39a599086d16ef.zip |
block: extend queue_flag bitops
Add test_and_clear and test_and_set.
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'block')
-rw-r--r-- | block/blk-core.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/block/blk-core.c b/block/blk-core.c index e0fb0bcc0c1..dbc7f42b5d2 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -205,8 +205,7 @@ void blk_plug_device(struct request_queue *q) if (blk_queue_stopped(q)) return; - if (!test_bit(QUEUE_FLAG_PLUGGED, &q->queue_flags)) { - __set_bit(QUEUE_FLAG_PLUGGED, &q->queue_flags); + if (!queue_flag_test_and_set(QUEUE_FLAG_PLUGGED, q)) { mod_timer(&q->unplug_timer, jiffies + q->unplug_delay); blk_add_trace_generic(q, NULL, 0, BLK_TA_PLUG); } @@ -221,10 +220,9 @@ int blk_remove_plug(struct request_queue *q) { WARN_ON(!irqs_disabled()); - if (!test_bit(QUEUE_FLAG_PLUGGED, &q->queue_flags)) + if (!queue_flag_test_and_clear(QUEUE_FLAG_PLUGGED, q)) return 0; - queue_flag_clear(QUEUE_FLAG_PLUGGED, q); del_timer(&q->unplug_timer); return 1; } @@ -328,8 +326,7 @@ void blk_start_queue(struct request_queue *q) * one level of recursion is ok and is much faster than kicking * the unplug handling */ - if (!test_bit(QUEUE_FLAG_REENTER, &q->queue_flags)) { - queue_flag_set(QUEUE_FLAG_REENTER, q); + if (!queue_flag_test_and_set(QUEUE_FLAG_REENTER, q)) { q->request_fn(q); queue_flag_clear(QUEUE_FLAG_REENTER, q); } else { @@ -394,8 +391,7 @@ void __blk_run_queue(struct request_queue *q) * handling reinvoke the handler shortly if we already got there. */ if (!elv_queue_empty(q)) { - if (!test_bit(QUEUE_FLAG_REENTER, &q->queue_flags)) { - queue_flag_set(QUEUE_FLAG_REENTER, q); + if (!queue_flag_test_and_set(QUEUE_FLAG_REENTER, q)) { q->request_fn(q); queue_flag_clear(QUEUE_FLAG_REENTER, q); } else { |