提交 adb4ddbb 编写于 作者: N Nick Piggin 提交者: Jens Axboe

block: use lock bitops for the tag map.

The block queue tag map can use lock bitops.
Signed-off-by: NNick Piggin <npiggin@suse.de>
Signed-off-by: NJens Axboe <jens.axboe@oracle.com>
上级 bd4f36d6
...@@ -1057,18 +1057,16 @@ void blk_queue_end_tag(struct request_queue *q, struct request *rq) ...@@ -1057,18 +1057,16 @@ void blk_queue_end_tag(struct request_queue *q, struct request *rq)
bqt->tag_index[tag] = NULL; bqt->tag_index[tag] = NULL;
/* if (unlikely(!test_bit(tag, bqt->tag_map))) {
* We use test_and_clear_bit's memory ordering properties here.
* The tag_map bit acts as a lock for tag_index[bit], so we need
* a barrer before clearing the bit (precisely: release semantics).
* Could use clear_bit_unlock when it is merged.
*/
if (unlikely(!test_and_clear_bit(tag, bqt->tag_map))) {
printk(KERN_ERR "%s: attempt to clear non-busy tag (%d)\n", printk(KERN_ERR "%s: attempt to clear non-busy tag (%d)\n",
__FUNCTION__, tag); __FUNCTION__, tag);
return; return;
} }
/*
* The tag_map bit acts as a lock for tag_index[bit], so we need
* unlock memory barrier semantics.
*/
clear_bit_unlock(tag, bqt->tag_map);
bqt->busy--; bqt->busy--;
} }
...@@ -1114,10 +1112,10 @@ int blk_queue_start_tag(struct request_queue *q, struct request *rq) ...@@ -1114,10 +1112,10 @@ int blk_queue_start_tag(struct request_queue *q, struct request *rq)
if (tag >= bqt->max_depth) if (tag >= bqt->max_depth)
return 1; return 1;
} while (test_and_set_bit(tag, bqt->tag_map)); } while (test_and_set_bit_lock(tag, bqt->tag_map));
/* /*
* We rely on test_and_set_bit providing lock memory ordering semantics * We need lock ordering semantics given by test_and_set_bit_lock.
* (could use test_and_set_bit_lock when it is merged). * See blk_queue_end_tag for details.
*/ */
rq->cmd_flags |= REQ_QUEUED; rq->cmd_flags |= REQ_QUEUED;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册