]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Grow: don't make 'blocks' too large during in-place reshape.
authorNeilBrown <neilb@suse.de>
Fri, 16 Oct 2009 06:02:34 +0000 (17:02 +1100)
committerNeilBrown <neilb@suse.de>
Fri, 16 Oct 2009 06:02:34 +0000 (17:02 +1100)
On small (test) arrays, multiplying by 16 can make the 'chunk' size
larger than half the array, which is a problem.

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

diff --git a/Grow.c b/Grow.c
index c0fa56609d76e5484d50b23dc31762b0fe6371ca..043e28ff37da294de8de27ca3562017e69f4e496 100644 (file)
--- a/Grow.c
+++ b/Grow.c
@@ -892,9 +892,13 @@ int Grow_reshape(char *devname, int fd, int quiet, char *backup_file,
                /* LCM == product / GCD */
                blocks = ochunk/512 * nchunk/512 * odata * ndata / a;
 
-               if (ndata == odata)
-                       blocks *= 16;
-               else
+               if (ndata == odata) {
+                       /* Make 'blocks' bigger for better throughput, but
+                        * not so big that we reject it below.
+                        */
+                       if (blocks * 32 < sra->component_size)
+                               blocks *= 16;
+               } else
                        fprintf(stderr, Name ": Need to backup %luK of critical "
                                "section..\n", blocks/2);