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@xxxxxxxxx> Signed-off-by: Krzysztof Wojcik <krzysztof.wojcik@xxxxxxxxx> --- restripe.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/restripe.c b/restripe.c index 1c42b60..79c695d 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; } -- To unsubscribe from this list: send the line "unsubscribe linux-raid" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html