hc
2023-12-09 958e46acc8e900e8569dd467c1af9b8d2d019394
kernel/block/blk-mq-tag.h
....@@ -2,8 +2,6 @@
22 #ifndef INT_BLK_MQ_TAG_H
33 #define INT_BLK_MQ_TAG_H
44
5
-#include "blk-mq.h"
6
-
75 /*
86 * Tag address space map.
97 */
....@@ -13,27 +11,47 @@
1311
1412 atomic_t active_queues;
1513
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;
1819
1920 struct request **rqs;
2021 struct request **static_rqs;
2122 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);
2231 };
2332
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);
2437
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);
2741
2842 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);
3245 extern int blk_mq_tag_update_depth(struct blk_mq_hw_ctx *hctx,
3346 struct blk_mq_tags **tags,
3447 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
+
3551 extern void blk_mq_tag_wakeup_all(struct blk_mq_tags *tags, bool);
3652 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,
3755 void *priv);
3856
3957 static inline struct sbq_wait_state *bt_wait_ptr(struct sbitmap_queue *bt,
....@@ -45,9 +63,9 @@
4563 }
4664
4765 enum {
48
- BLK_MQ_TAG_FAIL = -1U,
66
+ BLK_MQ_NO_TAG = -1U,
4967 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,
5169 };
5270
5371 extern bool __blk_mq_tag_busy(struct blk_mq_hw_ctx *);
....@@ -55,7 +73,7 @@
5573
5674 static inline bool blk_mq_tag_busy(struct blk_mq_hw_ctx *hctx)
5775 {
58
- if (!(hctx->flags & BLK_MQ_F_TAG_SHARED))
76
+ if (!(hctx->flags & BLK_MQ_F_TAG_QUEUE_SHARED))
5977 return false;
6078
6179 return __blk_mq_tag_busy(hctx);
....@@ -63,22 +81,10 @@
6381
6482 static inline void blk_mq_tag_idle(struct blk_mq_hw_ctx *hctx)
6583 {
66
- if (!(hctx->flags & BLK_MQ_F_TAG_SHARED))
84
+ if (!(hctx->flags & BLK_MQ_F_TAG_QUEUE_SHARED))
6785 return;
6886
6987 __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;
8288 }
8389
8490 static inline bool blk_mq_tag_is_reserved(struct blk_mq_tags *tags,