From 2eba849621011a5160b4597f82aa4ed0de7d4e64 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Mon, 1 Jul 2013 15:10:05 +1000 Subject: 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 --- lib.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'lib.c') 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; +} -- cgit v1.2.3