Skip to content

Commit 1aecfe4

Browse files
ming1axboe
authored andcommitted
blk-mq: move blk_mq_get_ctx/blk_mq_put_ctx to mq private header
The blk-mq tag code need these helpers. Signed-off-by: Ming Lei <tom.leiming@gmail.com> Signed-off-by: Jens Axboe <axboe@fb.com>
1 parent 3de0ef8 commit 1aecfe4

2 files changed

Lines changed: 22 additions & 22 deletions

File tree

‎block/blk-mq.c‎

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -33,28 +33,6 @@ static LIST_HEAD(all_q_list);
3333

3434
static void __blk_mq_run_hw_queue(struct blk_mq_hw_ctx *hctx);
3535

36-
static struct blk_mq_ctx *__blk_mq_get_ctx(struct request_queue *q,
37-
unsigned int cpu)
38-
{
39-
return per_cpu_ptr(q->queue_ctx, cpu);
40-
}
41-
42-
/*
43-
* This assumes per-cpu software queueing queues. They could be per-node
44-
* as well, for instance. For now this is hardcoded as-is. Note that we don't
45-
* care about preemption, since we know the ctx's are persistent. This does
46-
* mean that we can't rely on ctx always matching the currently running CPU.
47-
*/
48-
static struct blk_mq_ctx *blk_mq_get_ctx(struct request_queue *q)
49-
{
50-
return __blk_mq_get_ctx(q, get_cpu());
51-
}
52-
53-
static void blk_mq_put_ctx(struct blk_mq_ctx *ctx)
54-
{
55-
put_cpu();
56-
}
57-
5836
/*
5937
* Check if any of the ctx's have pending work in this hardware queue
6038
*/

‎block/blk-mq.h‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,26 @@ struct blk_align_bitmap {
6969
unsigned long depth;
7070
} ____cacheline_aligned_in_smp;
7171

72+
static inline struct blk_mq_ctx *__blk_mq_get_ctx(struct request_queue *q,
73+
unsigned int cpu)
74+
{
75+
return per_cpu_ptr(q->queue_ctx, cpu);
76+
}
77+
78+
/*
79+
* This assumes per-cpu software queueing queues. They could be per-node
80+
* as well, for instance. For now this is hardcoded as-is. Note that we don't
81+
* care about preemption, since we know the ctx's are persistent. This does
82+
* mean that we can't rely on ctx always matching the currently running CPU.
83+
*/
84+
static inline struct blk_mq_ctx *blk_mq_get_ctx(struct request_queue *q)
85+
{
86+
return __blk_mq_get_ctx(q, get_cpu());
87+
}
88+
89+
static inline void blk_mq_put_ctx(struct blk_mq_ctx *ctx)
90+
{
91+
put_cpu();
92+
}
93+
7294
#endif

0 commit comments

Comments
 (0)