]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Grow: don't forget_backup when length of backup is zero.
authorNeilBrown <neilb@suse.de>
Thu, 10 Mar 2011 04:43:04 +0000 (15:43 +1100)
committerNeilBrown <neilb@suse.de>
Thu, 10 Mar 2011 04:43:04 +0000 (15:43 +1100)
This is just a waste of IO

Signed-off-by: NeilBrown <neilb@suse.de>
Grow.c

diff --git a/Grow.c b/Grow.c
index 7125a40935ee9ad3d7a0c3f531f24a9478b97495..c11b1cee96324f879642256357700e028b0d434e 100644 (file)
--- a/Grow.c
+++ b/Grow.c
@@ -2990,19 +2990,23 @@ int child_monitor(int afd, struct mdinfo *sra, struct reshape *reshape,
 
                /* Clear any backup region that is before 'here' */
                if (increasing) {
-                       if (reshape_completed >= (__le64_to_cpu(bsb.arraystart) +
+                       if (__le64_to_cpu(bsb.length) > 0 &&
+                           reshape_completed >= (__le64_to_cpu(bsb.arraystart) +
                                                  __le64_to_cpu(bsb.length)))
                                forget_backup(dests, destfd,
                                              destoffsets, 0);
-                       if (reshape_completed >= (__le64_to_cpu(bsb.arraystart2) +
+                       if (__le64_to_cpu(bsb.length2) > 0 &&
+                           reshape_completed >= (__le64_to_cpu(bsb.arraystart2) +
                                                  __le64_to_cpu(bsb.length2)))
                                forget_backup(dests, destfd,
                                              destoffsets, 1);
                } else {
-                       if (reshape_completed <= (__le64_to_cpu(bsb.arraystart)))
+                       if (__le64_to_cpu(bsb.length) > 0 &&
+                           reshape_completed <= (__le64_to_cpu(bsb.arraystart)))
                                forget_backup(dests, destfd,
                                              destoffsets, 0);
-                       if (reshape_completed <= (__le64_to_cpu(bsb.arraystart2)))
+                       if (__le64_to_cpu(bsb.length2) > 0 &&
+                           reshape_completed <= (__le64_to_cpu(bsb.arraystart2)))
                                forget_backup(dests, destfd,
                                              destoffsets, 1);
                }