diff options
Diffstat (limited to 'block/blk-tag.c')
-rw-r--r-- | block/blk-tag.c | 15 |
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); | |||
336 | int blk_queue_start_tag(struct request_queue *q, struct request *rq) | 336 | int blk_queue_start_tag(struct request_queue *q, struct request *rq) |
337 | { | 337 | { |
338 | struct blk_queue_tag *bqt = q->queue_tags; | 338 | struct blk_queue_tag *bqt = q->queue_tags; |
339 | unsigned max_depth, offset; | 339 | unsigned max_depth; |
340 | int tag; | 340 | int tag; |
341 | 341 | ||
342 | if (unlikely((rq->cmd_flags & REQ_QUEUED))) { | 342 | if (unlikely((rq->cmd_flags & REQ_QUEUED))) { |
@@ -355,13 +355,16 @@ int blk_queue_start_tag(struct request_queue *q, struct request *rq) | |||
355 | * to starve sync IO on behalf of flooding async IO. | 355 | * to starve sync IO on behalf of flooding async IO. |
356 | */ | 356 | */ |
357 | max_depth = bqt->max_depth; | 357 | max_depth = bqt->max_depth; |
358 | if (rq_is_sync(rq)) | 358 | if (!rq_is_sync(rq) && max_depth > 1) { |
359 | offset = 0; | 359 | max_depth -= 2; |
360 | else | 360 | if (!max_depth) |
361 | offset = max_depth >> 2; | 361 | max_depth = 1; |
362 | if (q->in_flight[0] > max_depth) | ||
363 | return 1; | ||
364 | } | ||
362 | 365 | ||
363 | do { | 366 | do { |
364 | tag = find_next_zero_bit(bqt->tag_map, max_depth, offset); | 367 | tag = find_first_zero_bit(bqt->tag_map, max_depth); |
365 | if (tag >= max_depth) | 368 | if (tag >= max_depth) |
366 | return 1; | 369 | return 1; |
367 | 370 | ||