summaryrefslogtreecommitdiffstats
path: root/block/blk-tag.c
diff options
context:
space:
mode:
authorJens Axboe <jens.axboe@oracle.com>2009-05-20 08:54:31 +0200
committerJens Axboe <jens.axboe@oracle.com>2009-05-20 08:54:31 +0200
commit0a7ae2ff0d29bb3b327edff4c8ab67b3834fa811 (patch)
tree88309ac99a39e15b9b23525a00a15b1564957b32 /block/blk-tag.c
parentac36552a52a6ec8563ac0a109e2a0935673f4abb (diff)
downloadlinux-stable-0a7ae2ff0d29bb3b327edff4c8ab67b3834fa811.tar.gz
linux-stable-0a7ae2ff0d29bb3b327edff4c8ab67b3834fa811.tar.bz2
linux-stable-0a7ae2ff0d29bb3b327edff4c8ab67b3834fa811.zip
block: change the tag sync vs async restriction logic
Make them fully share the tag space, but disallow async requests using the last any two slots. Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'block/blk-tag.c')
-rw-r--r--block/blk-tag.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/block/blk-tag.c b/block/blk-tag.c
index c260f7c30dda..2e5cfeb59333 100644
--- a/block/blk-tag.c
+++ b/block/blk-tag.c
@@ -336,7 +336,7 @@ EXPORT_SYMBOL(blk_queue_end_tag);
int blk_queue_start_tag(struct request_queue *q, struct request *rq)
{
struct blk_queue_tag *bqt = q->queue_tags;
- unsigned max_depth, offset;
+ unsigned max_depth;
int tag;
if (unlikely((rq->cmd_flags & REQ_QUEUED))) {
@@ -355,13 +355,16 @@ int blk_queue_start_tag(struct request_queue *q, struct request *rq)
* to starve sync IO on behalf of flooding async IO.
*/
max_depth = bqt->max_depth;
- if (rq_is_sync(rq))
- offset = 0;
- else
- offset = max_depth >> 2;
+ if (!rq_is_sync(rq) && max_depth > 1) {
+ max_depth -= 2;
+ if (!max_depth)
+ max_depth = 1;
+ if (q->in_flight[0] > max_depth)
+ return 1;
+ }
do {
- tag = find_next_zero_bit(bqt->tag_map, max_depth, offset);
+ tag = find_first_zero_bit(bqt->tag_map, max_depth);
if (tag >= max_depth)
return 1;