From c374f127e4ff17a318b9ae95a5bf65f370c2d0b1 Mon Sep 17 00:00:00 2001 From: Tejun Heo Date: Thu, 16 Jun 2005 12:57:31 +0200 Subject: This patch fixes q->unplug_thresh condition check in __elv_add_request(). rq.count[READ] + rq.count[WRITE] can increase more than one if another thread has allocated a request after the current request is allocated or in_flight could have changed resulting in larger-than-one change of nrq, thus breaking the threshold mechanism. Signed-off-by: Jens Axboe Signed-off-by: Tejun Heo --- drivers/block/elevator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/block/elevator.c b/drivers/block/elevator.c index 98fcabbafe1e..89982925f9e2 100644 --- a/drivers/block/elevator.c +++ b/drivers/block/elevator.c @@ -317,7 +317,7 @@ void __elv_add_request(request_queue_t *q, struct request *rq, int where, int nrq = q->rq.count[READ] + q->rq.count[WRITE] - q->in_flight; - if (nrq == q->unplug_thresh) + if (nrq >= q->unplug_thresh) __generic_unplug_device(q); } } else -- cgit v1.2.1