summaryrefslogtreecommitdiffstats
path: root/mdmon.h
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2013-07-31 01:18:57 +0200
committerNeilBrown <neilb@suse.de>2013-07-31 01:22:18 +0200
commit71d68ff62f945254240575cd836f5f2a09ced5d2 (patch)
tree3b0228a722904beaa201aea323e234223041c098 /mdmon.h
parentAvoid double close() (diff)
downloadmdadm-71d68ff62f945254240575cd836f5f2a09ced5d2.tar.xz
mdadm-71d68ff62f945254240575cd836f5f2a09ced5d2.zip
Fix is_resync_complete for RAID10
For RAID10, 'sync' numbers go up to the array size rather than the component size. is_resync_complete() needs to allow for this. Reported-by: Pawel Baldysiak <pawel.baldysiak@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'mdmon.h')
-rw-r--r--mdmon.h20
1 files changed, 17 insertions, 3 deletions
diff --git a/mdmon.h b/mdmon.h
index 60fda38d..5a8e1209 100644
--- a/mdmon.h
+++ b/mdmon.h
@@ -91,7 +91,21 @@ extern int monitor_loop_cnt;
*/
static inline int is_resync_complete(struct mdinfo *array)
{
- if (array->resync_start >= array->component_size)
- return 1;
- return 0;
+ unsigned long long sync_size = 0;
+ int ncopies, l;
+ switch(array->array.level) {
+ case 1:
+ case 4:
+ case 5:
+ case 6:
+ sync_size = array->component_size;
+ break;
+ case 10:
+ l = array->array.layout;
+ ncopies = (l & 0xff) * ((l >> 8) && 0xff);
+ sync_size = array->component_size * array->array.raid_disks;
+ sync_size /= ncopies;
+ break;
+ }
+ return array->resync_start >= sync_size;
}