mirror of
https://github.com/amadvance/snapraid.git
synced 2026-11-22 07:56:33 -05:00
Changes sync to hash as a separate step.
This commit is contained in:
parent
74493a5f3d
commit
8fb9803b34
14 changed files with 351 additions and 26 deletions
9
HISTORY
9
HISTORY
|
|
@ -1,7 +1,7 @@
|
|||
SnapRAID HISTORY
|
||||
================
|
||||
|
||||
6.0 2014/1 (BETA)
|
||||
6.0 2014/2 (BETA)
|
||||
=================
|
||||
* In "sync", even if a silent error is found, continue to update
|
||||
the parity if it's possible to correct the error.
|
||||
|
|
@ -10,13 +10,18 @@ SnapRAID HISTORY
|
|||
But any new data added will be protected if you are using
|
||||
enough parity to fix both the silent error and at least
|
||||
another potential error.
|
||||
* In "sync" run a preliminary hashing step for all the new files,
|
||||
to ensure to detect silent errors caused by the heavy machine usage
|
||||
of the parity computation.
|
||||
You can disable this additional hashing with the new "rawsync"
|
||||
configuration option.
|
||||
* In "fix", if a previous attempt was made, resulting in a
|
||||
.unrecoverable file, uses this file as starting point for the
|
||||
new attempt.
|
||||
* New source code organization. The RAID engine is now
|
||||
an external component usable also in other projects.
|
||||
|
||||
5.3 2014/1 (BETA)
|
||||
5.3 2014/2 (BETA)
|
||||
=================
|
||||
* Don't warn about UUID changed if it's for an empty disk.
|
||||
|
||||
|
|
|
|||
11
Makefile.am
11
Makefile.am
|
|
@ -396,11 +396,22 @@ endif
|
|||
$(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) --test-expect-unrecoverable -c $(PAR2) fix -l test.log
|
||||
rm -r test/disk1/a_copy
|
||||
$(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) -c $(CONF) sync
|
||||
echo --- Abort sync late with additions with rawsync and then delete the new additions and sync again
|
||||
cp -pR test/disk1/a test/disk1/a_copy
|
||||
cp -pR test/disk2/a test/disk2/a_copy
|
||||
cp -pR test/disk3/a test/disk3/a_copy
|
||||
$(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) --test-kill-after-sync --test-rawsync -c $(CONF) sync
|
||||
$(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) -c $(CONF) check
|
||||
rm -r test/disk1/a_copy
|
||||
rm -r test/disk2/a_copy
|
||||
rm -r test/disk3/a_copy
|
||||
$(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) -c $(CONF) sync
|
||||
echo --- Abort sync late with additions and then delete the new additions and sync again
|
||||
cp -pR test/disk1/a test/disk1/a_copy
|
||||
cp -pR test/disk2/a test/disk2/a_copy
|
||||
cp -pR test/disk3/a test/disk3/a_copy
|
||||
$(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) --test-kill-after-sync -c $(CONF) sync
|
||||
$(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) -c $(CONF) check
|
||||
rm -r test/disk1/a_copy
|
||||
rm -r test/disk2/a_copy
|
||||
rm -r test/disk3/a_copy
|
||||
|
|
|
|||
15
TODO
15
TODO
|
|
@ -30,21 +30,6 @@ as search base.
|
|||
* Avoid to do optimized move operation if more files with
|
||||
same timestamp/size are present.
|
||||
|
||||
* Handle new files with a two steps approach to reduce possible
|
||||
silent errors.
|
||||
We can first hash them, proceding one disk at time, and then
|
||||
start computing the parity checking the precomputed hash.
|
||||
This imply a double read, likely doubling the sync time,
|
||||
but ensure that the hash are computed with the system not busy,
|
||||
avoiding to trigger silent errors depending on the usage level.
|
||||
This will also improve the cases of a crash during sync, because
|
||||
we already have all the hashes when sync starts.
|
||||
We need to extend the NEW blocks with an hash, likely using
|
||||
the dummy 0 hash as marker for no hash.
|
||||
And create a new block type REP (replaced) where the
|
||||
hash is intented to match the new block and not the
|
||||
previous one like for CHG blocks.
|
||||
|
||||
- Minor
|
||||
|
||||
* In the content file save the timestap of the parity files.
|
||||
|
|
|
|||
3
check.c
3
check.c
|
|
@ -797,9 +797,6 @@ static int state_check_process(struct snapraid_state* state, int check, int fix,
|
|||
failed[failed_count].block = block;
|
||||
failed[failed_count].handle = &handle[j];
|
||||
++failed_count;
|
||||
|
||||
fprintf(stdlog, "error:%u:%s:%s: Data error at position %u\n", i, handle[j].disk->name, block_file_get(block)->sub, block_file_pos(block));
|
||||
++error;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,3 @@ if ! ./configure ; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
if ! make check; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
|
|
|||
11
snapraid.1
11
snapraid.1
|
|
@ -974,6 +974,17 @@ commands interrupted by a machine crash, or any other event that
|
|||
may interrupt SnapRAID.
|
||||
The SIZE argument is specified in gibibytes. Where one gibi bytes
|
||||
is 1073741824 bytes.
|
||||
.SS rawsync
|
||||
Enables a single pass \(a"sync\(a" process avoding the initial hashing phase
|
||||
and saving time.
|
||||
In this mode no preliminary hashing is done, and the new data is hashed
|
||||
directly during the parity computation when it\(cqs read for the first time,
|
||||
This happens when the system is under heavy pressure due all disks spinning
|
||||
and CPU busy, and in such extreme conditions, if your machine has a latent
|
||||
hardware problem, it\(cqs possible to encouter silent errors what cannot be
|
||||
detected because the data is not yet hashed.
|
||||
To avoid this problem, this \(a"rawsync\(a" mode is by default disabled,
|
||||
but if you really trust your hardware, you can enable it, and save time.
|
||||
.SS pool DIR
|
||||
Defines the pooling directory where the virtual view of the disk
|
||||
array is created using the \(a"pool\(a" command.
|
||||
|
|
|
|||
|
|
@ -104,6 +104,7 @@ void memory(void)
|
|||
#define OPT_TEST_FORCE_SCRUB_EVEN 272
|
||||
#define OPT_TEST_FORCE_CONTENT_WRITE 273
|
||||
#define OPT_TEST_FORCE_CONTENT_TEXT 274
|
||||
#define OPT_TEST_RAWSYNC 275
|
||||
|
||||
#if HAVE_GETOPT_LONG
|
||||
struct option long_options[] = {
|
||||
|
|
@ -185,6 +186,9 @@ struct option long_options[] = {
|
|||
/* Force the use of text content file . */
|
||||
{ "test-force-content-text", 0, 0, OPT_TEST_FORCE_CONTENT_TEXT },
|
||||
|
||||
/* Like the rawsync configuration option. */
|
||||
{ "test-rawsync", 0, 0, OPT_TEST_RAWSYNC },
|
||||
|
||||
{ 0, 0, 0, 0 }
|
||||
};
|
||||
#endif
|
||||
|
|
@ -435,6 +439,9 @@ int main(int argc, char* argv[])
|
|||
case OPT_TEST_FORCE_CONTENT_TEXT :
|
||||
opt.force_content_text = 1;
|
||||
break;
|
||||
case OPT_TEST_RAWSYNC :
|
||||
opt.rawsync = 1;
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "Unknown option '%c'\n", (char)c);
|
||||
exit(EXIT_FAILURE);
|
||||
|
|
|
|||
|
|
@ -63,6 +63,20 @@ exclude /lost+found/
|
|||
# Format: "autosave SIZE_IN_GiB"
|
||||
#autosave 500
|
||||
|
||||
# Enables a single pass "sync" process avoding the initial hashing phase
|
||||
# and saving time.
|
||||
# In this mode no preliminary hashing is done, and the new data is hashed
|
||||
# directly during the parity computation when it's read for the first time,
|
||||
# This happens when the system is under heavy pressure due all disks spinning
|
||||
# and CPU busy, and in such extreme conditions, if your machine has a latent
|
||||
# hardware problem, it's possible to encouter silent errors what cannot be
|
||||
# detected because the data is not yet hashed.
|
||||
# To avoid this problem, this "rawsync" mode is by default disabled,
|
||||
# but if you really trust your hardware, you can enable it, and save time.
|
||||
#
|
||||
# Format: rawsync
|
||||
#rawsync
|
||||
|
||||
# Defines the pooling directory where the virtual view of the disk
|
||||
# array is created using the "pool" command (uncomment to enable).
|
||||
# The files are not really copied here, but just linked using
|
||||
|
|
|
|||
|
|
@ -67,6 +67,20 @@ exclude \Windows\
|
|||
# Format: "autosave SIZE_IN_GiB"
|
||||
#autosave 500
|
||||
|
||||
# Enables a single pass "sync" process avoding the initial hashing phase
|
||||
# and saving time.
|
||||
# In this mode no preliminary hashing is done, and the new data is hashed
|
||||
# directly during the parity computation when it's read for the first time,
|
||||
# This happens when the system is under heavy pressure due all disks spinning
|
||||
# and CPU busy, and in such extreme conditions, if your machine has a latent
|
||||
# hardware problem, it's possible to encouter silent errors what cannot be
|
||||
# detected because the data is not yet hashed.
|
||||
# To avoid this problem, this "rawsync" mode is by default disabled,
|
||||
# but if you really trust your hardware, you can enable it, and save time.
|
||||
#
|
||||
# Format: rawsync
|
||||
#rawsync
|
||||
|
||||
# Defines the pooling directory where the virtual view of the disk
|
||||
# array is created using the "pool" command (uncomment to enable).
|
||||
# The files are not really copied here, but just linked using
|
||||
|
|
|
|||
12
snapraid.d
12
snapraid.d
|
|
@ -742,6 +742,18 @@ Configuration
|
|||
The SIZE argument is specified in gibibytes. Where one gibi bytes
|
||||
is 1073741824 bytes.
|
||||
|
||||
rawsync
|
||||
Enables a single pass "sync" process avoding the initial hashing phase
|
||||
and saving time.
|
||||
In this mode no preliminary hashing is done, and the new data is hashed
|
||||
directly during the parity computation when it's read for the first time,
|
||||
This happens when the system is under heavy pressure due all disks spinning
|
||||
and CPU busy, and in such extreme conditions, if your machine has a latent
|
||||
hardware problem, it's possible to encouter silent errors what cannot be
|
||||
detected because the data is not yet hashed.
|
||||
To avoid this problem, this "rawsync" mode is by default disabled,
|
||||
but if you really trust your hardware, you can enable it, and save time.
|
||||
|
||||
pool DIR
|
||||
Defines the pooling directory where the virtual view of the disk
|
||||
array is created using the "pool" command.
|
||||
|
|
|
|||
16
snapraid.txt
16
snapraid.txt
|
|
@ -806,13 +806,25 @@ may interrupt SnapRAID.
|
|||
The SIZE argument is specified in gibibytes. Where one gibi bytes
|
||||
is 1073741824 bytes.
|
||||
|
||||
---- 7.8.2 pool DIR ----
|
||||
---- 7.8.2 rawsync ----
|
||||
Enables a single pass "sync" process avoding the initial hashing phase
|
||||
and saving time.
|
||||
In this mode no preliminary hashing is done, and the new data is hashed
|
||||
directly during the parity computation when it's read for the first time,
|
||||
This happens when the system is under heavy pressure due all disks spinning
|
||||
and CPU busy, and in such extreme conditions, if your machine has a latent
|
||||
hardware problem, it's possible to encouter silent errors what cannot be
|
||||
detected because the data is not yet hashed.
|
||||
To avoid this problem, this "rawsync" mode is by default disabled,
|
||||
but if you really trust your hardware, you can enable it, and save time.
|
||||
|
||||
---- 7.8.3 pool DIR ----
|
||||
Defines the pooling directory where the virtual view of the disk
|
||||
array is created using the "pool" command.
|
||||
|
||||
The directory must already exist.
|
||||
|
||||
---- 7.8.3 share UNC_DIR ----
|
||||
---- 7.8.4 share UNC_DIR ----
|
||||
Defines the Windows UNC path required to access the disks remotely.
|
||||
|
||||
If this option is specified, the symbolic links created in the pool
|
||||
|
|
|
|||
2
state.c
2
state.c
|
|
@ -597,6 +597,8 @@ void state_config(struct snapraid_state* state, const char* path, const char* co
|
|||
tommy_list_insert_tail(&state->disklist, &disk->node, disk);
|
||||
} else if (strcmp(tag, "nohidden") == 0) {
|
||||
state->filter_hidden = 1;
|
||||
} else if (strcmp(tag, "rawsync") == 0) {
|
||||
state->opt.rawsync = 1;
|
||||
} else if (strcmp(tag, "exclude") == 0) {
|
||||
struct snapraid_filter* filter;
|
||||
|
||||
|
|
|
|||
1
state.h
1
state.h
|
|
@ -59,6 +59,7 @@ struct snapraid_option {
|
|||
int verbose; /**< Verbose output. */
|
||||
int quiet; /**< Quiet output. */
|
||||
int gui; /**< Gui output. */
|
||||
int rawsync; /**< Enables the raw sync mode. */
|
||||
int force_zero; /**< Forced dangerous operations of synching files now with zero size. */
|
||||
int force_empty; /**< Forced dangerous operations of synching disks now empty. */
|
||||
int force_uuid; /**< Forced dangerous operations of synching disks with uuid changed. */
|
||||
|
|
|
|||
258
sync.c
258
sync.c
|
|
@ -24,6 +24,255 @@
|
|||
#include "handle.h"
|
||||
#include "raid/raid.h"
|
||||
|
||||
/****************************************************************************/
|
||||
/* hash */
|
||||
|
||||
static void state_hash_process(struct snapraid_state* state, block_off_t blockstart, block_off_t blockmax)
|
||||
{
|
||||
struct snapraid_handle* handle;
|
||||
unsigned diskmax;
|
||||
block_off_t i;
|
||||
unsigned j;
|
||||
void* buffer;
|
||||
data_off_t countsize;
|
||||
block_off_t countpos;
|
||||
block_off_t countmax;
|
||||
int ret;
|
||||
unsigned error;
|
||||
|
||||
/* maps the disks to handles */
|
||||
handle = handle_map(state, &diskmax);
|
||||
|
||||
/* buffer for reading */
|
||||
buffer = malloc_nofail(state->block_size);
|
||||
|
||||
error = 0;
|
||||
|
||||
/* first count the number of blocks to process */
|
||||
countmax = 0;
|
||||
for(j=0;j<diskmax;++j) {
|
||||
struct snapraid_disk* disk = handle[j].disk;
|
||||
|
||||
/* if unused disk skip it */
|
||||
if (!disk)
|
||||
continue;
|
||||
|
||||
for(i=blockstart;i<blockmax;++i) {
|
||||
struct snapraid_block* block;
|
||||
|
||||
block = disk_block_get(disk, i);
|
||||
|
||||
/* if no file in this block, skip it */
|
||||
if (!block_has_file(block))
|
||||
continue;
|
||||
|
||||
/* if the block already has a hash, skip it */
|
||||
if (block_has_updated_hash(block))
|
||||
continue;
|
||||
|
||||
++countmax;
|
||||
}
|
||||
}
|
||||
|
||||
countsize = 0;
|
||||
countpos = 0;
|
||||
if (state_progress_begin(state, blockstart, blockmax, countmax))
|
||||
for(j=0;j<diskmax;++j) {
|
||||
struct snapraid_disk* disk = handle[j].disk;
|
||||
|
||||
/* if unused disk skip it */
|
||||
if (!disk)
|
||||
continue;
|
||||
|
||||
for(i=blockstart;i<blockmax;++i) {
|
||||
int ret;
|
||||
snapraid_info info;
|
||||
int rehash;
|
||||
struct snapraid_block* block;
|
||||
int read_size;
|
||||
unsigned char hash[HASH_SIZE];
|
||||
|
||||
block = disk_block_get(disk, i);
|
||||
|
||||
/* if no file in this block, skip it */
|
||||
if (!block_has_file(block))
|
||||
continue;
|
||||
|
||||
/* if the block already has a hash, skip it */
|
||||
if (block_has_updated_hash(block))
|
||||
continue;
|
||||
|
||||
/* here only CHG blocks are allowed */
|
||||
assert(block_state_get(block) == BLOCK_STATE_CHG);
|
||||
|
||||
/* get block specific info */
|
||||
info = info_get(&state->infoarr, i);
|
||||
|
||||
/* if we have to use the old hash */
|
||||
rehash = info_get_rehash(info);
|
||||
|
||||
/* if the file is different than the current one, close it */
|
||||
if (handle[j].file != 0 && handle[j].file != block_file_get(block)) {
|
||||
/* keep a pointer at the file we are going to close for error reporting */
|
||||
struct snapraid_file* file = handle[j].file;
|
||||
ret = handle_close(&handle[j]);
|
||||
if (ret == -1) {
|
||||
/* This one is really an unexpected error, because we are only reading */
|
||||
/* and closing a descriptor should never fail */
|
||||
fprintf(stdlog, "error:%u:%s:%s: Close error. %s\n", i, handle[j].disk->name, file->sub, strerror(errno));
|
||||
fprintf(stderr, "DANGER! Unexpected close error in a data disk, it isn't possible to sync.\n");
|
||||
fprintf(stderr, "Ensure that disk '%s' is sane and that file '%s' can be accessed.\n", handle[j].disk->dir, handle[j].path);
|
||||
printf("Stopping at block %u\n", i);
|
||||
++error;
|
||||
goto bail;
|
||||
}
|
||||
}
|
||||
|
||||
ret = handle_open(&handle[j], block_file_get(block), state->opt.skip_sequential, stderr);
|
||||
if (ret == -1) {
|
||||
/* file we have tried to open for error reporting */
|
||||
struct snapraid_file* file = block_file_get(block);
|
||||
if (errno == ENOENT) {
|
||||
fprintf(stdlog, "error:%u:%s:%s: Open missing error\n", i, handle[j].disk->name, file->sub);
|
||||
fprintf(stderr, "Missing file '%s'.\n", handle[j].path);
|
||||
fprintf(stderr, "WARNING! You cannot modify data disk during a sync.\n");
|
||||
fprintf(stderr, "Rerun the sync command when finished.\n");
|
||||
|
||||
++error;
|
||||
|
||||
/* if the file is missing, it means that it was removed during sync */
|
||||
/* this isn't a serious error, so we skip this block, and continue with others */
|
||||
continue;
|
||||
} else if (errno == EACCES) {
|
||||
fprintf(stdlog, "error:%u:%s:%s: Open access error\n", i, handle[j].disk->name, file->sub);
|
||||
fprintf(stderr, "No access at file '%s'.\n", handle[j].path);
|
||||
fprintf(stderr, "WARNING! Please fix the access permission in the data disk.\n");
|
||||
fprintf(stderr, "Rerun the sync command when finished.\n");
|
||||
|
||||
++error;
|
||||
|
||||
/* this isn't a serious error, so we skip this block, and continue with others */
|
||||
continue;
|
||||
} else {
|
||||
fprintf(stdlog, "error:%u:%s:%s: Open error. %s\n", i, handle[j].disk->name, file->sub, strerror(errno));
|
||||
fprintf(stderr, "DANGER! Unexpected open error in a data disk, it isn't possible to sync.\n");
|
||||
fprintf(stderr, "Ensure that disk '%s' is sane and that file '%s' can be accessed.\n", handle[j].disk->dir, handle[j].path);
|
||||
printf("Stopping to allow recovery. Try with 'snapraid check -f %s'\n", file->sub);
|
||||
}
|
||||
|
||||
++error;
|
||||
goto bail;
|
||||
}
|
||||
|
||||
/* check if the file is changed */
|
||||
if (handle[j].st.st_size != block_file_get(block)->size
|
||||
|| handle[j].st.st_mtime != block_file_get(block)->mtime_sec
|
||||
|| STAT_NSEC(&handle[j].st) != block_file_get(block)->mtime_nsec
|
||||
|| handle[j].st.st_ino != block_file_get(block)->inode
|
||||
) {
|
||||
fprintf(stdlog, "error:%u:%s:%s: Unexpected change\n", i, handle[j].disk->name, handle[j].file->sub);
|
||||
if (handle[j].st.st_size != block_file_get(block)->size)
|
||||
fprintf(stderr, "Unexpected size change at file '%s' from %"PRIu64" to %"PRIu64".\n", handle[j].path, block_file_get(block)->size, handle[j].st.st_size);
|
||||
else if (handle[j].st.st_mtime != block_file_get(block)->mtime_sec
|
||||
|| STAT_NSEC(&handle[j].st) != block_file_get(block)->mtime_nsec) {
|
||||
fprintf(stderr, "Unexpected time change at file '%s' from %"PRIu64".%d to %"PRIu64".%d.\n", handle[j].path, block_file_get(block)->mtime_sec, block_file_get(block)->mtime_nsec, (uint64_t)handle[j].st.st_mtime, (uint32_t)STAT_NSEC(&handle[j].st));
|
||||
} else {
|
||||
fprintf(stderr, "Unexpected inode change from %"PRIu64" to %"PRIu64" at file '%s'.\n", block_file_get(block)->inode, (uint64_t)handle[j].st.st_ino, handle[j].path);
|
||||
}
|
||||
fprintf(stderr, "WARNING! You cannot modify files during a sync.\n");
|
||||
fprintf(stderr, "Rerun the sync command when finished.\n");
|
||||
|
||||
++error;
|
||||
|
||||
/* if the file is changed, it means that it was modified during sync */
|
||||
/* this isn't a serious error, so we skip this block, and continue with others */
|
||||
continue;
|
||||
}
|
||||
|
||||
read_size = handle_read(&handle[j], block, buffer, state->block_size, stderr);
|
||||
if (read_size == -1) {
|
||||
fprintf(stdlog, "error:%u:%s:%s: Read error at position %u\n", i, handle[j].disk->name, handle[j].file->sub, block_file_pos(block));
|
||||
fprintf(stderr, "DANGER! Unexpected read error in a data disk, it isn't possible to sync.\n");
|
||||
fprintf(stderr, "Ensure that disk '%s' is sane and that file '%s' can be read.\n", handle[j].disk->dir, handle[j].path);
|
||||
printf("Stopping to allow recovery. Try with 'snapraid check -f %s'\n", handle[j].file->sub);
|
||||
++error;
|
||||
goto bail;
|
||||
}
|
||||
|
||||
countsize += read_size;
|
||||
|
||||
/* now compute the hash */
|
||||
if (rehash) {
|
||||
memhash(state->prevhash, state->prevhashseed, hash, buffer, read_size);
|
||||
} else {
|
||||
memhash(state->hash, state->hashseed, hash, buffer, read_size);
|
||||
}
|
||||
|
||||
/* copy the hash in the block */
|
||||
memcpy(block->hash, hash, HASH_SIZE);
|
||||
|
||||
/* and mark the block as hashed */
|
||||
block_state_set(block, BLOCK_STATE_REP);
|
||||
|
||||
/* mark the state as needing write */
|
||||
state->need_write = 1;
|
||||
|
||||
/* count the number of processed block */
|
||||
++countpos;
|
||||
|
||||
/* progress */
|
||||
if (state_progress(state, i, countpos, countmax, countsize)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* close the last file in the disk */
|
||||
if (handle[j].file != 0) {
|
||||
/* keep a pointer at the file we are going to close for error reporting */
|
||||
struct snapraid_file* file = handle[j].file;
|
||||
ret = handle_close(&handle[j]);
|
||||
|
||||
if (ret == -1) {
|
||||
/* This one is really an unexpected error, because we are only reading */
|
||||
/* and closing a descriptor should never fail */
|
||||
fprintf(stdlog, "error:%u:%s:%s: Close error. %s\n", blockmax, handle[j].disk->name, file->sub, strerror(errno));
|
||||
fprintf(stderr, "DANGER! Unexpected close error in a data disk, it isn't possible to sync.\n");
|
||||
fprintf(stderr, "Ensure that disk '%s' is sane and that file '%s' can be accessed.\n", handle[j].disk->dir, handle[j].path);
|
||||
printf("Stopping at block %u\n", blockmax);
|
||||
++error;
|
||||
goto bail;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
state_progress_end(state, countpos, countmax, countsize);
|
||||
|
||||
if (error) {
|
||||
printf("\n");
|
||||
printf("%8u read/write errors\n", error);
|
||||
printf("WARNING! There are errors!\n");
|
||||
} else {
|
||||
/* print the result only if processed something */
|
||||
if (countpos != 0)
|
||||
printf("Everything OK\n");
|
||||
}
|
||||
|
||||
fprintf(stdlog, "hash_summary:error_readwrite:%u\n", error);
|
||||
|
||||
bail:
|
||||
for(j=0;j<diskmax;++j) {
|
||||
ret = handle_close(&handle[j]);
|
||||
if (ret == -1) {
|
||||
fprintf(stderr, "DANGER! Unexpected close error in a data disk.\n");
|
||||
++error;
|
||||
/* continue, as we are already exiting */
|
||||
}
|
||||
}
|
||||
|
||||
free(handle);
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
/* sync */
|
||||
|
||||
|
|
@ -729,6 +978,15 @@ int state_sync(struct snapraid_state* state, block_off_t blockstart, block_off_t
|
|||
}
|
||||
}
|
||||
|
||||
if (!state->opt.rawsync) {
|
||||
printf("Hashing...\n");
|
||||
|
||||
state_hash_process(state, blockstart, blockmax);
|
||||
|
||||
if (state->need_write)
|
||||
state_write(state);
|
||||
}
|
||||
|
||||
printf("Syncing...\n");
|
||||
|
||||
unrecoverable_error = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue