Adds the -t option to limit the number of blocks processed.

More tests with incomplete sync.
This commit is contained in:
Andrea Mazzoleni 2011-03-23 18:54:08 +01:00
parent 25841deb04
commit 87bb5c7a66
9 changed files with 93 additions and 557 deletions

7
sync.c
View file

@ -217,7 +217,7 @@ bail:
return 0;
}
int state_sync(struct snapraid_state* state, block_off_t blockstart)
int state_sync(struct snapraid_state* state, block_off_t blockstart, block_off_t blockcount)
{
char path[PATH_MAX];
block_off_t blockmax;
@ -236,6 +236,11 @@ int state_sync(struct snapraid_state* state, block_off_t blockstart)
fprintf(stderr, "Error in the starting block %u. It's bigger than the parity size %u.\n", blockstart, blockmax);
exit(EXIT_FAILURE);
}
/* adjust the number of block to process */
if (blockcount != 0 && blockstart + blockcount < blockmax) {
blockmax = blockstart + blockcount;
}
pathcpy(path, sizeof(path), state->parity);
f = parity_create(path, size);