提交 2bf0fdad 编写于 作者: T Tejun Heo 提交者: Linus Torvalds

[PATCH] blk: use find_first_zero_bit() in blk_queue_start_tag()

blk_queue_start_tag() hand-coded searching for the first zero bit in the tag
map.  Replace it with find_first_zero_bit().  With this patch,
blk_queue_star_tag() doesn't need to fill remains of tag map with 1, thus
allowing it to work properly with the next remove_real_max_depth patch.
Signed-off-by: NTejun Heo <htejun@gmail.com>
Acked-by: NJens Axboe <axboe@suse.de>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 15d20bfd
...@@ -968,8 +968,7 @@ EXPORT_SYMBOL(blk_queue_end_tag); ...@@ -968,8 +968,7 @@ EXPORT_SYMBOL(blk_queue_end_tag);
int blk_queue_start_tag(request_queue_t *q, struct request *rq) int blk_queue_start_tag(request_queue_t *q, struct request *rq)
{ {
struct blk_queue_tag *bqt = q->queue_tags; struct blk_queue_tag *bqt = q->queue_tags;
unsigned long *map = bqt->tag_map; int tag;
int tag = 0;
if (unlikely((rq->flags & REQ_QUEUED))) { if (unlikely((rq->flags & REQ_QUEUED))) {
printk(KERN_ERR printk(KERN_ERR
...@@ -978,14 +977,10 @@ int blk_queue_start_tag(request_queue_t *q, struct request *rq) ...@@ -978,14 +977,10 @@ int blk_queue_start_tag(request_queue_t *q, struct request *rq)
BUG(); BUG();
} }
for (map = bqt->tag_map; *map == -1UL; map++) { tag = find_first_zero_bit(bqt->tag_map, bqt->max_depth);
tag += BLK_TAGS_PER_LONG; if (tag >= bqt->max_depth)
return 1;
if (tag >= bqt->max_depth)
return 1;
}
tag += ffz(*map);
__set_bit(tag, bqt->tag_map); __set_bit(tag, bqt->tag_map);
rq->flags |= REQ_QUEUED; rq->flags |= REQ_QUEUED;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册