On Thu, Feb 03 2011 at 8:24am -0500, Jens Axboe <jaxboe@xxxxxxxxxxxx> wrote: > On 2011-02-02 23:55, Mike Snitzer wrote: > > Set REQ_SORTED, in the @rw_flags passed to the request allocator, for > > any request that may be put on IO scheduler. Skip elevator data > > initialization during request allocation if REQ_SORTED is not set. > > > > REQ_SORTED is not set for flush requests because they are never put on > > the IO scheduler. > > That looks very wrong. REQ_SORTED gets set _when_ the request is sorted > into the IO scheduler. Yes, considerable oversight on my part. > This is gross misuse, a bad hack. As my recently posted v4 stated, even without the bug it is still a hack. My initial version didn't get so cute with overloading flags, etc, e.g: diff --git a/block/blk-core.c b/block/blk-core.c index 72dd23b..e098598 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -764,7 +764,7 @@ static struct request *get_request(struct request_queue *q, int rw_flags, struct request_list *rl = &q->rq; struct io_context *ioc = NULL; const bool is_sync = rw_is_sync(rw_flags) != 0; - int may_queue, priv; + int may_queue, priv = 0; may_queue = elv_may_queue(q, rw_flags); if (may_queue == ELV_MQUEUE_NO) @@ -808,9 +808,14 @@ static struct request *get_request(struct request_queue *q, int rw_flags, rl->count[is_sync]++; rl->starved[is_sync] = 0; - priv = !test_bit(QUEUE_FLAG_ELVSWITCH, &q->queue_flags); - if (priv) - rl->elvpriv++; + /* + * Skip elevator data initialization for flush requests. + */ + if (!(bio && (bio->bi_rw & (REQ_FLUSH | REQ_FUA)))) { + priv = !test_bit(QUEUE_FLAG_ELVSWITCH, &q->queue_flags); + if (priv) + rl->elvpriv++; + } if (blk_queue_io_stat(q)) rw_flags |= REQ_IO_STAT; I ran with Tejun's suggestion of overloading @rw_flags when it became clear he wasn't happy with the above (because it spread FLUSH/FUA special casing too thin). Regardless, other ideas for how to convey this info to get_request() would be appreciated. Mike -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html