Commit 719d3402 authored by Jens Axboe's avatar Jens Axboe Committed by Linus Torvalds

[PATCH] cfq-iosched: tighten allow merge criteria

The logic in cfq_allow_merge() wasn't clear enough - basically allow
merging for the same queues only.  Do a fast check for 'rq and bio both
sync/async' before doing the cfqq hash lookup.

This is verified to work with the fixed elv_try_merge() from commit
bb4067e3.
Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent c2fda5fe
...@@ -577,25 +577,20 @@ static int cfq_allow_merge(request_queue_t *q, struct request *rq, ...@@ -577,25 +577,20 @@ static int cfq_allow_merge(request_queue_t *q, struct request *rq,
pid_t key; pid_t key;
/* /*
* If bio is async or a write, always allow merge * Disallow merge, if bio and rq aren't both sync or async
*/ */
if (!bio_sync(bio) || rw == WRITE) if (!!bio_sync(bio) != !!rq_is_sync(rq))
return 1;
/*
* bio is sync. if request is not, disallow.
*/
if (!rq_is_sync(rq))
return 0; return 0;
/* /*
* Ok, both bio and request are sync. Allow merge if they are * Lookup the cfqq that this bio will be queued with. Allow
* from the same queue. * merge only if rq is queued there.
*/ */
key = cfq_queue_pid(current, rw, 1); key = cfq_queue_pid(current, rw, bio_sync(bio));
cfqq = cfq_find_cfq_hash(cfqd, key, current->ioprio); cfqq = cfq_find_cfq_hash(cfqd, key, current->ioprio);
if (cfqq != RQ_CFQQ(rq))
return 0; if (cfqq == RQ_CFQQ(rq))
return 1;
return 1; return 1;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment