Skip to contentSkip to conversation

blk: elevator unplug thresh hanlding fix

PATCH In review Tejun Heo 2 participants 2 messages Jun 16, 2005 Block layer

lore
Share & tools
lore

Tejun Heo

author
#0 lore raw

PATCH 1/1 blk: elevator unplug thresh hanlding fix

Hello, Jens.
Hello, Andrew.

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.

drivers/block/elevator.c +1 -1
Index: blk-fixes/drivers/block/elevator.c
===================================================================
@@ -352,7 +352,7 @@ void __elv_add_request(request_queue_t *
 			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
#1 lore raw
Quoted 9 lines · Tejun Heo

Hello, Jens.
Hello, Andrew.

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.

Looks good, thanks!

Signature · 1 line
Jens Axboe