Re: [PATCH 04/10] block: pass around REQ_* flags instead of brokendown booleans during request alloc/free

From: Vivek Goyal
Date: Wed Oct 19 2011 - 09:44:30 EST


On Tue, Oct 18, 2011 at 09:26:18PM -0700, Tejun Heo wrote:
> blk_alloc_request() and freed_request() take different combinations of
> REQ_* @flags, @priv and @is_sync when @flags is superset of the latter
> two. Make them take @flags only. This cleans up the code a bit and
> will ease updating allocation related REQ_* flags.
>
> This patch doesn't introduce any functional difference.
>
> Signed-off-by: Tejun Heo <tj@xxxxxxxxxx>
> Cc: Jens Axboe <axboe@xxxxxxxxx>
> ---
> block/blk-core.c | 36 +++++++++++++++++-------------------
> 1 files changed, 17 insertions(+), 19 deletions(-)
>
> diff --git a/block/blk-core.c b/block/blk-core.c
> index a995141..fafa669 100644
> --- a/block/blk-core.c
> +++ b/block/blk-core.c
> @@ -575,7 +575,7 @@ static inline void blk_free_request(struct request_queue *q, struct request *rq)
> }
>
> static struct request *
> -blk_alloc_request(struct request_queue *q, int flags, int priv, gfp_t gfp_mask)
> +blk_alloc_request(struct request_queue *q, unsigned int flags, gfp_t gfp_mask)
> {
> struct request *rq = mempool_alloc(q->rq.rq_pool, gfp_mask);
>
> @@ -586,12 +586,10 @@ blk_alloc_request(struct request_queue *q, int flags, int priv, gfp_t gfp_mask)
>
> rq->cmd_flags = flags | REQ_ALLOCED;
>
> - if (priv) {
> - if (unlikely(elv_set_request(q, rq, gfp_mask))) {
> - mempool_free(rq, q->rq.rq_pool);
> - return NULL;
> - }
> - rq->cmd_flags |= REQ_ELVPRIV;

Don't we need to set REQ_ELVPRIV in rq->cmd_flags in this new code?

> + if ((flags & REQ_ELVPRIV) &&
> + unlikely(elv_set_request(q, rq, gfp_mask))) {
> + mempool_free(rq, q->rq.rq_pool);
> + return NULL;
> }

Thanks
Vivek
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/