Skip to content

Commit

Permalink
blk-mq: Initialize .rq_flags in blk_mq_rq_ctx_init()
Browse files Browse the repository at this point in the history
Initialization of blk-mq requests is a bit weird: blk_mq_rq_ctx_init()
is called after a value has been assigned to .rq_flags and .rq_flags
is initialized in __blk_mq_finish_request(). Initialize .rq_flags in
blk_mq_rq_ctx_init() instead of relying on __blk_mq_finish_request().
Moving the initialization of .rq_flags is fine because all changes
and tests of .rq_flags occur between blk_get_request() and finishing
a request.

Signed-off-by: Bart Van Assche <[email protected]>
Cc: Christoph Hellwig <[email protected]>
Cc: Hannes Reinecke <[email protected]>
Cc: Omar Sandoval <[email protected]>
Cc: Ming Lei <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
Bart Van Assche authored and axboe committed Jun 21, 2017
1 parent c8d9cf2 commit c3a148d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion block/blk-mq.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@ static struct request *blk_mq_rq_ctx_init(struct blk_mq_alloc_data *data,
struct blk_mq_tags *tags = blk_mq_tags_from_data(data);
struct request *rq = tags->static_rqs[tag];

rq->rq_flags = 0;

if (data->flags & BLK_MQ_REQ_INTERNAL) {
rq->tag = -1;
rq->internal_tag = tag;
Expand Down Expand Up @@ -423,7 +425,6 @@ void blk_mq_free_request(struct request *rq)
atomic_dec(&hctx->nr_active);

wbt_done(q->rq_wb, &rq->issue_stat);
rq->rq_flags = 0;

clear_bit(REQ_ATOM_STARTED, &rq->atomic_flags);
clear_bit(REQ_ATOM_POLL_SLEPT, &rq->atomic_flags);
Expand Down

0 comments on commit c3a148d

Please sign in to comment.