summaryrefslogtreecommitdiffstats
path: root/restripe.c
diff options
context:
space:
mode:
authorNeil Brown <neilb@suse.de>2006-03-20 03:17:31 +0000
committerNeil Brown <neilb@suse.de>2006-03-20 03:17:31 +0000
commit353632d927d6e46282ef4f51d4ad17940a30cdf0 (patch)
tree7257d93e459937f1b5bffa90ea5b2dccd18a2b00 /restripe.c
parente86c9dd6d847ec57ec400b118efaf2c1808f10bc (diff)
downloadmdadm-353632d927d6e46282ef4f51d4ad17940a30cdf0.tar.gz
mdadm-353632d927d6e46282ef4f51d4ad17940a30cdf0.tar.xz
mdadm-353632d927d6e46282ef4f51d4ad17940a30cdf0.zip
Support restarting of a reshape on --assemble
Signed-off-by: Neil Brown <neilb@suse.de>
Diffstat (limited to 'restripe.c')
-rw-r--r--restripe.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/restripe.c b/restripe.c
index 94a0e3d..b7b3636 100644
--- a/restripe.c
+++ b/restripe.c
@@ -162,7 +162,7 @@ int save_stripes(int *source, unsigned long long *offsets,
/* Restore data:
* We are given:
* A list of 'fds' of the active disks. Some may be '-1' for not-available.
- * A geometry: raid_disks, chunk_sisze, level, layout
+ * A geometry: raid_disks, chunk_size, level, layout
* An 'fd' to read from. It is already seeked to the right (Read) location.
* A start and length.
* The length must be a multiple of the stripe size.
@@ -172,7 +172,7 @@ int save_stripes(int *source, unsigned long long *offsets,
*/
int restore_stripes(int *dest, unsigned long long *offsets,
int raid_disks, int chunk_size, int level, int layout,
- int source,
+ int source, unsigned long long read_offset,
unsigned long long start, unsigned long long length)
{
char *stripe_buf = malloc(raid_disks * chunk_size);
@@ -199,8 +199,11 @@ int restore_stripes(int *dest, unsigned long long *offsets,
int disk = geo_map(i, start/chunk_size/data_disks,
raid_disks, level, layout);
blocks[i] = stripes[disk];
+ if (lseek64(source, read_offset, 0) != read_offset)
+ return -1;
if (read(source, stripes[disk], chunk_size) != chunk_size)
return -1;
+ read_offset += chunk_size;
}
/* We have the data, now do the parity */
offset = (start/chunk_size/data_disks) * chunk_size;
@@ -311,7 +314,7 @@ main(int argc, char *argv[])
} else {
int rv = restore_stripes(fds, offsets,
raid_disks, chunk_size, level, layout,
- storefd,
+ storefd, 0ULL,
start, length);
if (rv != 0) {
fprintf(stderr, "test_stripe: restore_stripes returned %d\n", rv);