bcache: make cutoff_writeback and cutoff_writeback_sync tunable
[platform/kernel/linux-starfive.git] / drivers / md / bcache / writeback.h
index ce63be9..6a743d3 100644 (file)
@@ -5,6 +5,9 @@
 #define CUTOFF_WRITEBACK       40
 #define CUTOFF_WRITEBACK_SYNC  70
 
+#define CUTOFF_WRITEBACK_MAX           70
+#define CUTOFF_WRITEBACK_SYNC_MAX      90
+
 #define MAX_WRITEBACKS_IN_PASS  5
 #define MAX_WRITESIZE_IN_PASS   5000   /* *512b */
 
@@ -55,6 +58,9 @@ static inline bool bcache_dev_stripe_dirty(struct cached_dev *dc,
        }
 }
 
+extern unsigned int bch_cutoff_writeback;
+extern unsigned int bch_cutoff_writeback_sync;
+
 static inline bool should_writeback(struct cached_dev *dc, struct bio *bio,
                                    unsigned int cache_mode, bool would_skip)
 {
@@ -62,7 +68,7 @@ static inline bool should_writeback(struct cached_dev *dc, struct bio *bio,
 
        if (cache_mode != CACHE_MODE_WRITEBACK ||
            test_bit(BCACHE_DEV_DETACHING, &dc->disk.flags) ||
-           in_use > CUTOFF_WRITEBACK_SYNC)
+           in_use > bch_cutoff_writeback_sync)
                return false;
 
        if (dc->partial_stripes_expensive &&
@@ -75,7 +81,7 @@ static inline bool should_writeback(struct cached_dev *dc, struct bio *bio,
 
        return (op_is_sync(bio->bi_opf) ||
                bio->bi_opf & (REQ_META|REQ_PRIO) ||
-               in_use <= CUTOFF_WRITEBACK);
+               in_use <= bch_cutoff_writeback);
 }
 
 static inline void bch_writeback_queue(struct cached_dev *dc)