Skip to content

Commit 9c2c38a

Browse files
Jens AxboeLinus Torvalds
authored andcommitted
[PATCH] cfq-iosched.c: minor fixes
One critical fix and two minor fixes for 2.6.13-rc7: - Max depth must currently be 2 to allow barriers to function on SCSI - Prefer sync request over async in choosing the next request - Never allow async request to preempt or disturb the "anticipation" for a single cfq process context. This is as-designed, the code right now is buggy in that area. Signed-off-by: Jens Axboe <axboe@suse.de> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
1 parent 41290c1 commit 9c2c38a

File tree

1 file changed

+21
-10
lines changed

1 file changed

+21
-10
lines changed

drivers/block/cfq-iosched.c

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ static int cfq_slice_idle = HZ / 100;
4747
/*
4848
* disable queueing at the driver/hardware level
4949
*/
50-
static int cfq_max_depth = 1;
50+
static int cfq_max_depth = 2;
5151

5252
/*
5353
* for the hash of cfqq inside the cfqd
@@ -385,9 +385,15 @@ cfq_choose_req(struct cfq_data *cfqd, struct cfq_rq *crq1, struct cfq_rq *crq2)
385385
return crq2;
386386
if (crq2 == NULL)
387387
return crq1;
388-
if (cfq_crq_requeued(crq1))
388+
389+
if (cfq_crq_requeued(crq1) && !cfq_crq_requeued(crq2))
389390
return crq1;
390-
if (cfq_crq_requeued(crq2))
391+
else if (cfq_crq_requeued(crq2) && !cfq_crq_requeued(crq1))
392+
return crq2;
393+
394+
if (cfq_crq_is_sync(crq1) && !cfq_crq_is_sync(crq2))
395+
return crq1;
396+
else if (cfq_crq_is_sync(crq2) && !cfq_crq_is_sync(crq1))
391397
return crq2;
392398

393399
s1 = crq1->request->sector;
@@ -1769,18 +1775,23 @@ static void
17691775
cfq_crq_enqueued(struct cfq_data *cfqd, struct cfq_queue *cfqq,
17701776
struct cfq_rq *crq)
17711777
{
1772-
const int sync = cfq_crq_is_sync(crq);
1778+
struct cfq_io_context *cic;
17731779

17741780
cfqq->next_crq = cfq_choose_req(cfqd, cfqq->next_crq, crq);
17751781

1776-
if (sync) {
1777-
struct cfq_io_context *cic = crq->io_context;
1782+
/*
1783+
* we never wait for an async request and we don't allow preemption
1784+
* of an async request. so just return early
1785+
*/
1786+
if (!cfq_crq_is_sync(crq))
1787+
return;
17781788

1779-
cfq_update_io_thinktime(cfqd, cic);
1780-
cfq_update_idle_window(cfqd, cfqq, cic);
1789+
cic = crq->io_context;
17811790

1782-
cic->last_queue = jiffies;
1783-
}
1791+
cfq_update_io_thinktime(cfqd, cic);
1792+
cfq_update_idle_window(cfqd, cfqq, cic);
1793+
1794+
cic->last_queue = jiffies;
17841795

17851796
if (cfqq == cfqd->active_queue) {
17861797
/*

0 commit comments

Comments
 (0)