aboutsummaryrefslogtreecommitdiffstats
path: root/block/cfq-iosched.c
diff options
context:
space:
mode:
authorJens Axboe <jens.axboe@oracle.com>2006-12-22 03:38:53 -0500
committerLinus Torvalds <torvalds@woody.osdl.org>2006-12-22 17:13:08 -0500
commit719d34027e1a186e46a3952e8a24bf91ecc33837 (patch)
treef0b9074069777c430045e7be803d8c5a2187ecc9 /block/cfq-iosched.c
parentc2fda5fed81eea077363b285b66eafce20dfd45a (diff)
[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 bb4067e34159648d394943d5e2a011f838bff22f. Signed-off-by: Jens Axboe <jens.axboe@oracle.com> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'block/cfq-iosched.c')
-rw-r--r--block/cfq-iosched.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index 9fc5eafa6c0e..4b4217d9be78 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -577,25 +577,20 @@ static int cfq_allow_merge(request_queue_t *q, struct request *rq,
577 pid_t key; 577 pid_t key;
578 578
579 /* 579 /*
580 * If bio is async or a write, always allow merge 580 * Disallow merge, if bio and rq aren't both sync or async
581 */ 581 */
582 if (!bio_sync(bio) || rw == WRITE) 582 if (!!bio_sync(bio) != !!rq_is_sync(rq))
583 return 1;
584
585 /*
586 * bio is sync. if request is not, disallow.
587 */
588 if (!rq_is_sync(rq))
589 return 0; 583 return 0;
590 584
591 /* 585 /*
592 * Ok, both bio and request are sync. Allow merge if they are 586 * Lookup the cfqq that this bio will be queued with. Allow
593 * from the same queue. 587 * merge only if rq is queued there.
594 */ 588 */
595 key = cfq_queue_pid(current, rw, 1); 589 key = cfq_queue_pid(current, rw, bio_sync(bio));
596 cfqq = cfq_find_cfq_hash(cfqd, key, current->ioprio); 590 cfqq = cfq_find_cfq_hash(cfqd, key, current->ioprio);
597 if (cfqq != RQ_CFQQ(rq)) 591
598 return 0; 592 if (cfqq == RQ_CFQQ(rq))
593 return 1;
599 594
600 return 1; 595 return 1;
601} 596}