]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Be more enthusiastic/flexible in backing up data.
authorNeilBrown <neilb@suse.de>
Tue, 11 Jan 2011 23:44:58 +0000 (10:44 +1100)
committerNeilBrown <neilb@suse.de>
Tue, 11 Jan 2011 23:44:58 +0000 (10:44 +1100)
At some points we need to perform 2 backups at once so as to
start the 'double buffering' approach.  So rather than assuming
what the next backup should be, example suspend_point and backup
as much as possible up to there.

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

diff --git a/Grow.c b/Grow.c
index 03a81e50ab533b8994d704976cba4494c3eb2661..9816ff24aa743b35bd18afc39c79bb2318806e1a 100644 (file)
--- a/Grow.c
+++ b/Grow.c
@@ -2822,18 +2822,29 @@ static int child_monitor(int afd, struct mdinfo *sra, struct reshape *reshape,
                        break;
                }
 
-               if (rv) {
+               while (rv) {
                        unsigned long long offset;
-                       /* need to backup some space... */
+                       /* Need to backup some data.
+                        * If 'part' is not used and the desired
+                        * backup size is suspended, do a backup,
+                        * then consider the next part.
+                        */
                        /* Check that 'part' is unused */
                        if (part == 0 && __le64_to_cpu(bsb.length) != 0)
-                               abort(); /* BUG here */
+                               break;
                        if (part == 1 && __le64_to_cpu(bsb.length2) != 0)
-                               abort();
+                               break;
 
                        offset = backup_point / data;
-                       if (!increasing)
+                       if (increasing) {
+                               if (offset + stripes * (chunk/512) >
+                                   suspend_point/data)
+                                       break;
+                       } else {
                                offset -= stripes * (chunk/512);
+                               if (offset > suspend_point/data)
+                                       break;
+                       }
                        grow_backup(sra, offset, stripes,
                                    fds, offsets,
                                    disks, chunk, level, layout,