From c23d226056652fa34b178ab3f0b071b05065c8b6 Mon Sep 17 00:00:00 2001 From: Tejun Heo Date: Thu, 19 Apr 2012 16:29:21 -0700 Subject: [PATCH] --- yaml --- r: 309277 b: refs/heads/master c: 29e2b09ab5fa790514d47838f3c05497130908b3 h: refs/heads/master i: 309275: 31232cd24d6ae69d73b69573f79d7ed2d8693314 v: v3 --- [refs] | 2 +- trunk/block/blk-core.c | 46 ++++++++++++++++-------------------------- 2 files changed, 18 insertions(+), 30 deletions(-) diff --git a/[refs] b/[refs] index cc6f0d0f538b..4cfe9312dd14 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: f9fcc2d3919b8eb575b3cee9274feefafb641bca +refs/heads/master: 29e2b09ab5fa790514d47838f3c05497130908b3 diff --git a/trunk/block/blk-core.c b/trunk/block/blk-core.c index 3b02ba351f8c..f6f68b0c8302 100644 --- a/trunk/block/blk-core.c +++ b/trunk/block/blk-core.c @@ -719,33 +719,6 @@ static inline void blk_free_request(struct request_queue *q, struct request *rq) mempool_free(rq, q->rq.rq_pool); } -static struct request * -blk_alloc_request(struct request_queue *q, struct bio *bio, struct io_cq *icq, - unsigned int flags, gfp_t gfp_mask) -{ - struct request *rq = mempool_alloc(q->rq.rq_pool, gfp_mask); - - if (!rq) - return NULL; - - blk_rq_init(q, rq); - - rq->cmd_flags = flags | REQ_ALLOCED; - - if (flags & REQ_ELVPRIV) { - rq->elv.icq = icq; - if (unlikely(elv_set_request(q, rq, bio, gfp_mask))) { - mempool_free(rq, q->rq.rq_pool); - return NULL; - } - /* @rq->elv.icq holds on to io_context until @rq is freed */ - if (icq) - get_io_context(icq->ioc); - } - - return rq; -} - /* * ioc_batching returns true if the ioc is a valid batching request and * should be given priority access to a request. @@ -968,10 +941,25 @@ static struct request *get_request(struct request_queue *q, int rw_flags, goto fail_alloc; } - rq = blk_alloc_request(q, bio, icq, rw_flags, gfp_mask); - if (unlikely(!rq)) + /* allocate and init request */ + rq = mempool_alloc(q->rq.rq_pool, gfp_mask); + if (!rq) goto fail_alloc; + blk_rq_init(q, rq); + rq->cmd_flags = rw_flags | REQ_ALLOCED; + + if (rw_flags & REQ_ELVPRIV) { + rq->elv.icq = icq; + if (unlikely(elv_set_request(q, rq, bio, gfp_mask))) { + mempool_free(rq, q->rq.rq_pool); + goto fail_alloc; + } + /* @rq->elv.icq holds on to io_context until @rq is freed */ + if (icq) + get_io_context(icq->ioc); + } + /* * ioc may be NULL here, and ioc_batching will be false. That's * OK, if the queue is under the request limit then requests need