Skip to contentSkip to conversation

noop insert

DISCUSSION Shailabh Nagar 2 participants 2 messages Dec 23, 2004 – Dec 24, 2004 Block layer

lore
Share & tools
lore
#0 lore raw

In noop-iosched.c (2.6.10-rc2),

void elevator_noop_add_request(request_queue_t *q, struct request *rq,
int where)

{
	struct list_head *insert = q->queue_head.prev;

	if (where == ELEVATOR_INSERT_FRONT)
		insert = &q->queue_head;

	list_add_tail(&rq->queuelist, &q->queue_head);

<snip>

shouldn't the insertion happen at insert instead of q->queue_head ?

-- Shailabh

#1 lore raw
Quoted 11 lines · Shailabh Nagar

In noop-iosched.c (2.6.10-rc2),

void elevator_noop_add_request(request_queue_t *q, struct request *rq,
int where)

{
	struct list_head *insert = q->queue_head.prev;

	if (where == ELEVATOR_INSERT_FRONT)
		insert = &q->queue_head;

	list_add_tail(&rq->queuelist, &q->queue_head);
Quoted 3 lines

<snip>

shouldn't the insertion happen at insert instead of q->queue_head ?

Yeah, it looks broken. This is easier to read and correct :-)

===== drivers/block/noop-iosched.c 1.4 vs edited =====

drivers/block/noop-iosched.c +3 -5
@@ -59,12 +59,10 @@
 void elevator_noop_add_request(request_queue_t *q, struct request *rq,
 			       int where)
 {
-	struct list_head *insert = q->queue_head.prev;
-
 	if (where == ELEVATOR_INSERT_FRONT)
-		insert = &q->queue_head;
-
-	list_add_tail(&rq->queuelist, &q->queue_head);
+		list_add(&rq->queuelist, &q->queue_head);
+	else
+		list_add_tail(&rq->queuelist, &q->queue_head);
 
 	/*
 	 * new merges must not precede this barrier
Signature · 1 line
Jens Axboe