From: Jens Axboe <axboe@kernel.dk>
To: Tejun Heo <tj@kernel.org>
Cc: Vivek Goyal <vgoyal@redhat.com>, Jeff Moyer <jmoyer@redhat.com>,
Mike Snitzer <snitzer@redhat.com>,
Markus Trippelsdorf <markus@trippelsdorf.de>,
Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
linux-kernel@vger.kernel.org,
Chris Mason <chris.mason@oracle.com>
Subject: Re: [PATCH] block: eliminate ELEVATOR_INSERT_REQUEUE
Date: Wed, 30 Mar 2011 12:16:13 +0200 [thread overview]
Message-ID: <4D9302ED.4030807@kernel.dk> (raw)
In-Reply-To: <20110330080203.GD17523@htj.dyndns.org>
On 2011-03-30 10:02, Tejun Heo wrote:
> Hello, Jens.
>
> On Wed, Mar 30, 2011 at 09:59:09AM +0200, Jens Axboe wrote:
>> Pure front insert should be used for requeue and internal commands (like
>> spin up this drive, or get error information). Flush should append to
>> the dispatch list.
>
> Yeah, right. The reason I used REQUEUE/FRONT was because BACK
> insertion involves draining the elevator and then appending the
> request at the end of the dispatch queue, which is unnecessary and
> inefficient. So, front insertion was a quick work around that. If
> we're removing elv_insert(), we can just append directly to the
> dispatch queue from flush code.
How does this look? It's really two patches, but rolled up into one for
easier posting here.
diff --git a/block/blk-flush.c b/block/blk-flush.c
index 93d5fd8..6a16fea 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_add_request(q, &q->flush_rq, ELEVATOR_INSERT_FLUSH);
return true;
}
@@ -281,7 +281,7 @@ static void flush_data_end_io(struct request *rq, int error)
* blk_insert_flush - insert a new FLUSH/FUA request
* @rq: request to insert
*
- * To be called from elv_insert() for %ELEVATOR_INSERT_FLUSH insertions.
+ * To be called from __elv_add_request() for %ELEVATOR_INSERT_FLUSH insertions.
* @rq is being submitted. Analyze what needs to be done and put it on the
* right queue.
*
@@ -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);
+ list_add_tail(&rq->queuelist, &q->queue_head);
return;
}
diff --git a/block/elevator.c b/block/elevator.c
index c387d31..0cdb4e7 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_add_request(q, rq, ELEVATOR_INSERT_REQUEUE);
}
void elv_drain_elevator(struct request_queue *q)
@@ -655,12 +655,25 @@ void elv_quiesce_end(struct request_queue *q)
queue_flag_clear(QUEUE_FLAG_ELVSWITCH, q);
}
-void elv_insert(struct request_queue *q, struct request *rq, int where)
+void __elv_add_request(struct request_queue *q, struct request *rq, int where)
{
trace_block_rq_insert(q, rq);
rq->q = q;
+ BUG_ON(rq->cmd_flags & REQ_ON_PLUG);
+
+ if (rq->cmd_flags & REQ_SOFTBARRIER) {
+ /* barriers are scheduling boundary, update end_sector */
+ if (rq->cmd_type == REQ_TYPE_FS ||
+ (rq->cmd_flags & REQ_DISCARD)) {
+ q->end_sector = rq_end_sector(rq);
+ q->boundary_rq = rq;
+ }
+ } else if (!(rq->cmd_flags & REQ_ELVPRIV) &&
+ where == ELEVATOR_INSERT_SORT)
+ where = ELEVATOR_INSERT_BACK;
+
switch (where) {
case ELEVATOR_INSERT_REQUEUE:
case ELEVATOR_INSERT_FRONT:
@@ -722,24 +735,6 @@ void elv_insert(struct request_queue *q, struct request *rq, int where)
BUG();
}
}
-
-void __elv_add_request(struct request_queue *q, struct request *rq, int where)
-{
- BUG_ON(rq->cmd_flags & REQ_ON_PLUG);
-
- if (rq->cmd_flags & REQ_SOFTBARRIER) {
- /* barriers are scheduling boundary, update end_sector */
- if (rq->cmd_type == REQ_TYPE_FS ||
- (rq->cmd_flags & REQ_DISCARD)) {
- q->end_sector = rq_end_sector(rq);
- q->boundary_rq = rq;
- }
- } else if (!(rq->cmd_flags & REQ_ELVPRIV) &&
- where == ELEVATOR_INSERT_SORT)
- where = ELEVATOR_INSERT_BACK;
-
- elv_insert(q, rq, where);
-}
EXPORT_SYMBOL(__elv_add_request);
void elv_add_request(struct request_queue *q, struct request *rq, int where)
diff --git a/include/linux/elevator.h b/include/linux/elevator.h
index d93efcc445..21a8ebf 100644
--- a/include/linux/elevator.h
+++ b/include/linux/elevator.h
@@ -101,7 +101,6 @@ extern void elv_dispatch_sort(struct request_queue *, struct request *);
extern void elv_dispatch_add_tail(struct request_queue *, struct request *);
extern void elv_add_request(struct request_queue *, struct request *, int);
extern void __elv_add_request(struct request_queue *, struct request *, int);
-extern void elv_insert(struct request_queue *, struct request *, int);
extern int elv_merge(struct request_queue *, struct request **, struct bio *);
extern int elv_try_merge(struct request *, struct bio *);
extern void elv_merge_requests(struct request_queue *, struct request *,
--
Jens Axboe
next prev parent reply other threads:[~2011-03-30 10: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 ` [PATCH] block: eliminate ELEVATOR_INSERT_REQUEUE (was: Re: elevator private data for REQ_FLUSH) Mike Snitzer
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 [this message]
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=4D9302ED.4030807@kernel.dk \
--to=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=snitzer@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox