This patch fixes q->unplug_thresh condition check in
authorTejun Heo <htejun@gmail.com>
Thu, 16 Jun 2005 10:57:31 +0000 (12:57 +0200)
committerJens Axboe <axboe@suse.de>
Thu, 16 Jun 2005 10:57:31 +0000 (12:57 +0200)
__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 <axboe@suse.de>
Signed-off-by: Tejun Heo <htejun@gmail.com>
drivers/block/elevator.c

index 98fcabbafe1ea03ebe1fd14e4772e62ea0b8abf3..89982925f9e2230d404c78349efe2b415133d5f7 100644 (file)
@@ -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