All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Snitzer <snitzer@redhat.com>
To: Tejun Heo <tj@kernel.org>, Jens Axboe <axboe@kernel.dk>
Cc: Markus Trippelsdorf <markus@trippelsdorf.de>,
	Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
	linux-kernel@vger.kernel.org,
	Chris Mason <chris.mason@oracle.com>,
	Vivek Goyal <vgoyal@redhat.com>, Jeff Moyer <jmoyer@redhat.com>
Subject: [PATCH] block: eliminate ELEVATOR_INSERT_REQUEUE (was: Re: elevator private data for REQ_FLUSH)
Date: Mon, 28 Mar 2011 18:15:47 -0400	[thread overview]
Message-ID: <20110328221547.GA1118@redhat.com> (raw)
In-Reply-To: <20110328082321.GC16530@htj.dyndns.org>

On Mon, Mar 28 2011 at  4:23am -0400,
Tejun Heo <tj@kernel.org> wrote:

> On Sat, Mar 26, 2011 at 12:21:56AM -0400, Mike Snitzer wrote:
> > Should blk_kick_flush() process the flush request without calling
> > elv_insert() -- like is done with open coded list_add() in
> > blk_insert_flush()?
> > 
> > Or should blk_insert_flush() use elv_insert() with
> > ELEVATOR_INSERT_REQUEUE too? 
> 
> Hmmm... I would prefer the latter.  Given that INSERT_REQUEUE and
> FRONT are no longer different, it would probably be better to use
> FRONT tho.  The only reason REQUEUE is used there is to avoid kicking
> the queue from elv_insert(), which is gone now.

OK, I came up with the following patch.

Jens, this is just a natural cleanup given the code that resulted from
the flush-merge and onstack plugging changes coming together.


From: Mike Snitzer <snitzer@redhat.com>
Subject: block: eliminate ELEVATOR_INSERT_REQUEUE

elv_insert() no longer has a need to differentiate between
ELEVATOR_INSERT_REQUEUE and ELEVATOR_INSERT_FRONT.  The onstack plugging
changes eliminated the need to avoid unplugging the queue (via
ELEVATOR_INSERT_REQUEUE).

Also, in blk_insert_flush(), use elv_insert() with ELEVATOR_INSERT_FRONT
rather than open-coding the equivalent.

Signed-off-by: Mike Snitzer <snitzer@redhat.com>
---
 block/blk-flush.c        |    4 ++--
 block/elevator.c         |    3 +--
 include/linux/elevator.h |    5 ++---
 3 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/block/blk-flush.c b/block/blk-flush.c
index 93d5fd8..2c43044 100644
--- a/block/blk-flush.c
+++ b/block/blk-flush.c
@@ -261,7 +261,7 @@ static bool blk_kick_flush(struct request_queue *q)
 	q->flush_rq.end_io = flush_end_io;
 
 	q->flush_pending_idx ^= 1;
-	elv_insert(q, &q->flush_rq, ELEVATOR_INSERT_REQUEUE);
+	elv_insert(q, &q->flush_rq, ELEVATOR_INSERT_FRONT);
 	return true;
 }
 
@@ -312,7 +312,7 @@ void blk_insert_flush(struct request *rq)
 	 */
 	if ((policy & REQ_FSEQ_DATA) &&
 	    !(policy & (REQ_FSEQ_PREFLUSH | REQ_FSEQ_POSTFLUSH))) {
-		list_add(&rq->queuelist, &q->queue_head);
+		elv_insert(q, rq, ELEVATOR_INSERT_FRONT);
 		return;
 	}
 
diff --git a/block/elevator.c b/block/elevator.c
index c387d31..df7c4ba 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -610,7 +610,7 @@ void elv_requeue_request(struct request_queue *q, struct request *rq)
 
 	rq->cmd_flags &= ~REQ_STARTED;
 
-	elv_insert(q, rq, ELEVATOR_INSERT_REQUEUE);
+	elv_insert(q, rq, ELEVATOR_INSERT_FRONT);
 }
 
 void elv_drain_elevator(struct request_queue *q)
