Skip to content

Commit

Permalink
This patch fixes q->unplug_thresh condition check in
Browse files Browse the repository at this point in the history
__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>
  • Loading branch information
Tejun Heo authored and Jens Axboe committed Jun 16, 2005
1 parent 9c56187 commit c374f12
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/block/elevator.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c374f12

Please sign in to comment.