From 7ae801cc6ae603bfd84be2a49d7d2286c3204887 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Fri, 22 Dec 2006 14:14:17 -0800 Subject: [PATCH] --- yaml --- r: 44930 b: refs/heads/master c: f2a67a576959025549a3b6a884bdd21f4dc107da h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/block/cfq-iosched.c | 21 ++++++++------------- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/[refs] b/[refs] index fd831ada6a88..feb5fd5cb331 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 5c668704b7fa5a4ebf21a490ddfbd6dc2e01fc97 +refs/heads/master: f2a67a576959025549a3b6a884bdd21f4dc107da diff --git a/trunk/block/cfq-iosched.c b/trunk/block/cfq-iosched.c index 9fc5eafa6c0e..4b4217d9be78 100644 --- a/trunk/block/cfq-iosched.c +++ b/trunk/block/cfq-iosched.c @@ -577,25 +577,20 @@ static int cfq_allow_merge(request_queue_t *q, struct request *rq, 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) - return 1; - - /* - * bio is sync. if request is not, disallow. - */ - if (!rq_is_sync(rq)) + if (!!bio_sync(bio) != !!rq_is_sync(rq)) return 0; /* - * Ok, both bio and request are sync. Allow merge if they are - * from the same queue. + * Lookup the cfqq that this bio will be queued with. Allow + * 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); - if (cfqq != RQ_CFQQ(rq)) - return 0; + + if (cfqq == RQ_CFQQ(rq)) + return 1; return 1; }