From: Adam Kwolek Date: Thu, 9 Jun 2011 03:00:55 +0000 (+1000) Subject: FIX: Move buffer to next location X-Git-Tag: mdadm-3.2.2~28 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ccced3dc40a25c1bbfb6b998b273d02a9add0795;p=thirdparty%2Fmdadm.git 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 Signed-off-by: Krzysztof Wojcik Signed-off-by: NeilBrown --- diff --git a/restripe.c b/restripe.c index 0c8ac08a..9c83e2eb 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; }