summaryrefslogtreecommitdiffstats
path: root/lib.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2013-07-01 07:10:05 +0200
committerNeilBrown <neilb@suse.de>2013-07-01 07:10:05 +0200
commit2eba849621011a5160b4597f82aa4ed0de7d4e64 (patch)
treebc692036f3889927542d9d0d1b12a8b305e082f9 /lib.c
parentNew function: sysfs_wait (diff)
downloadmdadm-2eba849621011a5160b4597f82aa4ed0de7d4e64.tar.xz
mdadm-2eba849621011a5160b4597f82aa4ed0de7d4e64.zip
Manage: check alignment when stopping an array undergoing reshape.
To be able to revert-reshape of raid4/5/6 which is changing the number of devices, the reshape must has been stopped on a multiple of the old and new stripe sizes. The kernel only enforces the new stripe size multiple. So we enforce the old-stripe-size multiple by careful use of "sync_max" and monitoring "reshape_position". Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'lib.c')
-rw-r--r--lib.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib.c b/lib.c
index fa6f2232..840c11f6 100644
--- a/lib.c
+++ b/lib.c
@@ -396,3 +396,14 @@ int use_udev(void)
}
return use;
}
+
+unsigned long GCD(unsigned long a, unsigned long b)
+{
+ while (a != b) {
+ if (a < b)
+ b -= a;
+ if (b < a)
+ a -= b;
+ }
+ return a;
+}