From 108637af2da34d74fd6035fa2e44be88fc7d00f5ef58bb888dde1eb7b8f19283 Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Tue, 21 Nov 2017 22:02:35 +0000 Subject: [PATCH] Accepting request 542977 from home:gqjiang:branches:Base:System For fate 323171: To support clustered raid10 OBS-URL: https://build.opensuse.org/request/show/542977 OBS-URL: https://build.opensuse.org/package/show/Base:System/mdadm?expand=0&rev=152 --- 0059-To-support-clustered-raid10.patch | 93 ++++++++++++++++++++++++++ mdadm.changes | 6 ++ mdadm.spec | 4 +- 3 files changed, 102 insertions(+), 1 deletion(-) create mode 100644 0059-To-support-clustered-raid10.patch diff --git a/0059-To-support-clustered-raid10.patch b/0059-To-support-clustered-raid10.patch new file mode 100644 index 0000000..025fbab --- /dev/null +++ b/0059-To-support-clustered-raid10.patch @@ -0,0 +1,93 @@ +From 5339f99606f19ce1eeadebf3c0849933dc0c6fd5 Mon Sep 17 00:00:00 2001 +From: Guoqing Jiang +Date: Mon, 30 Oct 2017 17:09:51 +0800 +Subject: [PATCH] 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 +Signed-off-by: Jes Sorensen +--- + Grow.c | 6 ++++++ + mdadm.c | 9 +++++++-- + mdadm.h | 1 + + util.c | 11 +++++++++++ + 4 files changed, 25 insertions(+), 2 deletions(-) + +diff --git a/Grow.c b/Grow.c +index 0f9e89bcc5ba..80176e32c52f 100644 +--- a/Grow.c ++++ b/Grow.c +@@ -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); +diff --git a/mdadm.c b/mdadm.c +index 7cdcdba7c652..87cb33f84ac2 100644 +--- a/mdadm.c ++++ b/mdadm.c +@@ -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; + } +diff --git a/mdadm.h b/mdadm.h +index 85947bf62ff0..3cbf82f18d9e 100644 +--- a/mdadm.h ++++ b/mdadm.h +@@ -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); +diff --git a/util.c b/util.c +index c11729e3260e..543ec6cf46ef 100644 +--- a/util.c ++++ b/util.c +@@ -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; +-- +2.10.0 + diff --git a/mdadm.changes b/mdadm.changes index e6d1f1f..7c783ac 100644 --- a/mdadm.changes +++ b/mdadm.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Wed Nov 15 01:27:06 UTC 2017 - gqjiang@suse.com + +- Add one mdadm patch to support clustered raid10 (fate#323171) + 0059-To-support-clustered-raid10.patch + ------------------------------------------------------------------- Mon Aug 21 16:44:54 UTC 2017 - colyli@suse.com diff --git a/mdadm.spec b/mdadm.spec index 55fb3c5..ed2a72a 100644 --- a/mdadm.spec +++ b/mdadm.spec @@ -1,7 +1,7 @@ # # spec file for package mdadm # -# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2017 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -97,6 +97,7 @@ Patch55: 0055-Allow-more-spare-selection-criteria.patch Patch56: 0056-Add-sector-size-as-spare-selection-criterion.patch Patch57: 0057-super1-fix-sb-max_dev-when-adding-a-new-disk-in-line.patch Patch58: 0058-super1-only-set-clustered-flag-when-bitmap-is-presen.patch +Patch59: 0059-To-support-clustered-raid10.patch Patch1000: 1000-The-mdcheck-script-now-adds-messages-to-the-system.patch %define _udevdir %(pkg-config --variable=udevdir udev) @@ -167,6 +168,7 @@ programs but with a very different interface. %patch56 -p1 %patch57 -p1 %patch58 -p1 +%patch59 -p1 %patch1000 -p1 %build