@@ -662,7 +662,6 @@ void elv_insert(struct request_queue *q, struct request *rq, int where)
 	rq->q = q;
 
 	switch (where) {
-	case ELEVATOR_INSERT_REQUEUE:
 	case ELEVATOR_INSERT_FRONT:
 		rq->cmd_flags |= REQ_SOFTBARRIER;
 		list_add(&rq->queuelist, &q->queue_head);
diff --git a/include/linux/elevator.h b/include/linux/elevator.h
index d93efcc445..0b4a354 100644
--- a/include/linux/elevator.h
+++ b/include/linux/elevator.h
@@ -164,9 +164,8 @@ extern struct request *elv_rb_find(struct rb_root *, sector_t);
 #define ELEVATOR_INSERT_FRONT	1
 #define ELEVATOR_INSERT_BACK	2
 #define ELEVATOR_INSERT_SORT	3
-#define ELEVATOR_INSERT_REQUEUE	4
-#define ELEVATOR_INSERT_FLUSH	5
-#define ELEVATOR_INSERT_SORT_MERGE	6
+#define ELEVATOR_INSERT_FLUSH	4
+#define ELEVATOR_INSERT_SORT_MERGE	5
 
 /*
  * return values from elevator_may_queue_fn


  reply	other threads:[~2011-03-28 22:16 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-25 15:15 [OOPS] elevator private data for REQ_FLUSH Sergey Senozhatsky
2011-03-25 15:22 ` Markus Trippelsdorf
2011-03-25 15:40   ` Mike Snitzer
2011-03-25 15:50     ` Jens Axboe
2011-03-25 18:54       ` Mike Snitzer
2011-03-25 19:50         ` Jens Axboe
2011-03-26  4:21           ` Mike Snitzer
2011-03-28  8:23             ` Tejun Heo
2011-03-28 22:15               ` Mike Snitzer [this message]
2011-03-29 11:56                 ` [PATCH] block: eliminate ELEVATOR_INSERT_REQUEUE Jens Axboe
2011-03-29 14:18                   ` Mike Snitzer
2011-03-29 18:25                   ` [PATCH] " Christoph Hellwig
2011-03-30  7:42                     ` Tejun Heo
2011-03-30  7:53                     ` Jens Axboe
2011-03-29 14:13                 ` [PATCH] block: eliminate ELEVATOR_INSERT_REQUEUE (was: Re: elevator private data for REQ_FLUSH) Jeff Moyer
2011-03-29 17:54                   ` Vivek Goyal
2011-03-30  7:41                     ` Tejun Heo
2011-03-30  7:57                       ` Tejun Heo
2011-03-30  7:59                         ` [PATCH] block: eliminate ELEVATOR_INSERT_REQUEUE Jens Axboe
2011-03-30  8:02                           ` Tejun Heo
2011-03-30 10:16                             ` Jens Axboe
2011-03-30 11:20                               ` Tejun Heo
2011-03-30 11:23                                 ` Jens Axboe
2011-03-30 11:21                               ` Sergey Senozhatsky
2011-03-30 11:22                                 ` Jens Axboe
2011-03-30 11:49                                   ` Sergey Senozhatsky
2011-03-30 13:46                             ` Vivek Goyal
2011-03-30 13:49                               ` Tejun Heo
2011-03-30 14:01                             ` Mike Snitzer
2011-03-30 14:27                               ` Tejun Heo
2011-03-30 15:22                                 ` Vivek Goyal
2011-03-30 15:30                                   ` Tejun Heo
2011-03-30 17:13                                     ` Jens Axboe
2011-03-30 17:32                                       ` Tejun Heo
2011-03-30 17:56                                       ` Jeff Moyer
2011-03-30 18:12                                         ` Jens Axboe
2011-03-25 15:57   ` [OOPS] elevator private data for REQ_FLUSH Jens Axboe
2011-03-25 16:03     ` Markus Trippelsdorf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110328221547.GA1118@redhat.com \
    --to=snitzer@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=chris.mason@oracle.com \
    --cc=jmoyer@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=markus@trippelsdorf.de \
    --cc=sergey.senozhatsky@gmail.com \
    --cc=tj@kernel.org \
    --cc=vgoyal@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.