diff options
author | Guoqing Jiang <gqjiang@suse.com> | 2017-10-30 10:09:51 +0100 |
---|---|---|
committer | Jes Sorensen <jsorensen@fb.com> | 2017-11-09 17:56:10 +0100 |
commit | 5339f99606f19ce1eeadebf3c0849933dc0c6fd5 (patch) | |
tree | 8290740d24d5b0f84ab72db9f972139147d9bdf0 | |
parent | imsm: fix reading scsi serial (diff) | |
download | mdadm-5339f99606f19ce1eeadebf3c0849933dc0c6fd5.tar.xz mdadm-5339f99606f19ce1eeadebf3c0849933dc0c6fd5.zip |
To support clustered raid10
We are now considering to extend clustered raid to
support raid10. But only near layout is supported,
so make the check when create the array or switch
the bitmap from internal to clustered.
Signed-off-by: Guoqing Jiang <gqjiang@suse.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
-rw-r--r-- | Grow.c | 6 | ||||
-rw-r--r-- | mdadm.c | 9 | ||||
-rw-r--r-- | mdadm.h | 1 | ||||
-rw-r--r-- | util.c | 11 |
4 files changed, 25 insertions, 2 deletions
@@ -359,6 +359,12 @@ int Grow_addbitmap(char *devname, int fd, struct context *c, struct shape *s) ncopies = (array.layout & 255) * ((array.layout >> 8) & 255); bitmapsize = bitmapsize * array.raid_disks / ncopies; + + if (strcmp(s->bitmap_file, "clustered") == 0 && + !is_near_layout_10(array.layout)) { + pr_err("only near layout is supported with clustered raid10\n"); + return 1; + } } st = super_by_fd(fd, &subarray); @@ -1542,8 +1542,13 @@ int main(int argc, char *argv[]) break; } - if (s.level != 1) { - pr_err("--bitmap=clustered is currently supported with RAID mirror only\n"); + if (s.level != 1 && s.level != 10) { + pr_err("--bitmap=clustered is currently supported with raid1/10 only\n"); + rv = 1; + break; + } + if (s.level == 10 && !is_near_layout_10(s.layout)) { + pr_err("only near layout is supported with clustered raid10\n"); rv = 1; break; } @@ -1434,6 +1434,7 @@ extern int get_linux_version(void); extern int mdadm_version(char *version); extern unsigned long long parse_size(char *size); extern int parse_uuid(char *str, int uuid[4]); +extern int is_near_layout_10(int layout); extern int parse_layout_10(char *layout); extern int parse_layout_faulty(char *layout); extern long parse_num(char *num); @@ -397,6 +397,17 @@ unsigned long long parse_size(char *size) return s; } +int is_near_layout_10(int layout) +{ + int fc, fo; + + fc = (layout >> 8) & 255; + fo = layout & (1 << 16); + if (fc > 1 || fo > 0) + return 0; + return 1; +} + int parse_layout_10(char *layout) { int copies, rv; |