diff options
author | Mike Snitzer <snitzer@redhat.com> | 2011-02-11 11:05:46 +0100 |
---|---|---|
committer | Jens Axboe <jaxboe@fusionio.com> | 2011-02-11 11:05:46 +0100 |
commit | 9d5a4e946ce5352f19400b6370f4cd8e72806278 (patch) | |
tree | ba62a2ab56da1f943b0dbcae527c70b817a104de /block | |
parent | ae1b1539622fb46e51b4d13b3f9e5f4c713f86ae (diff) | |
download | blackbird-op-linux-9d5a4e946ce5352f19400b6370f4cd8e72806278.tar.gz blackbird-op-linux-9d5a4e946ce5352f19400b6370f4cd8e72806278.zip |
block: skip elevator data initialization for flush requests
Skip elevator initialization for flush requests by passing priv=0 to
blk_alloc_request() in get_request(). As such elv_set_request() is
never called for flush requests.
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Diffstat (limited to 'block')
-rw-r--r-- | block/blk-core.c | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/block/blk-core.c b/block/blk-core.c index 05746093b45e..ab4a7696956d 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -738,6 +738,25 @@ static void freed_request(struct request_queue *q, int sync, int priv) } /* + * Determine if elevator data should be initialized when allocating the + * request associated with @bio. + */ +static bool blk_rq_should_init_elevator(struct bio *bio) +{ + if (!bio) + return true; + + /* + * Flush requests do not use the elevator so skip initialization. + * This allows a request to share the flush and elevator data. + */ + if (bio->bi_rw & (REQ_FLUSH | REQ_FUA)) + return false; + + return true; +} + +/* * Get a free request, queue_lock must be held. * Returns NULL on failure, with queue_lock held. * Returns !NULL on success, with queue_lock *not held*. @@ -749,7 +768,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) @@ -793,9 +812,11 @@ 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++; + if (blk_rq_should_init_elevator(bio)) { + priv = !test_bit(QUEUE_FLAG_ELVSWITCH, &q->queue_flags); + if (priv) + rl->elvpriv++; + } if (blk_queue_io_stat(q)) rw_flags |= REQ_IO_STAT; |