hc
2023-12-11 6778948f9de86c3cfaf36725a7c87dcff9ba247f
kernel/include/linux/backing-dev-defs.h
....@@ -13,6 +13,7 @@
1313 #include <linux/workqueue.h>
1414 #include <linux/kref.h>
1515 #include <linux/refcount.h>
16
+#include <linux/android_kabi.h>
1617
1718 struct page;
1819 struct device;
....@@ -33,8 +34,6 @@
3334 WB_sync_congested, /* The sync queue is getting full */
3435 };
3536
36
-typedef int (congested_fn)(void *, int);
37
-
3837 enum wb_stat_item {
3938 WB_RECLAIMABLE,
4039 WB_WRITEBACK,
....@@ -54,7 +53,6 @@
5453 WB_REASON_SYNC,
5554 WB_REASON_PERIODIC,
5655 WB_REASON_LAPTOP_TIMER,
57
- WB_REASON_FREE_MORE_MEM,
5856 WB_REASON_FS_FREE_SPACE,
5957 /*
6058 * There is no bdi forker thread any more and works are done
....@@ -63,29 +61,30 @@
6361 * so it has a mismatch name.
6462 */
6563 WB_REASON_FORKER_THREAD,
64
+ WB_REASON_FOREIGN_FLUSH,
6665
6766 WB_REASON_MAX,
6867 };
6968
70
-/*
71
- * For cgroup writeback, multiple wb's may map to the same blkcg. Those
72
- * wb's can operate mostly independently but should share the congested
73
- * state. To facilitate such sharing, the congested state is tracked using
74
- * the following struct which is created on demand, indexed by blkcg ID on
75
- * its bdi, and refcounted.
76
- */
77
-struct bdi_writeback_congested {
78
- unsigned long state; /* WB_[a]sync_congested flags */
79
- refcount_t refcnt; /* nr of attached wb's and blkg */
80
-
81
-#ifdef CONFIG_CGROUP_WRITEBACK
82
- struct backing_dev_info *__bdi; /* the associated bdi, set to NULL
83
- * on bdi unregistration. For memcg-wb
84
- * internal use only! */
85
- int blkcg_id; /* ID of the associated blkcg */
86
- struct rb_node rb_node; /* on bdi->cgwb_congestion_tree */
87
-#endif
69
+struct wb_completion {
70
+ atomic_t cnt;
71
+ wait_queue_head_t *waitq;
8872 };
73
+
74
+#define __WB_COMPLETION_INIT(_waitq) \
75
+ (struct wb_completion){ .cnt = ATOMIC_INIT(1), .waitq = (_waitq) }
76
+
77
+/*
78
+ * If one wants to wait for one or more wb_writeback_works, each work's
79
+ * ->done should be set to a wb_completion defined using the following
80
+ * macro. Once all work items are issued with wb_queue_work(), the caller
81
+ * can wait for the completion of all using wb_wait_for_completion(). Work
82
+ * items which are waited upon aren't freed automatically on completion.
83
+ */
84
+#define WB_COMPLETION_INIT(bdi) __WB_COMPLETION_INIT(&(bdi)->wb_waitq)
85
+
86
+#define DEFINE_WB_COMPLETION(cmpl, bdi) \
87
+ struct wb_completion cmpl = WB_COMPLETION_INIT(bdi)
8988
9089 /*
9190 * Each wb (bdi_writeback) can perform writeback operations, is measured
....@@ -120,7 +119,7 @@
120119
121120 struct percpu_counter stat[NR_WB_STAT_ITEMS];
122121
123
- struct bdi_writeback_congested *congested;
122
+ unsigned long congested; /* WB_[a]sync_congested flags */
124123
125124 unsigned long bw_time_stamp; /* last time write bw is updated */
126125 unsigned long dirtied_stamp;
....@@ -162,16 +161,17 @@
162161 struct rcu_head rcu;
163162 };
164163 #endif
164
+
165
+ ANDROID_KABI_RESERVE(1);
166
+ ANDROID_KABI_RESERVE(2);
165167 };
166168
167169 struct backing_dev_info {
170
+ u64 id;
171
+ struct rb_node rb_node; /* keyed by ->id */
168172 struct list_head bdi_list;
169173 unsigned long ra_pages; /* max readahead in PAGE_SIZE units */
170174 unsigned long io_pages; /* max allowed IO size */
171
- congested_fn *congested_fn; /* Function pointer if device is md/dm */
172
- void *congested_data; /* Pointer to aux data for congested func */
173
-
174
- const char *name;
175175
176176 struct kref refcnt; /* Reference counter for the structure */
177177 unsigned int capabilities; /* Device capabilities */
....@@ -188,23 +188,23 @@
188188 struct list_head wb_list; /* list of all wbs */
189189 #ifdef CONFIG_CGROUP_WRITEBACK
190190 struct radix_tree_root cgwb_tree; /* radix tree of active cgroup wbs */
191
- struct rb_root cgwb_congested_tree; /* their congested states */
192191 struct mutex cgwb_release_mutex; /* protect shutdown of wb structs */
193192 struct rw_semaphore wb_switch_rwsem; /* no cgwb switch while syncing */
194
-#else
195
- struct bdi_writeback_congested *wb_congested;
196193 #endif
197194 wait_queue_head_t wb_waitq;
198195
199196 struct device *dev;
197
+ char dev_name[64];
200198 struct device *owner;
201199
202200 struct timer_list laptop_mode_wb_timer;
203201
204202 #ifdef CONFIG_DEBUG_FS
205203 struct dentry *debug_dir;
206
- struct dentry *debug_stats;
207204 #endif
205
+
206
+ ANDROID_KABI_RESERVE(1);
207
+ ANDROID_KABI_RESERVE(2);
208208 };
209209
210210 enum {
....@@ -212,18 +212,8 @@
212212 BLK_RW_SYNC = 1,
213213 };
214214
215
-void clear_wb_congested(struct bdi_writeback_congested *congested, int sync);
216
-void set_wb_congested(struct bdi_writeback_congested *congested, int sync);
217
-
218
-static inline void clear_bdi_congested(struct backing_dev_info *bdi, int sync)
219
-{
220
- clear_wb_congested(bdi->wb.congested, sync);
221
-}
222
-
223
-static inline void set_bdi_congested(struct backing_dev_info *bdi, int sync)
224
-{
225
- set_wb_congested(bdi->wb.congested, sync);
226
-}
215
+void clear_bdi_congested(struct backing_dev_info *bdi, int sync);
216
+void set_bdi_congested(struct backing_dev_info *bdi, int sync);
227217
228218 struct wb_lock_cookie {
229219 bool locked;