]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
md/dm-raid: remove max_write_behind setting limit
authorYu Kuai <yukuai3@huawei.com>
Sat, 24 May 2025 06:13:11 +0000 (14:13 +0800)
committerYu Kuai <yukuai3@huawei.com>
Fri, 30 May 2025 07:47:23 +0000 (15:47 +0800)
The comments said 'vaule in kB', while the value actually means the
number of write_behind IOs. And since md-bitmap will automatically
adjust the value to max COUNTER_MAX / 2, there is no need to fail
early.

Also move some macros that is only used md-bitmap.c.

Link: https://lore.kernel.org/linux-raid/20250524061320.370630-15-yukuai1@huaweicloud.com
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Xiao Ni <xni@redhat.com>
drivers/md/dm-raid.c
drivers/md/md-bitmap.c
drivers/md/md-bitmap.h

index 127138c61be58ab12ba560bd7def1e56432f78d3..d296770478b299abb0e81372c27278a90d946bb4 100644 (file)
@@ -1356,11 +1356,7 @@ static int parse_raid_params(struct raid_set *rs, struct dm_arg_set *as,
                                return -EINVAL;
                        }
 
-                       /*
-                        * In device-mapper, we specify things in sectors, but
-                        * MD records this value in kB
-                        */
-                       if (value < 0 || value / 2 > COUNTER_MAX) {
+                       if (value < 0) {
                                rs->ti->error = "Max write-behind limit out of range";
                                return -EINVAL;
                        }
index 45dd3d9f01a8e188938e66e44d752da2c6efc692..931623b4d4a65fbd216c7f459922366fdf1278be 100644 (file)
  *
  */
 
+typedef __u16 bitmap_counter_t;
+
 #define PAGE_BITS (PAGE_SIZE << 3)
 #define PAGE_BIT_SHIFT (PAGE_SHIFT + 3)
 
+#define COUNTER_BITS 16
+#define COUNTER_BIT_SHIFT 4
+#define COUNTER_BYTE_SHIFT (COUNTER_BIT_SHIFT - 3)
+
+#define NEEDED_MASK ((bitmap_counter_t) (1 << (COUNTER_BITS - 1)))
+#define RESYNC_MASK ((bitmap_counter_t) (1 << (COUNTER_BITS - 2)))
+#define COUNTER_MAX ((bitmap_counter_t) RESYNC_MASK - 1)
+
 #define NEEDED(x) (((bitmap_counter_t) x) & NEEDED_MASK)
 #define RESYNC(x) (((bitmap_counter_t) x) & RESYNC_MASK)
 #define COUNTER(x) (((bitmap_counter_t) x) & COUNTER_MAX)
index 31c93019c76bf33e4e502e7d72455d7da996342b..08a9dfb696731f9f5035a6e56a22fa07c694cb2a 100644 (file)
@@ -9,15 +9,6 @@
 
 #define BITMAP_MAGIC 0x6d746962
 
-typedef __u16 bitmap_counter_t;
-#define COUNTER_BITS 16
-#define COUNTER_BIT_SHIFT 4
-#define COUNTER_BYTE_SHIFT (COUNTER_BIT_SHIFT - 3)
-
-#define NEEDED_MASK ((bitmap_counter_t) (1 << (COUNTER_BITS - 1)))
-#define RESYNC_MASK ((bitmap_counter_t) (1 << (COUNTER_BITS - 2)))
-#define COUNTER_MAX ((bitmap_counter_t) RESYNC_MASK - 1)
-
 /* use these for bitmap->flags and bitmap->sb->state bit-fields */
 enum bitmap_state {
        BITMAP_STALE       = 1,  /* the bitmap file is out of date or had -EIO */