Import Upstream version 12.4
This commit is contained in:
@@ -1896,7 +1896,7 @@ bail:
|
||||
if (error && !fix)
|
||||
log_fatal("WARNING! There are errors!\n");
|
||||
if (unrecoverable_error)
|
||||
log_fatal("DANGER! There are unrecoverable errors!\n");
|
||||
log_fatal("DANGER! Unrecoverable errors detected!\n");
|
||||
|
||||
log_tag("summary:error:%u\n", error);
|
||||
if (fix)
|
||||
@@ -1974,7 +1974,7 @@ int state_check(struct snapraid_state* state, int fix, block_off_t blockstart, b
|
||||
|
||||
if (blockstart > blockmax) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Error in the specified starting block %u. It's bigger than the parity size %u.\n", blockstart, blockmax);
|
||||
log_fatal("Error in the specified starting block %u. It's larger than the parity size %u.\n", blockstart, blockmax);
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
@@ -403,7 +403,7 @@ void state_dry(struct snapraid_state* state, block_off_t blockstart, block_off_t
|
||||
|
||||
if (blockstart > blockmax) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Error in the specified starting block %u. It's bigger than the parity size %u.\n", blockstart, blockmax);
|
||||
log_fatal("Error in the specified starting block %u. It's larger than the parity size %u.\n", blockstart, blockmax);
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
@@ -435,21 +435,21 @@ void file_copy(struct snapraid_file* src_file, struct snapraid_file* dst_file)
|
||||
|
||||
if (src_file->size != dst_file->size) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Internal inconsistency in copy file with different size\n");
|
||||
log_fatal("Internal inconsistency: Copy file with different size\n");
|
||||
os_abort();
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
if (src_file->mtime_sec != dst_file->mtime_sec) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Internal inconsistency in copy file with different mtime_sec\n");
|
||||
log_fatal("Internal inconsistency: Copy file with different mtime_sec\n");
|
||||
os_abort();
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
if (src_file->mtime_nsec != dst_file->mtime_nsec) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Internal inconsistency in copy file with different mtime_nsec\n");
|
||||
log_fatal("Internal inconsistency: Copy file with different mtime_nsec\n");
|
||||
os_abort();
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
@@ -499,7 +499,7 @@ int file_block_is_last(struct snapraid_file* file, block_off_t file_pos)
|
||||
|
||||
if (file_pos >= file->blockmax) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Internal inconsistency in file block position\n");
|
||||
log_fatal("Internal inconsistency: File block position over the max\n");
|
||||
os_abort();
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
@@ -620,13 +620,13 @@ struct snapraid_extent* extent_alloc(block_off_t parity_pos, struct snapraid_fil
|
||||
|
||||
if (count == 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Internal inconsistency when allocating empty extent for file '%s' at position '%u/%u'\n", file->sub, file_pos, file->blockmax);
|
||||
log_fatal("Internal inconsistency: Allocating empty extent for file '%s' at position '%u/%u'\n", file->sub, file_pos, file->blockmax);
|
||||
os_abort();
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
if (file_pos + count > file->blockmax) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Internal inconsistency when allocating overflowing extent for file '%s' at position '%u:%u/%u'\n", file->sub, file_pos, count, file->blockmax);
|
||||
log_fatal("Internal inconsistency: Allocating overflowing extent for file '%s' at position '%u:%u/%u'\n", file->sub, file_pos, count, file->blockmax);
|
||||
os_abort();
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
@@ -938,7 +938,7 @@ static void extent_parity_check_foreach_unlock(void* void_arg, void* void_obj)
|
||||
|
||||
if (obj->count == 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Internal inconsistency in parity count zero for file '%s' at '%u'\n",
|
||||
log_fatal("Internal inconsistency: Parity count zero for file '%s' at '%u'\n",
|
||||
obj->file->sub, obj->parity_pos);
|
||||
++arg->result;
|
||||
return;
|
||||
@@ -952,7 +952,7 @@ static void extent_parity_check_foreach_unlock(void* void_arg, void* void_obj)
|
||||
/* check the order */
|
||||
if (prev->parity_pos >= obj->parity_pos) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Internal inconsistency in parity order for files '%s' at '%u:%u' and '%s' at '%u:%u'\n",
|
||||
log_fatal("Internal inconsistency: Parity order for files '%s' at '%u:%u' and '%s' at '%u:%u'\n",
|
||||
prev->file->sub, prev->parity_pos, prev->count, obj->file->sub, obj->parity_pos, obj->count);
|
||||
++arg->result;
|
||||
return;
|
||||
@@ -962,7 +962,7 @@ static void extent_parity_check_foreach_unlock(void* void_arg, void* void_obj)
|
||||
/* check that the extents don't overlap */
|
||||
if (prev->parity_pos + prev->count > obj->parity_pos) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Internal inconsistency for parity overlap for files '%s' at '%u:%u' and '%s' at '%u:%u'\n",
|
||||
log_fatal("Internal inconsistency: Parity overlap for files '%s' at '%u:%u' and '%s' at '%u:%u'\n",
|
||||
prev->file->sub, prev->parity_pos, prev->count, obj->file->sub, obj->parity_pos, obj->count);
|
||||
++arg->result;
|
||||
return;
|
||||
@@ -988,7 +988,7 @@ static void extent_file_check_foreach_unlock(void* void_arg, void* void_obj)
|
||||
|
||||
if (obj->count == 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Internal inconsistency in file count zero for file '%s' at '%u'\n",
|
||||
log_fatal("Internal inconsistency: File count zero for file '%s' at '%u'\n",
|
||||
obj->file->sub, obj->file_pos);
|
||||
++arg->result;
|
||||
return;
|
||||
@@ -1004,7 +1004,7 @@ static void extent_file_check_foreach_unlock(void* void_arg, void* void_obj)
|
||||
/* check that the extent doesn't overflow the file */
|
||||
if (prev->file_pos + prev->count > prev->file->blockmax) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Internal inconsistency in delete end for file '%s' at '%u:%u' overflowing size '%u'\n",
|
||||
log_fatal("Internal inconsistency: Delete end for file '%s' at '%u:%u' overflowing size '%u'\n",
|
||||
prev->file->sub, prev->file_pos, prev->count, prev->file->blockmax);
|
||||
++arg->result;
|
||||
return;
|
||||
@@ -1014,7 +1014,7 @@ static void extent_file_check_foreach_unlock(void* void_arg, void* void_obj)
|
||||
/* check that the extent ends the file */
|
||||
if (prev->file_pos + prev->count != prev->file->blockmax) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Internal inconsistency in file end for file '%s' at '%u:%u' instead of size '%u'\n",
|
||||
log_fatal("Internal inconsistency: File end for file '%s' at '%u:%u' instead of size '%u'\n",
|
||||
prev->file->sub, prev->file_pos, prev->count, prev->file->blockmax);
|
||||
++arg->result;
|
||||
return;
|
||||
@@ -1027,7 +1027,7 @@ static void extent_file_check_foreach_unlock(void* void_arg, void* void_obj)
|
||||
/* check that the extent doesn't overflow the file */
|
||||
if (obj->file_pos + obj->count > obj->file->blockmax) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Internal inconsistency in delete start for file '%s' at '%u:%u' overflowing size '%u'\n",
|
||||
log_fatal("Internal inconsistency: Delete start for file '%s' at '%u:%u' overflowing size '%u'\n",
|
||||
obj->file->sub, obj->file_pos, obj->count, obj->file->blockmax);
|
||||
++arg->result;
|
||||
return;
|
||||
@@ -1037,7 +1037,7 @@ static void extent_file_check_foreach_unlock(void* void_arg, void* void_obj)
|
||||
/* check that the extent starts the file */
|
||||
if (obj->file_pos != 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Internal inconsistency in file start for file '%s' at '%u:%u'\n",
|
||||
log_fatal("Internal inconsistency: File start for file '%s' at '%u:%u'\n",
|
||||
obj->file->sub, obj->file_pos, obj->count);
|
||||
++arg->result;
|
||||
return;
|
||||
@@ -1048,7 +1048,7 @@ static void extent_file_check_foreach_unlock(void* void_arg, void* void_obj)
|
||||
/* check the order */
|
||||
if (prev->file_pos >= obj->file_pos) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Internal inconsistency in file order for file '%s' at '%u:%u' and at '%u:%u'\n",
|
||||
log_fatal("Internal inconsistency: File order for file '%s' at '%u:%u' and at '%u:%u'\n",
|
||||
prev->file->sub, prev->file_pos, prev->count, obj->file_pos, obj->count);
|
||||
++arg->result;
|
||||
return;
|
||||
@@ -1059,7 +1059,7 @@ static void extent_file_check_foreach_unlock(void* void_arg, void* void_obj)
|
||||
/* check that the extents don't overlap */
|
||||
if (prev->file_pos + prev->count > obj->file_pos) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Internal inconsistency in delete sequence for file '%s' at '%u:%u' and at '%u:%u'\n",
|
||||
log_fatal("Internal inconsistency: Delete sequence for file '%s' at '%u:%u' and at '%u:%u'\n",
|
||||
prev->file->sub, prev->file_pos, prev->count, obj->file_pos, obj->count);
|
||||
++arg->result;
|
||||
return;
|
||||
@@ -1069,7 +1069,7 @@ static void extent_file_check_foreach_unlock(void* void_arg, void* void_obj)
|
||||
/* check that the extents are sequential */
|
||||
if (prev->file_pos + prev->count != obj->file_pos) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Internal inconsistency in file sequence for file '%s' at '%u:%u' and at '%u:%u'\n",
|
||||
log_fatal("Internal inconsistency: File sequence for file '%s' at '%u:%u' and at '%u:%u'\n",
|
||||
prev->file->sub, prev->file_pos, prev->count, obj->file_pos, obj->count);
|
||||
++arg->result;
|
||||
return;
|
||||
@@ -1267,7 +1267,7 @@ void fs_allocate(struct snapraid_disk* disk, block_off_t parity_pos, struct snap
|
||||
/* ensure that we are extending the extent at the end */
|
||||
if (file_pos != extent->file_pos + extent->count) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Internal inconsistency when allocating file '%s' at position '%u/%u' in the middle of extent '%u:%u' in disk '%s'\n", file->sub, file_pos, file->blockmax, extent->file_pos, extent->count, disk->name);
|
||||
log_fatal("Internal inconsistency: Allocating file '%s' at position '%u/%u' in the middle of extent '%u:%u' in disk '%s'\n", file->sub, file_pos, file->blockmax, extent->file_pos, extent->count, disk->name);
|
||||
os_abort();
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
@@ -1289,7 +1289,7 @@ void fs_allocate(struct snapraid_disk* disk, block_off_t parity_pos, struct snap
|
||||
|
||||
if (parity_extent != extent || file_extent != extent) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Internal inconsistency when allocating file '%s' at position '%u/%u' for existing extent '%u:%u' in disk '%s'\n", file->sub, file_pos, file->blockmax, extent->file_pos, extent->count, disk->name);
|
||||
log_fatal("Internal inconsistency: Allocating file '%s' at position '%u/%u' for existing extent '%u:%u' in disk '%s'\n", file->sub, file_pos, file->blockmax, extent->file_pos, extent->count, disk->name);
|
||||
os_abort();
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
@@ -1313,7 +1313,7 @@ void fs_deallocate(struct snapraid_disk* disk, block_off_t parity_pos)
|
||||
extent = fs_par2extent_get_unlock(disk, &disk->fs_last, parity_pos);
|
||||
if (!extent) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Internal inconsistency when deallocating parity position '%u' for not existing extent in disk '%s'\n", parity_pos, disk->name);
|
||||
log_fatal("Internal inconsistency: Deallocating parity position '%u' for not existing extent in disk '%s'\n", parity_pos, disk->name);
|
||||
os_abort();
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
@@ -1368,7 +1368,7 @@ void fs_deallocate(struct snapraid_disk* disk, block_off_t parity_pos)
|
||||
|
||||
if (parity_extent != second_extent || file_extent != second_extent) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Internal inconsistency when deallocating parity position '%u' for splitting extent '%u:%u' in disk '%s'\n", parity_pos, second_extent->file_pos, second_extent->count, disk->name);
|
||||
log_fatal("Internal inconsistency: Deallocating parity position '%u' for splitting extent '%u:%u' in disk '%s'\n", parity_pos, second_extent->file_pos, second_extent->count, disk->name);
|
||||
os_abort();
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
@@ -1383,7 +1383,7 @@ struct snapraid_block* fs_file2block_get(struct snapraid_file* file, block_off_t
|
||||
{
|
||||
if (file_pos >= file->blockmax) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Internal inconsistency when dereferencing file '%s' at position '%u/%u'\n", file->sub, file_pos, file->blockmax);
|
||||
log_fatal("Internal inconsistency: Dereferencing file '%s' at position '%u/%u'\n", file->sub, file_pos, file->blockmax);
|
||||
os_abort();
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
@@ -1048,7 +1048,7 @@ static inline struct snapraid_file* fs_par2file_get(struct snapraid_disk* disk,
|
||||
ret = fs_par2file_find(disk, parity_pos, file_pos);
|
||||
if (ret == 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Internal inconsistency when deresolving parity to file at position '%u' in disk '%s'\n", parity_pos, disk->name);
|
||||
log_fatal("Internal inconsistency: Deresolving parity to file at position '%u' in disk '%s'\n", parity_pos, disk->name);
|
||||
os_abort();
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
@@ -1072,7 +1072,7 @@ static inline block_off_t fs_file2par_get(struct snapraid_disk* disk, struct sna
|
||||
ret = fs_file2par_find(disk, file, file_pos);
|
||||
if (ret == POS_NULL) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Internal inconsistency when resolving file '%s' at position '%u/%u' in disk '%s'\n", file->sub, file_pos, file->blockmax, disk->name);
|
||||
log_fatal("Internal inconsistency: Resolving file '%s' at position '%u/%u' in disk '%s'\n", file->sub, file_pos, file->blockmax, disk->name);
|
||||
os_abort();
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
@@ -1096,7 +1096,7 @@ static inline struct snapraid_block* fs_par2block_get(struct snapraid_disk* disk
|
||||
ret = fs_par2block_find(disk, parity_pos);
|
||||
if (ret == BLOCK_NULL) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Internal inconsistency when deresolving parity to block at position '%u' in disk '%s'\n", parity_pos, disk->name);
|
||||
log_fatal("Internal inconsistency: Deresolving parity to block at position '%u' in disk '%s'\n", parity_pos, disk->name);
|
||||
os_abort();
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
@@ -152,8 +152,8 @@ void parity_overflow(struct snapraid_state* state, data_off_t size)
|
||||
}
|
||||
|
||||
if (found) {
|
||||
log_fatal("\nYour data requires more parity than the available space.\n");
|
||||
log_fatal("Please move the files 'outofparity' to another data disk.\n");
|
||||
log_fatal("\nInsufficient parity space. Data requires more parity than available.\n");
|
||||
log_fatal("Move the 'outofparity' files to a larger disk.\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1674,7 +1674,6 @@ static int state_diffscan(struct snapraid_state* state, int is_diff)
|
||||
struct snapraid_scan* scan = i->data;
|
||||
struct snapraid_disk* disk = scan->disk;
|
||||
tommy_node* node;
|
||||
unsigned phy_count;
|
||||
unsigned phy_dup;
|
||||
uint64_t phy_last;
|
||||
struct snapraid_file* phy_file_last;
|
||||
@@ -1757,7 +1756,6 @@ static int state_diffscan(struct snapraid_state* state, int is_diff)
|
||||
/* to reuse the just freed space */
|
||||
/* also check if the physical offset reported are fakes or not */
|
||||
node = scan->file_insert_list;
|
||||
phy_count = 0;
|
||||
phy_dup = 0;
|
||||
phy_last = FILEPHY_UNREAD_OFFSET;
|
||||
phy_file_last = 0;
|
||||
@@ -1773,13 +1771,12 @@ static int state_diffscan(struct snapraid_state* state, int is_diff)
|
||||
/* if verbose, print the list of duplicates real offsets */
|
||||
/* other cases are for offsets not supported, so we don't need to report them file by file */
|
||||
if (phy_last >= FILEPHY_REAL_OFFSET) {
|
||||
log_fatal("WARNING! Files '%s%s' and '%s%s' have the same physical offset %" PRId64 ".\n", disk->dir, phy_file_last->sub, disk->dir, file->sub, phy_last);
|
||||
log_fatal("WARNING! Files '%s%s' and '%s%s' share the same physical offset %" PRId64 ".\n", disk->dir, phy_file_last->sub, disk->dir, file->sub, phy_last);
|
||||
}
|
||||
++phy_dup;
|
||||
}
|
||||
phy_file_last = file;
|
||||
phy_last = file->physical;
|
||||
++phy_count;
|
||||
}
|
||||
|
||||
/* next node */
|
||||
@@ -1859,13 +1856,13 @@ static int state_diffscan(struct snapraid_state* state, int is_diff)
|
||||
}
|
||||
}
|
||||
if (done) {
|
||||
log_fatal("\nare now missing or rewritten!\n");
|
||||
log_fatal("\nare now missing or have been rewritten!\n");
|
||||
if (all_rewritten) {
|
||||
log_fatal("This could happen when restoring a disk with a backup\n");
|
||||
log_fatal("This could occur when restoring a disk from a backup\n");
|
||||
log_fatal("program that is not setting correctly the timestamps.\n");
|
||||
}
|
||||
if (all_missing) {
|
||||
log_fatal("This could happen when some disks are not mounted\n");
|
||||
log_fatal("This could occur when some disks are not mounted\n");
|
||||
log_fatal("in the expected directory.\n");
|
||||
}
|
||||
if (!is_diff) {
|
||||
@@ -1891,7 +1888,7 @@ static int state_diffscan(struct snapraid_state* state, int is_diff)
|
||||
}
|
||||
}
|
||||
if (done) {
|
||||
log_fatal(". Files order won't be optimal.\n");
|
||||
log_fatal(". The order of files won't be optimal.\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1910,7 +1907,7 @@ static int state_diffscan(struct snapraid_state* state, int is_diff)
|
||||
}
|
||||
}
|
||||
if (done) {
|
||||
log_fatal(". Not using inodes to detect move operations.\n");
|
||||
log_fatal(". Inodes are not used to detect move operations.\n");
|
||||
}
|
||||
|
||||
/* check for disks with changed UUID */
|
||||
@@ -1932,7 +1929,7 @@ static int state_diffscan(struct snapraid_state* state, int is_diff)
|
||||
}
|
||||
}
|
||||
if (done) {
|
||||
log_fatal(". Not using inodes to detect move operations.\n");
|
||||
log_fatal(". Inodes are not used to detect move operations.\n");
|
||||
}
|
||||
|
||||
/* check for disks with unsupported UUID */
|
||||
|
||||
@@ -671,7 +671,7 @@ static int state_scrub_process(struct snapraid_state* state, struct snapraid_par
|
||||
if (io_error || silent_error) {
|
||||
log_fatal("Use 'snapraid status' to list the bad blocks.\n");
|
||||
log_fatal("Use 'snapraid -e fix' to recover them.\n");
|
||||
log_fatal("Use 'snapraid -p bad scrub' to recheck after fixing.\n");
|
||||
log_fatal("Use 'snapraid -p bad scrub' to recheck after fixing to clear the bad state.\n");
|
||||
}
|
||||
|
||||
log_tag("summary:error_file:%u\n", error);
|
||||
|
||||
@@ -38,7 +38,7 @@ void usage(void)
|
||||
{
|
||||
version();
|
||||
|
||||
printf("Usage: " PACKAGE " status|diff|sync|scrub|list|dup|up|down|smart|pool|check|fix [options]\n");
|
||||
printf("Usage: " PACKAGE " status|diff|sync|scrub|list|dup|up|down|touch|smart|pool|check|fix [options]\n");
|
||||
printf("\n");
|
||||
printf("Commands:\n");
|
||||
printf(" status Print the status of the array\n");
|
||||
@@ -49,6 +49,7 @@ void usage(void)
|
||||
printf(" dup Find duplicate files\n");
|
||||
printf(" up Spin-up the array\n");
|
||||
printf(" down Spin-down the array\n");
|
||||
printf(" touch Add non-zero ns timestamps to files\n");
|
||||
printf(" smart SMART attributes of the array\n");
|
||||
printf(" pool Create or update the virtual view of the array\n");
|
||||
printf(" check Check the array\n");
|
||||
@@ -1083,28 +1084,28 @@ int main(int argc, char* argv[])
|
||||
|
||||
if (opt.force_full && opt.force_nocopy) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("You cannot use the -F, --force-full and -N, --force-nocopy options at the same time\n");
|
||||
log_fatal("You cannot use the -F, --force-full and -N, --force-nocopy options simultaneously\n");
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
if (opt.force_realloc && opt.force_nocopy) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("You cannot use the -R, --force-realloc and -N, --force-nocopy options at the same time\n");
|
||||
log_fatal("You cannot use the -R, --force-realloc and -N, --force-nocopy options simultaneously\n");
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
if (opt.force_realloc && opt.force_full) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("You cannot use the -R, --force-realloc and -F, --force-full options at the same time\n");
|
||||
log_fatal("You cannot use the -R, --force-realloc and -F, --force-full options simultaneously\n");
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
if (opt.prehash && opt.force_nocopy) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("You cannot use the -h, --pre-hash and -N, --force-nocopy options at the same time\n");
|
||||
log_fatal("You cannot use the -h, --pre-hash and -N, --force-nocopy options simultaneously\n");
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
@@ -1148,7 +1149,7 @@ int main(int argc, char* argv[])
|
||||
/* because we don't keep the information on what disk is the error */
|
||||
if (filter_error != 0 && !tommy_list_empty(&filterlist_disk)) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("You cannot use -e, --filter-error and -d, --filter-disk at the same time\n");
|
||||
log_fatal("You cannot use -e, --filter-error and -d, --filter-disk simultaneously\n");
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
@@ -1160,7 +1161,7 @@ int main(int argc, char* argv[])
|
||||
default :
|
||||
if (import_timestamp != 0 || import_content != 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("You cannot import with the '%s' command\n", command);
|
||||
log_fatal("Import not allowed with the '%s' command\n", command);
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
@@ -1286,9 +1287,9 @@ int main(int argc, char* argv[])
|
||||
if (lock == -1) {
|
||||
/* LCOV_EXCL_START */
|
||||
if (errno != EWOULDBLOCK) {
|
||||
log_fatal("Error creating the lock file '%s'. %s.\n", state.lockfile, strerror(errno));
|
||||
log_fatal("Failed to create the lock file '%s'. %s.\n", state.lockfile, strerror(errno));
|
||||
} else {
|
||||
log_fatal("The lock file '%s' is already locked!\n", state.lockfile);
|
||||
log_fatal("The lock file '%s' is already in use!\n", state.lockfile);
|
||||
log_fatal("SnapRAID is already in use!\n");
|
||||
}
|
||||
exit(EXIT_FAILURE);
|
||||
@@ -1354,7 +1355,7 @@ int main(int argc, char* argv[])
|
||||
ret = system(run); /* ignore error */
|
||||
if (ret != 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Error in running command '%s'.\n", run);
|
||||
log_fatal("Error executing command '%s'.\n", run);
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
@@ -1377,7 +1378,7 @@ int main(int argc, char* argv[])
|
||||
if ((state.need_write || state.opt.force_content_write))
|
||||
state_write(&state);
|
||||
} else {
|
||||
log_fatal("WARNING! Skipped state write for --test-kill-after-sync option.\n");
|
||||
log_fatal("WARNING! Skipped writing state due to --test-kill-after-sync option.\n");
|
||||
}
|
||||
|
||||
/* abort if required */
|
||||
@@ -1526,7 +1527,7 @@ int main(int argc, char* argv[])
|
||||
if (!opt.skip_lock && state.lockfile[0]) {
|
||||
if (lock_unlock(lock) == -1) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Error closing the lock file '%s'. %s.\n", state.lockfile, strerror(errno));
|
||||
log_fatal("Failed to close the lock file '%s'. %s.\n", state.lockfile, strerror(errno));
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
154
cmdline/state.c
154
cmdline/state.c
@@ -211,7 +211,7 @@ static void state_config_check(struct snapraid_state* state, const char* path, t
|
||||
if (state->raid_mode == RAID_MODE_VANDERMONDE) {
|
||||
if (state->level > 3) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("If you use the z-parity you cannot have more than 3 parities.\n");
|
||||
log_fatal("Using z-parity limits you to a maximum of 3 parities.\n");
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STIO */
|
||||
}
|
||||
@@ -220,7 +220,7 @@ static void state_config_check(struct snapraid_state* state, const char* path, t
|
||||
for (l = 0; l < state->level; ++l) {
|
||||
if (state->parity[l].split_mac == 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("No '%s' specification in '%s'\n", lev_config_name(l), path);
|
||||
log_fatal("Missing '%s' specification in '%s'\n", lev_config_name(l), path);
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
@@ -228,7 +228,7 @@ static void state_config_check(struct snapraid_state* state, const char* path, t
|
||||
|
||||
if (tommy_list_empty(&state->contentlist)) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("No 'content' specification in '%s'\n", path);
|
||||
log_fatal("Missing 'content' specification in '%s'\n", path);
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
@@ -855,7 +855,7 @@ void state_config(struct snapraid_state* state, const char* path, const char* co
|
||||
pathimport(device, sizeof(device), buffer);
|
||||
slash = strrchr(device, '/');
|
||||
if (slash)
|
||||
*slash = 0;
|
||||
*(slash + 1) = 0;
|
||||
else
|
||||
pathcpy(device, sizeof(device), ".");
|
||||
if (stat(device, &st) == 0) {
|
||||
@@ -992,14 +992,14 @@ void state_config(struct snapraid_state* state, const char* path, const char* co
|
||||
ret = sgettok(f, buffer, sizeof(buffer));
|
||||
if (ret < 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Invalid 'smartctl' name specification in '%s' at line %u\n", path, line);
|
||||
log_fatal("Invalid 'smartctl' name in '%s' at line %u\n", path, line);
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
if (!*buffer) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Empty 'smartctl' name specification in '%s' at line %u\n", path, line);
|
||||
log_fatal("Empty 'smartctl' name in '%s' at line %u\n", path, line);
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
@@ -1009,21 +1009,21 @@ void state_config(struct snapraid_state* state, const char* path, const char* co
|
||||
ret = sgetlasttok(f, custom, sizeof(custom));
|
||||
if (ret < 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Invalid 'smartctl' option specification in '%s' at line %u\n", path, line);
|
||||
log_fatal("Invalid 'smartctl' option in '%s' at line %u\n", path, line);
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
if (!*custom) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Empty 'smartctl' option specification in '%s' at line %u\n", path, line);
|
||||
log_fatal("Empty 'smartctl' option in '%s' at line %u\n", path, line);
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
if (validate_smartctl(custom) != 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Invalid 'smartctl' option specification in '%s' at line %u\n", path, line);
|
||||
log_fatal("Invalid 'smartctl' option in '%s' at line %u\n", path, line);
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
@@ -1032,7 +1032,7 @@ void state_config(struct snapraid_state* state, const char* path, const char* co
|
||||
if (lev_config_scan(buffer, &level, 0) == 0) {
|
||||
if (state->parity[level].smartctl[0] != 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Duplicate parity smartctl '%s' at line %u\n", buffer, line);
|
||||
log_fatal("Duplicate parity 'smartctl' '%s' at line %u\n", buffer, line);
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
@@ -1050,7 +1050,7 @@ void state_config(struct snapraid_state* state, const char* path, const char* co
|
||||
}
|
||||
if (!disk) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Missing disk smartctl '%s' at line %u\n", buffer, line);
|
||||
log_fatal("Missing disk 'smartctl' '%s' at line %u\n", buffer, line);
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
@@ -1087,7 +1087,7 @@ void state_config(struct snapraid_state* state, const char* path, const char* co
|
||||
if (!filter) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Invalid 'exclude' specification '%s' in '%s' at line %u\n", buffer, path, line);
|
||||
log_fatal("Filters using relative paths are not supported. Ensure to add an initial slash\n");
|
||||
log_fatal("Filters with relative paths are not supported. Ensure to add an initial slash\n");
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
@@ -1114,7 +1114,7 @@ void state_config(struct snapraid_state* state, const char* path, const char* co
|
||||
if (!filter) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Invalid 'include' specification '%s' in '%s' at line %u\n", buffer, path, line);
|
||||
log_fatal("Filters using relative paths are not supported. Ensure to add an initial slash\n");
|
||||
log_fatal("Filters with relative paths are not supported. Ensure to add an initial slash\n");
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
@@ -1218,7 +1218,7 @@ void state_config(struct snapraid_state* state, const char* path, const char* co
|
||||
/* by default use a random hash seed */
|
||||
if (randomize(state->hashseed, HASH_MAX) != 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Failed to get random values.\n");
|
||||
log_fatal("Failed to retrieve random values.\n");
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
@@ -1408,7 +1408,7 @@ static void state_map(struct snapraid_state* state)
|
||||
disk = find_disk_by_name(state, map->name);
|
||||
if (disk == 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Internal inconsistency for mapping '%s'\n", map->name);
|
||||
log_fatal("Internal inconsistency: Mapping not found for '%s'\n", map->name);
|
||||
os_abort();
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
@@ -1477,11 +1477,11 @@ static void state_map(struct snapraid_state* state)
|
||||
|
||||
if (!state->opt.force_uuid && uuid_mismatch > state->level) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Too many disks have UUID changed from the latest 'sync'.\n");
|
||||
log_fatal("If this happens because you really replaced them,\n");
|
||||
log_fatal("you can '%s' anyway, using 'snapraid --force-uuid %s'.\n", state->command, state->command);
|
||||
log_fatal("Instead, it's possible that you messed up the disk mount points,\n");
|
||||
log_fatal("and you have to restore the mount points at the state of the latest sync.\n");
|
||||
log_fatal("Too many disks have changed UUIDs since the last 'sync'.\n");
|
||||
log_fatal("If this happened because you actually replaced them,\n");
|
||||
log_fatal("you can still '%s', using 'snapraid --force-uuid %s'.\n", state->command, state->command);
|
||||
log_fatal("Alternatively, you may have misconfigured the disk mount points,\n");
|
||||
log_fatal("and you need to restore the mount points to the state of the latest sync.\n");
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
@@ -1498,7 +1498,7 @@ static void state_map(struct snapraid_state* state)
|
||||
/* ensure to don't go over the limit of the RAID engine */
|
||||
if (diskcount > RAID_DATA_MAX) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Too many data disks. No more than %u.\n", RAID_DATA_MAX);
|
||||
log_fatal("Too many data disks. Maximum allowed is %u.\n", RAID_DATA_MAX);
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
@@ -1510,15 +1510,15 @@ static void state_map(struct snapraid_state* state)
|
||||
if (!state->opt.no_warnings) {
|
||||
/* intentionally use log_fatal() instead of log_error() to give more visibility at the warning */
|
||||
if (diskcount >= 36 && state->level < 6) {
|
||||
log_fatal("WARNING! With %u disks it's recommended to use six parity levels.\n", diskcount);
|
||||
log_fatal("WARNING! For %u disks, it's recommended to use six parity levels.\n", diskcount);
|
||||
} else if (diskcount >= 29 && state->level < 5) {
|
||||
log_fatal("WARNING! With %u disks it's recommended to use five parity levels.\n", diskcount);
|
||||
log_fatal("WARNING! For %u disks, it's recommended to use five parity levels.\n", diskcount);
|
||||
} else if (diskcount >= 22 && state->level < 4) {
|
||||
log_fatal("WARNING! With %u disks it's recommended to use four parity levels.\n", diskcount);
|
||||
log_fatal("WARNING! For %u disks, it's recommended to use four parity levels.\n", diskcount);
|
||||
} else if (diskcount >= 15 && state->level < 3) {
|
||||
log_fatal("WARNING! With %u disks it's recommended to use three parity levels.\n", diskcount);
|
||||
log_fatal("WARNING! For %u disks, it's recommended to use three parity levels.\n", diskcount);
|
||||
} else if (diskcount >= 5 && state->level < 2) {
|
||||
log_fatal("WARNING! With %u disks it's recommended to use two parity levels.\n", diskcount);
|
||||
log_fatal("WARNING! For %u disks, it's recommended to use two parity levels.\n", diskcount);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1539,7 +1539,7 @@ void state_refresh(struct snapraid_state* state)
|
||||
disk = find_disk_by_name(state, map->name);
|
||||
if (disk == 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Internal inconsistency for mapping '%s'\n", map->name);
|
||||
log_fatal("Internal inconsistency: Mapping not found for '%s'\n", map->name);
|
||||
os_abort();
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
@@ -1547,7 +1547,7 @@ void state_refresh(struct snapraid_state* state)
|
||||
ret = fsinfo(disk->dir, 0, 0, &total_space, &free_space);
|
||||
if (ret != 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Error accessing disk '%s' to get file-system info. %s.\n", disk->dir, strerror(errno));
|
||||
log_fatal("Error accessing disk '%s' to retrieve file-system info. %s.\n", disk->dir, strerror(errno));
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
@@ -1575,7 +1575,7 @@ void state_refresh(struct snapraid_state* state)
|
||||
ret = fsinfo(state->parity[l].split_map[s].path, 0, 0, &total_space, &free_space);
|
||||
if (ret != 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Error accessing file '%s' to get file-system info. %s.\n", state->parity[l].split_map[s].path, strerror(errno));
|
||||
log_fatal("Error accessing file '%s' to retrieve file-system info. %s.\n", state->parity[l].split_map[s].path, strerror(errno));
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
@@ -1605,13 +1605,13 @@ static void state_content_check(struct snapraid_state* state, const char* path)
|
||||
struct snapraid_map* other = j->data;
|
||||
if (strcmp(map->name, other->name) == 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Colliding 'map' disk specification in '%s'\n", path);
|
||||
log_fatal("Conflicting 'map' disk specification in '%s'\n", path);
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
if (map->position == other->position) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Colliding 'map' index specification in '%s'\n", path);
|
||||
log_fatal("Conflicting 'map' index specification in '%s'\n", path);
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
@@ -1710,7 +1710,7 @@ static void decoding_error(const char* path, STREAM* f)
|
||||
if (seof(f)) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Unexpected end of content file '%s' at offset %" PRIi64 "\n", path, stell(f));
|
||||
log_fatal("This content file is truncated. Use an alternate copy.\n");
|
||||
log_fatal("This content file is truncated. Please use an alternate copy.\n");
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
@@ -1722,11 +1722,11 @@ static void decoding_error(const char* path, STREAM* f)
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
log_fatal("Decoding error in '%s' at offset %" PRIi64 "\n", path, stell(f));
|
||||
log_fatal("Error decoding '%s' at offset %" PRIi64 "\n", path, stell(f));
|
||||
|
||||
if (sdeplete(f, buf) != 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Error flushing the content file '%s' at offset %" PRIi64 "\n", path, stell(f));
|
||||
log_fatal("Failed to flush content file '%s' at offset %" PRIi64 "\n", path, stell(f));
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
@@ -1741,11 +1741,11 @@ static void decoding_error(const char* path, STREAM* f)
|
||||
crc_stored = crc32c(crc_stored, buf, 4);
|
||||
|
||||
if (crc_computed != crc_stored) {
|
||||
log_fatal("Mismatching CRC in '%s'\n", path);
|
||||
log_fatal("This content file is damaged! Use an alternate copy.\n");
|
||||
log_fatal("CRC mismatch in '%s'\n", path);
|
||||
log_fatal("This content file is damaged! Please use an alternate copy.\n");
|
||||
exit(EXIT_FAILURE);
|
||||
} else {
|
||||
log_fatal("The file CRC is correct!\n");
|
||||
log_fatal("The CRC of the file is correct!\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1831,7 +1831,7 @@ static void state_read_content(struct snapraid_state* state, const char* path, S
|
||||
if (ret < 0 || mapping >= mapping_max) {
|
||||
/* LCOV_EXCL_START */
|
||||
decoding_error(path, f);
|
||||
log_fatal("Internal inconsistency in mapping index!\n");
|
||||
log_fatal("Internal inconsistency: File mapping index out of range\n");
|
||||
os_abort();
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
@@ -1848,7 +1848,7 @@ static void state_read_content(struct snapraid_state* state, const char* path, S
|
||||
if (state->block_size == 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
decoding_error(path, f);
|
||||
log_fatal("Internal inconsistency due zero blocksize!\n");
|
||||
log_fatal("Internal inconsistency: Zero blocksize\n");
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
@@ -1857,7 +1857,7 @@ static void state_read_content(struct snapraid_state* state, const char* path, S
|
||||
if (v_size / state->block_size > blockmax) {
|
||||
/* LCOV_EXCL_START */
|
||||
decoding_error(path, f);
|
||||
log_fatal("Internal inconsistency in file size too big!\n");
|
||||
log_fatal("Internal inconsistency: File size too big!\n");
|
||||
os_abort();
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
@@ -1902,7 +1902,7 @@ static void state_read_content(struct snapraid_state* state, const char* path, S
|
||||
if (!*sub) {
|
||||
/* LCOV_EXCL_START */
|
||||
decoding_error(path, f);
|
||||
log_fatal("Internal inconsistency for null file!\n");
|
||||
log_fatal("Internal inconsistency: Null file!\n");
|
||||
os_abort();
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
@@ -1944,7 +1944,7 @@ static void state_read_content(struct snapraid_state* state, const char* path, S
|
||||
if (v_idx + v_count > file->blockmax) {
|
||||
/* LCOV_EXCL_START */
|
||||
decoding_error(path, f);
|
||||
log_fatal("Internal inconsistency in block number!\n");
|
||||
log_fatal("Internal inconsistency: Block number out of range\n");
|
||||
os_abort();
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
@@ -1952,7 +1952,7 @@ static void state_read_content(struct snapraid_state* state, const char* path, S
|
||||
if (v_pos + v_count > blockmax) {
|
||||
/* LCOV_EXCL_START */
|
||||
decoding_error(path, f);
|
||||
log_fatal("Internal inconsistency in block size %u/%u!\n", blockmax, v_pos + v_count);
|
||||
log_fatal("Internal inconsistency: Block size %u/%u!\n", blockmax, v_pos + v_count);
|
||||
os_abort();
|
||||
/* LCOV_EXCL_START */
|
||||
}
|
||||
@@ -2076,7 +2076,7 @@ static void state_read_content(struct snapraid_state* state, const char* path, S
|
||||
if (v_pos + v_count > blockmax) {
|
||||
/* LCOV_EXCL_START */
|
||||
decoding_error(path, f);
|
||||
log_fatal("Internal inconsistency in info size %u/%u!\n", blockmax, v_pos + v_count);
|
||||
log_fatal("Internal inconsistency: Info size %u/%u!\n", blockmax, v_pos + v_count);
|
||||
os_abort();
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
@@ -2108,7 +2108,7 @@ static void state_read_content(struct snapraid_state* state, const char* path, S
|
||||
if (rehash && state->prevhash == HASH_UNDEFINED) {
|
||||
/* LCOV_EXCL_START */
|
||||
decoding_error(path, f);
|
||||
log_fatal("Internal inconsistency for missing previous checksum!\n");
|
||||
log_fatal("Internal inconsistency: Missing previous checksum!\n");
|
||||
os_abort();
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
@@ -2127,7 +2127,7 @@ static void state_read_content(struct snapraid_state* state, const char* path, S
|
||||
if (!info) {
|
||||
/* LCOV_EXCL_START */
|
||||
decoding_error(path, f);
|
||||
log_fatal("Internal inconsistency for missing info!\n");
|
||||
log_fatal("Internal inconsistency: Missing info!\n");
|
||||
os_abort();
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
@@ -2151,7 +2151,7 @@ static void state_read_content(struct snapraid_state* state, const char* path, S
|
||||
if (ret < 0 || mapping >= mapping_max) {
|
||||
/* LCOV_EXCL_START */
|
||||
decoding_error(path, f);
|
||||
log_fatal("Internal inconsistency in mapping index!\n");
|
||||
log_fatal("Internal inconsistency: Hole mapping index out of range\n");
|
||||
os_abort();
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
@@ -2174,7 +2174,7 @@ static void state_read_content(struct snapraid_state* state, const char* path, S
|
||||
if (v_pos + v_count > blockmax) {
|
||||
/* LCOV_EXCL_START */
|
||||
decoding_error(path, f);
|
||||
log_fatal("Internal inconsistency in hole size %u/%u!\n", blockmax, v_pos + v_count);
|
||||
log_fatal("Internal inconsistency: Hole size %u/%u!\n", blockmax, v_pos + v_count);
|
||||
os_abort();
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
@@ -2251,7 +2251,7 @@ static void state_read_content(struct snapraid_state* state, const char* path, S
|
||||
if (ret < 0 || mapping >= mapping_max) {
|
||||
/* LCOV_EXCL_START */
|
||||
decoding_error(path, f);
|
||||
log_fatal("Internal inconsistency in mapping index!\n");
|
||||
log_fatal("Internal inconsistency: Symlink mapping index out of range\n");
|
||||
os_abort();
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
@@ -2268,7 +2268,7 @@ static void state_read_content(struct snapraid_state* state, const char* path, S
|
||||
if (!*sub) {
|
||||
/* LCOV_EXCL_START */
|
||||
decoding_error(path, f);
|
||||
log_fatal("Internal inconsistency for null symlink!\n");
|
||||
log_fatal("Internal inconsistency: Null symlink!\n");
|
||||
os_abort();
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
@@ -2302,7 +2302,7 @@ static void state_read_content(struct snapraid_state* state, const char* path, S
|
||||
if (ret < 0 || mapping >= mapping_max) {
|
||||
/* LCOV_EXCL_START */
|
||||
decoding_error(path, f);
|
||||
log_fatal("Internal inconsistency in mapping index!\n");
|
||||
log_fatal("Internal inconsistency: Hardlink mapping index out of range!\n");
|
||||
os_abort();
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
@@ -2319,7 +2319,7 @@ static void state_read_content(struct snapraid_state* state, const char* path, S
|
||||
if (!*sub) {
|
||||
/* LCOV_EXCL_START */
|
||||
decoding_error(path, f);
|
||||
log_fatal("Internal inconsistency for null hardlink!\n");
|
||||
log_fatal("Internal inconsistency: Null hardlink!\n");
|
||||
os_abort();
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
@@ -2335,7 +2335,7 @@ static void state_read_content(struct snapraid_state* state, const char* path, S
|
||||
if (!*linkto) {
|
||||
/* LCOV_EXCL_START */
|
||||
decoding_error(path, f);
|
||||
log_fatal("Internal inconsistency for empty hardlink '%s'!\n", sub);
|
||||
log_fatal("Internal inconsistency: Empty hardlink '%s'!\n", sub);
|
||||
os_abort();
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
@@ -2360,7 +2360,7 @@ static void state_read_content(struct snapraid_state* state, const char* path, S
|
||||
if (ret < 0 || mapping >= mapping_max) {
|
||||
/* LCOV_EXCL_START */
|
||||
decoding_error(path, f);
|
||||
log_fatal("Internal inconsistency in mapping index!\n");
|
||||
log_fatal("Internal inconsistency: Dir mapping index ouf of range!\n");
|
||||
os_abort();
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
@@ -2377,7 +2377,7 @@ static void state_read_content(struct snapraid_state* state, const char* path, S
|
||||
if (!*sub) {
|
||||
/* LCOV_EXCL_START */
|
||||
decoding_error(path, f);
|
||||
log_fatal("Internal inconsistency for null dir!\n");
|
||||
log_fatal("Internal inconsistency: Null dir!\n");
|
||||
os_abort();
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
@@ -2819,8 +2819,8 @@ static void state_read_content(struct snapraid_state* state, const char* path, S
|
||||
if (crc_stored != crc_computed) {
|
||||
/* LCOV_EXCL_START */
|
||||
/* here don't call decoding_error() because it's too late to get the crc */
|
||||
log_fatal("Mismatching CRC in '%s'\n", path);
|
||||
log_fatal("This content file is damaged! Use an alternate copy.\n");
|
||||
log_fatal("CRC mismatch in '%s'\n", path);
|
||||
log_fatal("The content file is damaged! Please use an alternate copy.\n");
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
@@ -2846,7 +2846,7 @@ static void state_read_content(struct snapraid_state* state, const char* path, S
|
||||
|
||||
if (!crc_checked) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Finished reading '%s' without finding the CRC\n", path);
|
||||
log_fatal("Reached the end of '%s' without finding the expected CRC\n", path);
|
||||
log_fatal("This content file is truncated or damaged! Use an alternate copy.\n");
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
@@ -2858,7 +2858,7 @@ static void state_read_content(struct snapraid_state* state, const char* path, S
|
||||
/* check that the stored parity size matches the loaded state */
|
||||
if (blockmax != parity_allocated_size(state)) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Internal inconsistency in parity size %u/%u in '%s' at offset %" PRIi64 "\n", blockmax, parity_allocated_size(state), path, stell(f));
|
||||
log_fatal("Internal inconsistency: Parity size %u/%u in '%s' at offset %" PRIi64 "\n", blockmax, parity_allocated_size(state), path, stell(f));
|
||||
if (state->opt.skip_content_check) {
|
||||
log_fatal("Overriding.\n");
|
||||
blockmax = parity_allocated_size(state);
|
||||
@@ -3009,7 +3009,7 @@ static void* state_write_thread(void* arg)
|
||||
disk = find_disk_by_name(state, map->name);
|
||||
if (!disk) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Internal inconsistency for unmapped disk '%s'\n", map->name);
|
||||
log_fatal("Internal inconsistency: Unmapped disk '%s'\n", map->name);
|
||||
return context;
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
@@ -3130,7 +3130,7 @@ static void* state_write_thread(void* arg)
|
||||
break;
|
||||
default :
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Internal inconsistency in state for block %u state %u\n", v_pos, v_state);
|
||||
log_fatal("Internal inconsistency: State for block %u state %u\n", v_pos, v_state);
|
||||
return context;
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
@@ -3340,8 +3340,8 @@ static void* state_write_thread(void* arg)
|
||||
/* with the one of the data written to the stream */
|
||||
if (crc != scrc_stream(f)) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("CRC mismatch writing the content stream.\n");
|
||||
log_fatal("DANGER! Your RAM memory is broken! DO NOT PROCEED UNTIL FIXED!\n");
|
||||
log_fatal("CRC mismatch while writing the content stream.\n");
|
||||
log_fatal("DANGER! Your RAM memory is faulty! DO NOT PROCEED UNTIL FIXED!\n");
|
||||
log_fatal("Try running a memory test like http://www.memtest86.com/\n");
|
||||
return context;
|
||||
/* LCOV_EXCL_STOP */
|
||||
@@ -3435,7 +3435,7 @@ static void state_write_content(struct snapraid_state* state, uint32_t* out_crc)
|
||||
disk = find_disk_by_name(state, map->name);
|
||||
if (!disk) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Internal inconsistency for unmapped disk '%s'\n", map->name);
|
||||
log_fatal("Internal inconsistency: Unmapped disk '%s'\n", map->name);
|
||||
os_abort();
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
@@ -3724,7 +3724,7 @@ void state_read(struct snapraid_state* state)
|
||||
|
||||
/* otherwise continue */
|
||||
if (node->next) {
|
||||
log_fatal("WARNING! Content file '%s' not found, trying with another copy...\n", path);
|
||||
log_fatal("WARNING! Content file '%s' not found, attempting with another copy...\n", path);
|
||||
|
||||
/* ensure to rewrite all the content files */
|
||||
state->need_write = 1;
|
||||
@@ -3862,7 +3862,7 @@ static void* state_verify_thread(void* arg)
|
||||
|
||||
if (sdeplete(f, buf) != 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Error flushing the content file '%s'. %s.\n", serrorfile(f), strerror(errno));
|
||||
log_fatal("Failed to flush content file '%s'. %s.\n", serrorfile(f), strerror(errno));
|
||||
return context;
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
@@ -4245,7 +4245,7 @@ void state_progress_end(struct snapraid_state* state, block_off_t countpos, bloc
|
||||
|
||||
elapsed = now - state->progress_whole_start - state->progress_wasted;
|
||||
|
||||
msg_bar("%u%% completed, %u MB accessed", countpos * 100 / countmax, countsize_MB);
|
||||
msg_bar("%u%% completed, %u MB accessed", muldiv(countpos, 100, countmax), countsize_MB);
|
||||
|
||||
msg_bar(" in %u:%02u", (unsigned)(elapsed / 3600), (unsigned)((elapsed % 3600) / 60));
|
||||
|
||||
@@ -4405,7 +4405,7 @@ static void state_progress_graph(struct snapraid_state* state, struct snapraid_i
|
||||
struct snapraid_disk* disk = i->data;
|
||||
v = disk->progress_tick[current] - ref(disk->progress_tick, oldest);
|
||||
printr(disk->name, pad);
|
||||
printf("%3" PRIu64 "%% | ", v * 100 / tick_total);
|
||||
printf("%3u%% | ", muldiv(v, 100, tick_total));
|
||||
printc('*', v * bar / tick_total);
|
||||
printf("\n");
|
||||
|
||||
@@ -4416,32 +4416,32 @@ static void state_progress_graph(struct snapraid_state* state, struct snapraid_i
|
||||
for (l = 0; l < state->level; ++l) {
|
||||
v = state->parity[l].progress_tick[current] - ref(state->parity[l].progress_tick, oldest);
|
||||
printr(lev_config_name(l), pad);
|
||||
printf("%3" PRIu64 "%% | ", v * 100 / tick_total);
|
||||
printf("%3u%% | ", muldiv(v, 100, tick_total));
|
||||
printc('*', v * bar / tick_total);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
v = state->progress_tick_raid[current] - ref(state->progress_tick_raid, oldest);
|
||||
printr("raid", pad);
|
||||
printf("%3" PRIu64 "%% | ", v * 100 / tick_total);
|
||||
printf("%3u%% | ", muldiv(v, 100, tick_total));
|
||||
printc('*', v * bar / tick_total);
|
||||
printf("\n");
|
||||
|
||||
v = state->progress_tick_hash[current] - ref(state->progress_tick_hash, oldest);
|
||||
printr("hash", pad);
|
||||
printf("%3" PRIu64 "%% | ", v * 100 / tick_total);
|
||||
printf("%3u%% | ", muldiv(v, 100, tick_total));
|
||||
printc('*', v * bar / tick_total);
|
||||
printf("\n");
|
||||
|
||||
v = state->progress_tick_sched[current] - ref(state->progress_tick_sched, oldest);
|
||||
printr("sched", pad);
|
||||
printf("%3" PRIu64 "%% | ", v * 100 / tick_total);
|
||||
printf("%3u%% | ", muldiv(v, 100, tick_total));
|
||||
printc('*', v * bar / tick_total);
|
||||
printf("\n");
|
||||
|
||||
v = state->progress_tick_misc[current] - ref(state->progress_tick_misc, oldest);
|
||||
printr("misc", pad);
|
||||
printf("%3" PRIu64 "%% | ", v * 100 / tick_total);
|
||||
printf("%3u%% | ", muldiv(v, 100, tick_total));
|
||||
printc('*', v * bar / tick_total);
|
||||
printf("\n");
|
||||
|
||||
@@ -4499,7 +4499,7 @@ int state_progress(struct snapraid_state* state, struct snapraid_io* io, block_o
|
||||
|
||||
/* completion percentage */
|
||||
if (countmax)
|
||||
out_perc = countpos * 100 / countmax;
|
||||
out_perc = muldiv(countpos, 100, countmax);
|
||||
|
||||
/* if we have at least 5 measures */
|
||||
if (state->progress_tick >= 5
|
||||
@@ -4565,11 +4565,11 @@ int state_progress(struct snapraid_state* state, struct snapraid_io* io, block_o
|
||||
|
||||
/* estimate the cpu usage percentage */
|
||||
if (delta_tick_total != 0)
|
||||
out_cpu = (unsigned)(delta_tick_cpu * 100U / delta_tick_total);
|
||||
out_cpu = muldiv(delta_tick_cpu, 100, delta_tick_total);
|
||||
|
||||
/* estimate the remaining time in minutes */
|
||||
if (delta_pos != 0)
|
||||
out_eta = (countmax - countpos) * delta_time / (60 * delta_pos);
|
||||
out_eta = muldiv(countmax - countpos, delta_time, 60 * delta_pos);
|
||||
|
||||
if (state->opt.force_stats) {
|
||||
os_clear();
|
||||
@@ -4734,7 +4734,7 @@ void state_fscheck(struct snapraid_state* state, const char* ope)
|
||||
|
||||
if (fs_check(disk) != 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Internal inconsistency in file-system for disk '%s' %s\n", disk->name, ope);
|
||||
log_fatal("Internal inconsistency: File-system check for disk '%s' %s\n", disk->name, ope);
|
||||
os_abort();
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
@@ -39,14 +39,6 @@ unsigned day_ago(time_t ref, time_t now)
|
||||
#define GRAPH_COLUMN 70
|
||||
#define GRAPH_ROW 15
|
||||
|
||||
static unsigned perc(uint64_t part, uint64_t total)
|
||||
{
|
||||
if (!total)
|
||||
return 0;
|
||||
|
||||
return (unsigned)(part * 100 / total);
|
||||
}
|
||||
|
||||
/**
|
||||
* Bit used to mark unscrubbed time info.
|
||||
*/
|
||||
@@ -239,7 +231,7 @@ int state_status(struct snapraid_state* state)
|
||||
printf(" - ");
|
||||
} else {
|
||||
printf("%8" PRIu64, (disk_block_max - disk_block_count) * (uint64_t)state->block_size / GIGA);
|
||||
printf(" %3u%%", perc(disk_block_count, disk_block_max));
|
||||
printf(" %3u%%", muldiv(disk_block_count, 100, disk_block_max));
|
||||
}
|
||||
printf(" %s\n", disk->name);
|
||||
|
||||
@@ -266,7 +258,7 @@ int state_status(struct snapraid_state* state)
|
||||
printf("%8.1f", (double)all_wasted / GIGA);
|
||||
printf("%8" PRIu64, file_size / GIGA);
|
||||
printf("%8" PRIu64, file_block_free * state->block_size / GIGA);
|
||||
printf(" %3u%%", perc(file_block_count, file_block_count + file_block_free));
|
||||
printf(" %3u%%", muldiv(file_block_count, 100, file_block_count + file_block_free));
|
||||
printf("\n");
|
||||
|
||||
/* warn about invalid data free info */
|
||||
@@ -468,26 +460,26 @@ int state_status(struct snapraid_state* state)
|
||||
|
||||
if (unsynced_blocks) {
|
||||
printf("WARNING! The array is NOT fully synced.\n");
|
||||
printf("You have a sync in progress at %u%%.\n", (blockmax - unsynced_blocks) * 100 / blockmax);
|
||||
printf("You have a sync in progress at %u%%.\n", muldiv(blockmax - unsynced_blocks, 100, blockmax));
|
||||
} else {
|
||||
printf("No sync is in progress.\n");
|
||||
}
|
||||
|
||||
if (unscrubbed_blocks) {
|
||||
printf("The %u%% of the array is not scrubbed.\n", (unscrubbed_blocks * 100 + blockmax - 1) / blockmax);
|
||||
printf("%u%% of the array is not scrubbed.\n", muldiv_upper(unscrubbed_blocks, 100, blockmax));
|
||||
} else {
|
||||
printf("The full array was scrubbed at least one time.\n");
|
||||
}
|
||||
|
||||
if (file_zerosubsecond) {
|
||||
printf("You have %u files with zero sub-second timestamp.\n", file_zerosubsecond);
|
||||
printf("Run the 'touch' command to set it to a not zero value.\n");
|
||||
printf("You have %u files with a zero sub-second timestamp.\n", file_zerosubsecond);
|
||||
printf("Run 'snapraid touch' to set their sub-second timestamps to a non-zero value.\n");
|
||||
} else {
|
||||
printf("No file has a zero sub-second timestamp.\n");
|
||||
}
|
||||
|
||||
if (rehash) {
|
||||
printf("You have a rehash in progress at %u%%.\n", (count - rehash) * 100 / count);
|
||||
printf("You have a rehash in progress at %u%%.\n", muldiv(count - rehash, 100, count));
|
||||
} else {
|
||||
if (state->besthash != state->hash) {
|
||||
printf("No rehash is in progress, but for optimal performance one is recommended.\n");
|
||||
|
||||
@@ -426,7 +426,7 @@ const char* esc_tag(const char* str, char* buffer)
|
||||
|
||||
bail:
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Escape for log too long\n");
|
||||
log_fatal("Escape for log is too long\n");
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
@@ -587,7 +587,7 @@ const char* esc_shell_multi(const char** str_map, unsigned str_max, char* buffer
|
||||
|
||||
bail:
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Escape for shell too long\n");
|
||||
log_fatal("Escape for shell is too long\n");
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
@@ -1456,7 +1456,7 @@ int state_sync(struct snapraid_state* state, block_off_t blockstart, block_off_t
|
||||
|
||||
if (blockstart > blockmax) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Error in the starting block %u. It's bigger than the parity size %u.\n", blockstart, blockmax);
|
||||
log_fatal("Error in the starting block %u. It is larger than the parity size %u.\n", blockstart, blockmax);
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
@@ -1485,7 +1485,7 @@ int state_sync(struct snapraid_state* state, block_off_t blockstart, block_off_t
|
||||
|
||||
/* if the file is too small */
|
||||
if (parityblocks < used_paritymax) {
|
||||
log_fatal("WARNING! The %s parity has data only %u blocks instead of %u.\n", lev_name(l), parityblocks, used_paritymax);
|
||||
log_fatal("WARNING! The %s parity has only %u blocks instead of %u.\n", lev_name(l), parityblocks, used_paritymax);
|
||||
}
|
||||
|
||||
/* keep the smallest parity number of blocks */
|
||||
|
||||
@@ -58,7 +58,7 @@ void state_touch(struct snapraid_state* state)
|
||||
/* get a random nanosecond value */
|
||||
if (randomize(&nano, sizeof(nano)) != 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Failed to get random values.\n");
|
||||
log_fatal("Failed to retrieve random values.\n");
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
@@ -672,3 +672,22 @@ int lock_unlock(int f)
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************/
|
||||
/* muldiv */
|
||||
|
||||
unsigned muldiv(uint64_t v, uint64_t mul, uint64_t div)
|
||||
{
|
||||
if (!div)
|
||||
return 0;
|
||||
|
||||
return (uint32_t)(v * mul / div);
|
||||
}
|
||||
|
||||
unsigned muldiv_upper(uint64_t v, uint64_t mul, uint64_t div)
|
||||
{
|
||||
if (!div)
|
||||
return 0;
|
||||
|
||||
return (uint32_t)((v * mul + div - 1) / div);
|
||||
}
|
||||
|
||||
|
||||
@@ -251,5 +251,10 @@ static inline int bit_vect_test(bit_vect_t* bit_vect, size_t off)
|
||||
return (bit_vect[off / BIT_VECT_SIZE] & mask) != 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
/****************************************************************************/
|
||||
/* muldiv */
|
||||
|
||||
unsigned muldiv(uint64_t v, uint64_t mul, uint64_t div);
|
||||
unsigned muldiv_upper(uint64_t v, uint64_t mul, uint64_t div);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user