blk-mq: get rid of confusing blk_map_ctx structure

We can just use struct blk_mq_alloc_data - it has a few more
members, but we allocate it further down the stack anyway. So
this cleans up the code, and reduces the stack overhead a bit.

Signed-off-by: Jens Axboe <axboe@fb.com>
This commit is contained in:
Jens Axboe 2016-10-27 19:03:55 -06:00
parent 7dd2fb6877
commit 2552e3f878
1 changed files with 5 additions and 13 deletions

View File

@ -1190,21 +1190,15 @@ insert_rq:
} }
} }
struct blk_map_ctx {
struct blk_mq_hw_ctx *hctx;
struct blk_mq_ctx *ctx;
};
static struct request *blk_mq_map_request(struct request_queue *q, static struct request *blk_mq_map_request(struct request_queue *q,
struct bio *bio, struct bio *bio,
struct blk_map_ctx *data) struct blk_mq_alloc_data *data)
{ {
struct blk_mq_hw_ctx *hctx; struct blk_mq_hw_ctx *hctx;
struct blk_mq_ctx *ctx; struct blk_mq_ctx *ctx;
struct request *rq; struct request *rq;
int op = bio_data_dir(bio); int op = bio_data_dir(bio);
int op_flags = 0; int op_flags = 0;
struct blk_mq_alloc_data alloc_data;
blk_queue_enter_live(q); blk_queue_enter_live(q);
ctx = blk_mq_get_ctx(q); ctx = blk_mq_get_ctx(q);
@ -1214,11 +1208,9 @@ static struct request *blk_mq_map_request(struct request_queue *q,
op_flags |= REQ_SYNC; op_flags |= REQ_SYNC;
trace_block_getrq(q, bio, op); trace_block_getrq(q, bio, op);
blk_mq_set_alloc_data(&alloc_data, q, 0, ctx, hctx); blk_mq_set_alloc_data(data, q, 0, ctx, hctx);
rq = __blk_mq_alloc_request(&alloc_data, op, op_flags); rq = __blk_mq_alloc_request(data, op, op_flags);
data->hctx = alloc_data.hctx;
data->ctx = alloc_data.ctx;
data->hctx->queued++; data->hctx->queued++;
return rq; return rq;
} }
@ -1267,7 +1259,7 @@ static blk_qc_t blk_mq_make_request(struct request_queue *q, struct bio *bio)
{ {
const int is_sync = rw_is_sync(bio_op(bio), bio->bi_opf); const int is_sync = rw_is_sync(bio_op(bio), bio->bi_opf);
const int is_flush_fua = bio->bi_opf & (REQ_PREFLUSH | REQ_FUA); const int is_flush_fua = bio->bi_opf & (REQ_PREFLUSH | REQ_FUA);
struct blk_map_ctx data; struct blk_mq_alloc_data data;
struct request *rq; struct request *rq;
unsigned int request_count = 0; unsigned int request_count = 0;
struct blk_plug *plug; struct blk_plug *plug;
@ -1363,7 +1355,7 @@ static blk_qc_t blk_sq_make_request(struct request_queue *q, struct bio *bio)
const int is_flush_fua = bio->bi_opf & (REQ_PREFLUSH | REQ_FUA); const int is_flush_fua = bio->bi_opf & (REQ_PREFLUSH | REQ_FUA);
struct blk_plug *plug; struct blk_plug *plug;
unsigned int request_count = 0; unsigned int request_count = 0;
struct blk_map_ctx data; struct blk_mq_alloc_data data;
struct request *rq; struct request *rq;
blk_qc_t cookie; blk_qc_t cookie;