]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
FIX: Move buffer to next location
authorAdam Kwolek <adam.kwolek@intel.com>
Thu, 9 Jun 2011 03:00:55 +0000 (13:00 +1000)
committerNeilBrown <neilb@suse.de>
Thu, 9 Jun 2011 03:00:55 +0000 (13:00 +1000)
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>
restripe.c

index 0c8ac08a1c536bdb583b4d4172d3c5a615a5b5d7..9c83e2ebbedf0bc1774dd97ea2876873ca0b9258 100644 (file)
@@ -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;
        }