Skip to content

Commit b886475

Browse files
committed
md/dm-raid: remove max_write_behind setting limit
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/[email protected] Signed-off-by: Yu Kuai <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Reviewed-by: Hannes Reinecke <[email protected]> Reviewed-by: Xiao Ni <[email protected]>
1 parent 2afe177 commit b886475

File tree

3 files changed

+11
-14
lines changed

3 files changed

+11
-14
lines changed

drivers/md/dm-raid.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1356,11 +1356,7 @@ static int parse_raid_params(struct raid_set *rs, struct dm_arg_set *as,
13561356
return -EINVAL;
13571357
}
13581358

1359-
/*
1360-
* In device-mapper, we specify things in sectors, but
1361-
* MD records this value in kB
1362-
*/
1363-
if (value < 0 || value / 2 > COUNTER_MAX) {
1359+
if (value < 0) {
13641360
rs->ti->error = "Max write-behind limit out of range";
13651361
return -EINVAL;
13661362
}

drivers/md/md-bitmap.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,19 @@
105105
*
106106
*/
107107

108+
typedef __u16 bitmap_counter_t;
109+
108110
#define PAGE_BITS (PAGE_SIZE << 3)
109111
#define PAGE_BIT_SHIFT (PAGE_SHIFT + 3)
110112

113+
#define COUNTER_BITS 16
114+
#define COUNTER_BIT_SHIFT 4
115+
#define COUNTER_BYTE_SHIFT (COUNTER_BIT_SHIFT - 3)
116+
117+
#define NEEDED_MASK ((bitmap_counter_t) (1 << (COUNTER_BITS - 1)))
118+
#define RESYNC_MASK ((bitmap_counter_t) (1 << (COUNTER_BITS - 2)))
119+
#define COUNTER_MAX ((bitmap_counter_t) RESYNC_MASK - 1)
120+
111121
#define NEEDED(x) (((bitmap_counter_t) x) & NEEDED_MASK)
112122
#define RESYNC(x) (((bitmap_counter_t) x) & RESYNC_MASK)
113123
#define COUNTER(x) (((bitmap_counter_t) x) & COUNTER_MAX)

drivers/md/md-bitmap.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,6 @@
99

1010
#define BITMAP_MAGIC 0x6d746962
1111

12-
typedef __u16 bitmap_counter_t;
13-
#define COUNTER_BITS 16
14-
#define COUNTER_BIT_SHIFT 4
15-
#define COUNTER_BYTE_SHIFT (COUNTER_BIT_SHIFT - 3)
16-
17-
#define NEEDED_MASK ((bitmap_counter_t) (1 << (COUNTER_BITS - 1)))
18-
#define RESYNC_MASK ((bitmap_counter_t) (1 << (COUNTER_BITS - 2)))
19-
#define COUNTER_MAX ((bitmap_counter_t) RESYNC_MASK - 1)
20-
2112
/* use these for bitmap->flags and bitmap->sb->state bit-fields */
2213
enum bitmap_state {
2314
BITMAP_STALE = 1, /* the bitmap file is out of date or had -EIO */

0 commit comments

Comments
 (0)