summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Kwolek <adam.kwolek@intel.com>2011-06-09 13:00:55 +1000
committerNeilBrown <neilb@suse.de>2011-06-09 13:00:55 +1000
commitccced3dc40a25c1bbfb6b998b273d02a9add0795 (patch)
treeb50ba2aff2f5ed0175c50097ade3db0fd5293db8
parenta6b6d984e037a3424ce20e250d5e84a734ac7e90 (diff)
downloadmdadm-ccced3dc40a25c1bbfb6b998b273d02a9add0795.tar.gz
FIX: Move buffer to next location
When no output file is given save_stripes() should collect amount of stripes in passed buffer. Currently all stripes are saved in the same area in passed buffer. This causes that last stripe is returned on buffer begin only. Increase buffer (buf) pointer when save_stripes() is about switch to next stripe operation. This allows for proper buffer filling as input parameter length directs. Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: Krzysztof Wojcik <krzysztof.wojcik@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
-rw-r--r--restripe.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/restripe.c b/restripe.c
index 0c8ac08..9c83e2e 100644
--- a/restripe.c
+++ b/restripe.c
@@ -652,10 +652,14 @@ int save_stripes(int *source, unsigned long long *offsets,
fdisk[0], fdisk[1], bufs);
}
}
- if (dest)
+ if (dest) {
for (i = 0; i < nwrites; i++)
if (write(dest[i], buf, len) != len)
return -1;
+ } else {
+ /* build next stripe in buffer */
+ buf += len;
+ }
length -= len;
start += len;
}