aboutsummaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorNick Piggin <npiggin@suse.de>2007-10-24 04:54:38 -0400
committerJens Axboe <jens.axboe@oracle.com>2007-10-29 06:33:06 -0400
commitadb4ddbbfb90c302e78da68b3f015588ca45d7f3 (patch)
tree48f9763a7472ebc93ef7b1b158094fc624161401 /block
parentbd4f36d6da175ed51840fe07b8906951c4dea609 (diff)
block: use lock bitops for the tag map.
The block queue tag map can use lock bitops. Signed-off-by: Nick Piggin <npiggin@suse.de> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'block')
-rw-r--r--block/ll_rw_blk.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/block/ll_rw_blk.c b/block/ll_rw_blk.c
index d8616e6ebd92..a8a181072bf8 100644
--- a/block/ll_rw_blk.c
+++ b/block/ll_rw_blk.c
@@ -1057,18 +1057,16 @@ void blk_queue_end_tag(struct request_queue *q, struct request *rq)
1057 1057
1058 bqt->tag_index[tag] = NULL; 1058 bqt->tag_index[tag] = NULL;
1059 1059
1060 /* 1060 if (unlikely(!test_bit(tag, bqt->tag_map))) {
1061 * We use test_and_clear_bit's memory ordering properties here.
1062 * The tag_map bit acts as a lock for tag_index[bit], so we need
1063 * a barrer before clearing the bit (precisely: release semantics).
1064 * Could use clear_bit_unlock when it is merged.
1065 */
1066 if (unlikely(!test_and_clear_bit(tag, bqt->tag_map))) {
1067 printk(KERN_ERR "%s: attempt to clear non-busy tag (%d)\n", 1061 printk(KERN_ERR "%s: attempt to clear non-busy tag (%d)\n",
1068 __FUNCTION__, tag); 1062 __FUNCTION__, tag);
1069 return; 1063 return;
1070 } 1064 }
1071 1065 /*
1066 * The tag_map bit acts as a lock for tag_index[bit], so we need
1067 * unlock memory barrier semantics.
1068 */
1069 clear_bit_unlock(tag, bqt->tag_map);
1072 bqt->busy--; 1070 bqt->busy--;
1073} 1071}
1074 1072
@@ -1114,10 +1112,10 @@ int blk_queue_start_tag(struct request_queue *q, struct request *rq)
1114 if (tag >= bqt->max_depth) 1112 if (tag >= bqt->max_depth)
1115 return 1; 1113 return 1;
1116 1114
1117 } while (test_and_set_bit(tag, bqt->tag_map)); 1115 } while (test_and_set_bit_lock(tag, bqt->tag_map));
1118 /* 1116 /*
1119 * We rely on test_and_set_bit providing lock memory ordering semantics 1117 * We need lock ordering semantics given by test_and_set_bit_lock.
1120 * (could use test_and_set_bit_lock when it is merged). 1118 * See blk_queue_end_tag for details.
1121 */ 1119 */
1122 1120
1123 rq->cmd_flags |= REQ_QUEUED; 1121 rq->cmd_flags |= REQ_QUEUED;