summaryrefslogtreecommitdiffstats
path: root/Grow.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2009-10-16 17:02:34 +1100
committerNeilBrown <neilb@suse.de>2009-10-16 17:02:34 +1100
commiteba7152931708db1d3049030e0a1ffa4ed174373 (patch)
treebd0e1aef2f8ce7f42be8e98b5b4c8034f7ec8e93 /Grow.c
parent521f349cb0b2549fc0b9f1a8141f0615841634da (diff)
downloadmdadm-eba7152931708db1d3049030e0a1ffa4ed174373.tar.gz
mdadm-eba7152931708db1d3049030e0a1ffa4ed174373.tar.xz
mdadm-eba7152931708db1d3049030e0a1ffa4ed174373.zip
Grow: don't make 'blocks' too large during in-place reshape.
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>
Diffstat (limited to 'Grow.c')
-rw-r--r--Grow.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/Grow.c b/Grow.c
index c0fa566..043e28f 100644
--- 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);