NeilBrown: Grow: get component_size before using it.

Martin F. Krafft madduck at alioth.debian.org
Wed Jan 27 02:01:14 UTC 2010


Module: mdadm
Branch: build
Commit: e380d3be42706ed455baf7b03c05d07f13368951
URL:    http://git.debian.org/?p=pkg-mdadm/mdadm.git;a=commit;h=e380d3be42706ed455baf7b03c05d07f13368951

Author: NeilBrown <neilb at suse.de>
Date:   Fri Nov  6 14:18:49 2009 +1100

Grow: get component_size before using it.

We were using ->component_size while it hadn't been set.
This effectively meant that 'blocks' wasn't multiplied by
16 and reshape was even slower than it should have been.

Signed-off-by: NeilBrown <neilb at suse.de>

---

 Grow.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/Grow.c b/Grow.c
index 31007ae..9204edf 100644
--- a/Grow.c
+++ b/Grow.c
@@ -900,6 +900,11 @@ int Grow_reshape(char *devname, int fd, int quiet, char *backup_file,
 		/* LCM == product / GCD */
 		blocks = ochunk/512 * nchunk/512 * odata * ndata / a;
 
+		sysfs_free(sra);
+		sra = sysfs_read(fd, 0,
+				 GET_COMPONENT|GET_DEVS|GET_OFFSET|GET_STATE|
+				 GET_CACHE);
+
 		if (ndata == odata) {
 			/* Make 'blocks' bigger for better throughput, but
 			 * not so big that we reject it below.
@@ -910,10 +915,6 @@ int Grow_reshape(char *devname, int fd, int quiet, char *backup_file,
 			fprintf(stderr, Name ": Need to backup %luK of critical "
 				"section..\n", blocks/2);
 
-		sysfs_free(sra);
-		sra = sysfs_read(fd, 0,
-				 GET_COMPONENT|GET_DEVS|GET_OFFSET|GET_STATE|
-				 GET_CACHE);
 		if (!sra) {
 			fprintf(stderr, Name ": %s: Cannot get array details from sysfs\n",
 				devname);




More information about the pkg-mdadm-commits mailing list