forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-11 297b60346df8beafee954a0fd7c2d64f33f3b9bc
kernel/drivers/md/bcache/writeback.h
....@@ -5,18 +5,42 @@
55 #define CUTOFF_WRITEBACK 40
66 #define CUTOFF_WRITEBACK_SYNC 70
77
8
+#define CUTOFF_WRITEBACK_MAX 70
9
+#define CUTOFF_WRITEBACK_SYNC_MAX 90
10
+
811 #define MAX_WRITEBACKS_IN_PASS 5
912 #define MAX_WRITESIZE_IN_PASS 5000 /* *512b */
1013
1114 #define WRITEBACK_RATE_UPDATE_SECS_MAX 60
1215 #define WRITEBACK_RATE_UPDATE_SECS_DEFAULT 5
1316
17
+#define BCH_AUTO_GC_DIRTY_THRESHOLD 50
18
+
19
+#define BCH_DIRTY_INIT_THRD_MAX 12
1420 /*
1521 * 14 (16384ths) is chosen here as something that each backing device
1622 * should be a reasonable fraction of the share, and not to blow up
1723 * until individual backing devices are a petabyte.
1824 */
1925 #define WRITEBACK_SHARE_SHIFT 14
26
+
27
+struct bch_dirty_init_state;
28
+struct dirty_init_thrd_info {
29
+ struct bch_dirty_init_state *state;
30
+ struct task_struct *thread;
31
+};
32
+
33
+struct bch_dirty_init_state {
34
+ struct cache_set *c;
35
+ struct bcache_device *d;
36
+ int total_threads;
37
+ int key_idx;
38
+ spinlock_t idx_lock;
39
+ atomic_t started;
40
+ atomic_t enough;
41
+ wait_queue_head_t wait;
42
+ struct dirty_init_thrd_info infos[BCH_DIRTY_INIT_THRD_MAX];
43
+};
2044
2145 static inline uint64_t bcache_dev_sectors_dirty(struct bcache_device *d)
2246 {
....@@ -68,6 +92,9 @@
6892 }
6993 }
7094
95
+extern unsigned int bch_cutoff_writeback;
96
+extern unsigned int bch_cutoff_writeback_sync;
97
+
7198 static inline bool should_writeback(struct cached_dev *dc, struct bio *bio,
7299 unsigned int cache_mode, bool would_skip)
73100 {
....@@ -75,7 +102,7 @@
75102
76103 if (cache_mode != CACHE_MODE_WRITEBACK ||
77104 test_bit(BCACHE_DEV_DETACHING, &dc->disk.flags) ||
78
- in_use > CUTOFF_WRITEBACK_SYNC)
105
+ in_use > bch_cutoff_writeback_sync)
79106 return false;
80107
81108 if (bio_op(bio) == REQ_OP_DISCARD)
....@@ -91,7 +118,7 @@
91118
92119 return (op_is_sync(bio->bi_opf) ||
93120 bio->bi_opf & (REQ_META|REQ_PRIO) ||
94
- in_use <= CUTOFF_WRITEBACK);
121
+ in_use <= bch_cutoff_writeback);
95122 }
96123
97124 static inline void bch_writeback_queue(struct cached_dev *dc)