diff --git a/sync.c b/sync.c index 58ba44d6..8ac8a75d 100644 --- a/sync.c +++ b/sync.c @@ -27,7 +27,7 @@ /****************************************************************************/ /* hash */ -static void state_hash_process(struct snapraid_state* state, block_off_t blockstart, block_off_t blockmax) +static int state_hash_process(struct snapraid_state* state, block_off_t blockstart, block_off_t blockmax) { struct snapraid_handle* handle; unsigned diskmax; @@ -39,6 +39,7 @@ static void state_hash_process(struct snapraid_state* state, block_off_t blockst block_off_t countmax; int ret; unsigned error; + int skip_sync; /* maps the disks to handles */ handle = handle_map(state, &diskmax); @@ -87,7 +88,6 @@ static void state_hash_process(struct snapraid_state* state, block_off_t blockst continue; for(i=blockstart;iopt.rawsync) { printf("Hashing...\n"); - state_hash_process(state, blockstart, blockmax); + skip_sync = state_hash_process(state, blockstart, blockmax); if (state->need_write) state_write(state); } - printf("Syncing...\n"); + if (!skip_sync) { + printf("Syncing...\n"); - unrecoverable_error = 0; - - /* skip degenerated cases of empty parity, or skipping all */ - if (blockstart < blockmax) { - ret = state_sync_process(state, parity_ptr, blockstart, blockmax); - if (ret == -1) { - /* LCOV_EXCL_START */ - ++unrecoverable_error; - /* continue, as we are already exiting */ - /* LCOV_EXCL_STOP */ + /* skip degenerated cases of empty parity, or skipping all */ + if (blockstart < blockmax) { + ret = state_sync_process(state, parity_ptr, blockstart, blockmax); + if (ret == -1) { + /* LCOV_EXCL_START */ + ++unrecoverable_error; + /* continue, as we are already exiting */ + /* LCOV_EXCL_STOP */ + } + } else { + printf("Nothing to do\n"); } - } else { - printf("Nothing to do\n"); } for(l=0;llevel;++l) {