.. | .. |
---|
2 | 2 | #ifndef INT_BLK_MQ_TAG_H |
---|
3 | 3 | #define INT_BLK_MQ_TAG_H |
---|
4 | 4 | |
---|
5 | | -#include "blk-mq.h" |
---|
6 | | - |
---|
7 | 5 | /* |
---|
8 | 6 | * Tag address space map. |
---|
9 | 7 | */ |
---|
.. | .. |
---|
13 | 11 | |
---|
14 | 12 | atomic_t active_queues; |
---|
15 | 13 | |
---|
16 | | - struct sbitmap_queue bitmap_tags; |
---|
17 | | - struct sbitmap_queue breserved_tags; |
---|
| 14 | + struct sbitmap_queue *bitmap_tags; |
---|
| 15 | + struct sbitmap_queue *breserved_tags; |
---|
| 16 | + |
---|
| 17 | + struct sbitmap_queue __bitmap_tags; |
---|
| 18 | + struct sbitmap_queue __breserved_tags; |
---|
18 | 19 | |
---|
19 | 20 | struct request **rqs; |
---|
20 | 21 | struct request **static_rqs; |
---|
21 | 22 | struct list_head page_list; |
---|
| 23 | + |
---|
| 24 | + /* |
---|
| 25 | + * used to clear request reference in rqs[] before freeing one |
---|
| 26 | + * request pool |
---|
| 27 | + */ |
---|
| 28 | + spinlock_t lock; |
---|
| 29 | + |
---|
| 30 | + ANDROID_OEM_DATA(1); |
---|
22 | 31 | }; |
---|
23 | 32 | |
---|
| 33 | +extern struct blk_mq_tags *blk_mq_init_tags(unsigned int nr_tags, |
---|
| 34 | + unsigned int reserved_tags, |
---|
| 35 | + int node, unsigned int flags); |
---|
| 36 | +extern void blk_mq_free_tags(struct blk_mq_tags *tags, unsigned int flags); |
---|
24 | 37 | |
---|
25 | | -extern struct blk_mq_tags *blk_mq_init_tags(unsigned int nr_tags, unsigned int reserved_tags, int node, int alloc_policy); |
---|
26 | | -extern void blk_mq_free_tags(struct blk_mq_tags *tags); |
---|
| 38 | +extern int blk_mq_init_shared_sbitmap(struct blk_mq_tag_set *set, |
---|
| 39 | + unsigned int flags); |
---|
| 40 | +extern void blk_mq_exit_shared_sbitmap(struct blk_mq_tag_set *set); |
---|
27 | 41 | |
---|
28 | 42 | extern unsigned int blk_mq_get_tag(struct blk_mq_alloc_data *data); |
---|
29 | | -extern void blk_mq_put_tag(struct blk_mq_hw_ctx *hctx, struct blk_mq_tags *tags, |
---|
30 | | - struct blk_mq_ctx *ctx, unsigned int tag); |
---|
31 | | -extern bool blk_mq_has_free_tags(struct blk_mq_tags *tags); |
---|
| 43 | +extern void blk_mq_put_tag(struct blk_mq_tags *tags, struct blk_mq_ctx *ctx, |
---|
| 44 | + unsigned int tag); |
---|
32 | 45 | extern int blk_mq_tag_update_depth(struct blk_mq_hw_ctx *hctx, |
---|
33 | 46 | struct blk_mq_tags **tags, |
---|
34 | 47 | unsigned int depth, bool can_grow); |
---|
| 48 | +extern void blk_mq_tag_resize_shared_sbitmap(struct blk_mq_tag_set *set, |
---|
| 49 | + unsigned int size); |
---|
| 50 | + |
---|
35 | 51 | extern void blk_mq_tag_wakeup_all(struct blk_mq_tags *tags, bool); |
---|
36 | 52 | void blk_mq_queue_tag_busy_iter(struct request_queue *q, busy_iter_fn *fn, |
---|
| 53 | + void *priv); |
---|
| 54 | +void blk_mq_all_tag_iter(struct blk_mq_tags *tags, busy_tag_iter_fn *fn, |
---|
37 | 55 | void *priv); |
---|
38 | 56 | |
---|
39 | 57 | static inline struct sbq_wait_state *bt_wait_ptr(struct sbitmap_queue *bt, |
---|
.. | .. |
---|
45 | 63 | } |
---|
46 | 64 | |
---|
47 | 65 | enum { |
---|
48 | | - BLK_MQ_TAG_FAIL = -1U, |
---|
| 66 | + BLK_MQ_NO_TAG = -1U, |
---|
49 | 67 | BLK_MQ_TAG_MIN = 1, |
---|
50 | | - BLK_MQ_TAG_MAX = BLK_MQ_TAG_FAIL - 1, |
---|
| 68 | + BLK_MQ_TAG_MAX = BLK_MQ_NO_TAG - 1, |
---|
51 | 69 | }; |
---|
52 | 70 | |
---|
53 | 71 | extern bool __blk_mq_tag_busy(struct blk_mq_hw_ctx *); |
---|
.. | .. |
---|
55 | 73 | |
---|
56 | 74 | static inline bool blk_mq_tag_busy(struct blk_mq_hw_ctx *hctx) |
---|
57 | 75 | { |
---|
58 | | - if (!(hctx->flags & BLK_MQ_F_TAG_SHARED)) |
---|
| 76 | + if (!(hctx->flags & BLK_MQ_F_TAG_QUEUE_SHARED)) |
---|
59 | 77 | return false; |
---|
60 | 78 | |
---|
61 | 79 | return __blk_mq_tag_busy(hctx); |
---|
.. | .. |
---|
63 | 81 | |
---|
64 | 82 | static inline void blk_mq_tag_idle(struct blk_mq_hw_ctx *hctx) |
---|
65 | 83 | { |
---|
66 | | - if (!(hctx->flags & BLK_MQ_F_TAG_SHARED)) |
---|
| 84 | + if (!(hctx->flags & BLK_MQ_F_TAG_QUEUE_SHARED)) |
---|
67 | 85 | return; |
---|
68 | 86 | |
---|
69 | 87 | __blk_mq_tag_idle(hctx); |
---|
70 | | -} |
---|
71 | | - |
---|
72 | | -/* |
---|
73 | | - * This helper should only be used for flush request to share tag |
---|
74 | | - * with the request cloned from, and both the two requests can't be |
---|
75 | | - * in flight at the same time. The caller has to make sure the tag |
---|
76 | | - * can't be freed. |
---|
77 | | - */ |
---|
78 | | -static inline void blk_mq_tag_set_rq(struct blk_mq_hw_ctx *hctx, |
---|
79 | | - unsigned int tag, struct request *rq) |
---|
80 | | -{ |
---|
81 | | - hctx->tags->rqs[tag] = rq; |
---|
82 | 88 | } |
---|
83 | 89 | |
---|
84 | 90 | static inline bool blk_mq_tag_is_reserved(struct blk_mq_tags *tags, |
---|