Fix typos

This commit is contained in:
Andrea Mazzoleni 2026-01-17 21:16:21 +01:00
parent a7d6db1d5c
commit e80734fc4c
11 changed files with 50 additions and 49 deletions

View file

@ -42,13 +42,13 @@ struct failed_struct {
int is_bad;
/**
* If that we have recovered may be not updated data,
* If what we have recovered may be not updated data,
* an old version, or just garbage.
*
* Essentially, it means that we are not sure what we have recovered
* is really correct. It's just our best guess.
*
* These "recovered" block are also written to the disk if the block is marked as ::is_bad.
* These "recovered" blocks are also written to the disk if the block is marked as ::is_bad.
* But these files are marked also as FILE_IS_DAMAGED, and then renamed to .unrecoverable.
*
* Note that this could happen only for CHG blocks.
@ -94,7 +94,7 @@ static int blockcmp(struct snapraid_state* state, int rehash, struct snapraid_bl
}
/**
* Check if the hash of all the failed block we are expecting to recover are now matching.
* Check if the hash of all the failed blocks we are expecting to recover are now matching.
*/
static int is_hash_matching(struct snapraid_state* state, int rehash, unsigned diskmax, struct failed_struct* failed, unsigned* failed_map, unsigned failed_count, void** buffer, void* buffer_zero)
{
@ -157,7 +157,7 @@ static int is_parity_matching(struct snapraid_state* state, unsigned diskmax, un
/**
* Repair errors.
* Return <0 if failure for missing strategy, >0 if data is wrong and we cannot rebuild correctly, 0 on success.
* If success, the parity are computed in the buffer variable.
* If success, the parity is computed in the buffer variable.
*/
static int repair_step(struct snapraid_state* state, int rehash, unsigned pos, unsigned diskmax, struct failed_struct* failed, unsigned* failed_map, unsigned failed_count, void** buffer, void** buffer_recov, void* buffer_zero)
{
@ -238,7 +238,7 @@ static int repair_step(struct snapraid_state* state, int rehash, unsigned pos, u
/* if we have a hash, and enough parities */
/* (less-or-equal failures than number of parities) */
if (has_hash && failed_count <= n) {
/* number of parities to use equal at the number of failures */
/* number of parities to use equal to the number of failures */
unsigned r = failed_count;
/* all combinations (r of n) parities */
@ -483,9 +483,9 @@ static int repair(struct snapraid_state* state, int rehash, unsigned pos, unsign
) {
/* If the block is CHG, REP or DELETED, we don't have the original content of block, */
/* and we must try to recover it. */
/* This apply to CHG and REP blocks even if they are not marked bad, */
/* This applies to CHG and REP blocks even if they are not marked bad, */
/* because the parity is computed with old content, and not with the new one. */
/* Note that this recovering is done just to make possible to recover any other BLK one, */
/* Note that this recovering is done just to make it possible to recover any other BLK one, */
/* we are not really interested in DELETED, CHG (old version) and REP (old version). */
something_unsynced = 1;
@ -496,7 +496,7 @@ static int repair(struct snapraid_state* state, int rehash, unsigned pos, unsign
/* We do this to just allow recovering of other BLK ones */
memset(buffer[failed[j].index], 0, state->block_size);
/* note that from now the buffer is definitively lost */
/* note that from now the buffer is definitely lost */
/* we can do this only because it's the last retry of recovering */
/* try to fetch the old block using the old hash for CHG and DELETED blocks */
@ -504,7 +504,7 @@ static int repair(struct snapraid_state* state, int rehash, unsigned pos, unsign
&& hash_is_unique(failed[j].block->hash)
&& state_import_fetch(state, rehash, failed[j].block, buffer[failed[j].index]) == 0) {
/* note that from now the buffer is definitively lost */
/* note that from now the buffer is definitely lost */
/* we can do this only because it's the last retry of recovering */
} else {
/* otherwise try to recover it */
@ -515,9 +515,9 @@ static int repair(struct snapraid_state* state, int rehash, unsigned pos, unsign
/* not really interested to recover *only* old blocks. */
}
/* avoid to use the hash of this block to verify the recovering */
/* avoid using the hash of this block to verify the recovering */
/* this applies to REP blocks because we are going to recover the old state */
/* and the REP hash represent the new one */
/* and the REP hash represents the new one */
/* it also applies to CHG and DELETE blocks because we want to have */
/* a successful recovering only if a BLK one is matching */
failed[j].is_outofdate = 1;
@ -541,7 +541,7 @@ static int repair(struct snapraid_state* state, int rehash, unsigned pos, unsign
if (something_to_recover && something_unsynced) {
ret = repair_step(state, rehash, pos, diskmax, failed, failed_map, n, buffer, buffer_recov, buffer_zero);
if (ret == 0) {
/* reprocess the REP and CHG blocks, for which we have recovered and old state */
/* reprocess the REP and CHG blocks, for which we have recovered an old state */
/* that we don't want to save into disk */
/* we have already marked them, but we redo it for logging */
@ -587,7 +587,7 @@ static int repair(struct snapraid_state* state, int rehash, unsigned pos, unsign
/**
* Post process all the files at the specified block index ::i.
* For each file, if we are at the last block, closes it,
* For each file, if we are at the last block, close it,
* adjust the timestamp, and print the result.
*
* This works only if the whole file is processed, including its last block.
@ -603,7 +603,7 @@ static int file_post(struct snapraid_state* state, int fix, unsigned i, struct s
char esc_buffer[ESC_MAX];
char esc_buffer_alt[ESC_MAX];
/* for all the files print the final status, and does the final time fix */
/* for all the files print the final status, and do the final time fix */
/* we also ensure to close files after processing the last block */
for (j = 0; j < diskmax; ++j) {
struct snapraid_block* block;
@ -722,7 +722,7 @@ static int file_post(struct snapraid_state* state, int fix, unsigned i, struct s
/* search for the corresponding inode */
collide_file = tommy_hashdyn_search(&disk->inodeset, file_inode_compare_to_arg, &inode, file_inode_hash(inode));
/* if the inode is already in the database and it refers at a different file name, */
/* if the inode is already in the database and it refers to a different file name, */
/* we can fix the file time ONLY if the time and size allow to differentiate */
/* between the two files */
@ -778,7 +778,7 @@ close_and_continue:
/* that the opened file is not the current one */
if (handle[j].file == file) {
/* ensure to close the file just after finishing with it */
/* to avoid to keep it open without any possible use */
/* to avoid keeping it open without any possible use */
ret = handle_close(&handle[j]);
if (ret != 0) {
/* LCOV_EXCL_START */
@ -892,7 +892,7 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna
handle = handle_mapping(state, &diskmax);
/* initialize the bandwith context */
/* initialize the bandwidth context */
bw_init(&bw, state->opt.bwlimit);
/* share the bandwidth context with all handles */

View file

@ -45,15 +45,15 @@ void device_name_set(devinfo_t* dev, const char* name, int index)
* - Disks that are predicted to fail by BackBlaze are removed before
* they really fail, not counting as a failure.
*
* The following tables are computed using the data from 2014-02-14 to 2014-12-31
* because it's the period when more SMART attributes were gathered.
* The following tables are computed using the data from 2014-02-14 to
* 2014-12-31 because it's the period when more SMART attributes were gathered.
*
* In this period there are 47322 disk seen, with 1988 removed because failed,
* In this period there are 47322 disks seen, with 1988 removed because failed,
* and with 4121 removed because predicted to fail.
*/
/**
* Number of data point in each table.
* Number of data points in each table.
*/
#define SMART_MEASURES 256
@ -421,7 +421,7 @@ static double smart_afr(uint64_t* smart, const char* model)
}
if (smart[187] != SMART_UNASSIGNED) {
/* with some disks, only the lower 16 bits are significative */
/* with some disks, only the lower 16 bits are significant */
/* See: http://web.archive.org/web/20130507072056/http://media.kingston.com/support/downloads/MKP_306_SMART_attribute.pdf */
double r = smart_afr_value(SMART_187_R, SMART_187_STEP, smart[187] & mask16);
if (afr < r)
@ -433,7 +433,7 @@ static double smart_afr(uint64_t* smart, const char* model)
* Don't check Command_Timeout (188) for Seagate disks.
*
* It's reported by users that for Archive SMR (Shingled Magnetic Recording)
* and IronWolf disks to be a not significative test as
* and IronWolf disks to be a not significant test as
* this value increases too often also on sane disks.
*/
strncmp(model, "ST", 2) != 0 && smart[188] != SMART_UNASSIGNED
@ -862,7 +862,7 @@ static void state_stat(struct snapraid_state* state, tommy_list* high)
for (i = tommy_list_head(high); i != 0; i = i->next) {
devinfo_t* devinfo = i->data;
/* print disk access_stat (not splitted) */
/* print disk access_stat (not split) */
if (devinfo->split == 0 && devinfo->access_stat != 0) {
log_tag("stat:%s:%" PRIu64 "\n", devinfo->name, devinfo->access_stat);
}

View file

@ -270,7 +270,7 @@ static int state_dry_process(struct snapraid_state* state, struct snapraid_parit
++io_error;
if (io_error >= state->opt.io_error_limit) {
/* LCOV_EXCL_START */
log_fatal("DANGER! Too many input/output read error in a data disk, it isn't possible to scrub.\n");
log_fatal("DANGER! Too many input/output read errors in a data disk, it isn't possible to scrub.\n");
log_fatal("Ensure that disk '%s' is sane and that file '%s' can be accessed.\n", disk->dir, task->path);
log_fatal("Stopping at block %u\n", blockcur);
goto bail;
@ -324,7 +324,7 @@ static int state_dry_process(struct snapraid_state* state, struct snapraid_parit
++io_error;
if (io_error >= state->opt.io_error_limit) {
/* LCOV_EXCL_START */
log_fatal("DANGER! Too many input/output read error in the %s disk, it isn't possible to scrub.\n", lev_name(levcur));
log_fatal("DANGER! Too many input/output read errors in the %s disk, it isn't possible to scrub.\n", lev_name(levcur));
log_fatal("Ensure that disk '%s' is sane and can be read.\n", lev_config_name(levcur));
log_fatal("Stopping at block %u\n", blockcur);
goto bail;

View file

@ -90,7 +90,8 @@ struct snapraid_filter {
/**
* The block is new and not yet hashed.
* This happens when a new block overwrite a just removed block, or an empty space.
* This happens when a new block overwrites a just removed block, or an empty
* space.
*
* The block hash field MAY be set and it represents the hash of the OLD data.
* The hash may be also INVALID or ZERO.
@ -100,7 +101,7 @@ struct snapraid_filter {
*
* The parity for this disk is not updated, but it contains the old data referenced by the hash.
*
* If the state is read from an incomplete sync, we don't really know if the hash is referring at the
* If the state is read from an incomplete sync, we don't really know if the hash is referring to the
* data used to compute the parity, because the sync process was interrupted at an unknown point,
* and the parity may or may not be updated.
*
@ -115,7 +116,7 @@ struct snapraid_filter {
/**
* The block is new and hashed.
* This happens when a new block overwrite a just removed block, or an empty space.
* This happens when a new block overwrites a just removed block, or an empty space.
*
* Note that when the file copy heuristic is enabled, the REP blocks may be set
* using this heuristic, meaning that the hash may be wrong.
@ -139,11 +140,11 @@ struct snapraid_filter {
* but only if it's different by all 0.
* The parity for this disk is not updated, but it contains the old data referenced by the hash.
*
* If the state is read from an incomplete sync, we don't really know if the hash is referring at the
* If the state is read from an incomplete sync, we don't really know if the hash is referring to the
* data used to compute the parity, because the sync process was interrupted at an unknown point,
* and the parity may or may not be updated.
*
* A now the sync process is not affected by DELETED hash, so clearing won't be really needed,
* As now the sync process is not affected by DELETED hash, so clearing won't be really needed,
* but considering that we have to do it for CHG blocks, we do it also for DELETED ones,
* clearing all the past hashes.
* Clearing is done setting the ::clear_past_hash flag before reading the state.
@ -228,13 +229,13 @@ struct snapraid_block {
/**
* If the file is modified from the latest sync.
* It's used in fix to store if the state of the file before being modified.
* It's used in fix to store the state of the file before being modified.
*/
#define FILE_IS_UNSYNCED 0x100
/**
* If the file is without inode.
* It could happen in file-system where inodes are not persistent,
* It could happen in file-systems where inodes are not persistent,
* or when restoring a full disk with "fix".
* In such cases we have to clear any stored duplicate inode.
* After the scan process completes, no file should have this flag set.

View file

@ -57,7 +57,7 @@ int handle_create(struct snapraid_handle* handle, struct snapraid_file* file, in
/* if failed for missing write permission */
if (handle->f == -1 && (errno == EACCES || errno == EROFS)) {
/* open for real-only */
/* open for read-only */
handle->f = open(handle->path, flags | O_RDONLY);
}

View file

@ -112,7 +112,7 @@ struct snapraid_worker {
/**
* The task in progress by the worker thread.
*
* It's an index inside in the ::task_map vector.
* It's an index inside the ::task_map vector.
*/
unsigned index;
@ -129,12 +129,12 @@ struct snapraid_worker {
#define IO_WRITER_ERROR_MAX (-IO_WRITER_ERROR_BASE)
/**
* IO system that handle all parallel reads and writes.
* IO system that handles all parallel reads and writes.
*
* This represents the pool of worker threads dedicated to read and write
* data from the disks.
*
* Typycal scenario is:
* Typical scenario is:
*
* # Initialize the process
* io_start(&io, blockstart, blockmax, block_enabled);
@ -152,7 +152,7 @@ struct snapraid_worker {
*
* for_each_disk {
* # Read a disk into buffer[diskcur]
* # diskcur is the disk processed, and it may came in random order
* # diskcur is the disk processed, and it may come in random order
* # depending on which disk is faster
* #
* # INTERNAL: It may wait for the read_done condition in case
@ -177,7 +177,7 @@ struct snapraid_worker {
* unsigned levcur;
*
* # Write a parity from buffer[diskmax+levcur]
* # levcur is the disk processed, and it may came in random order
* # levcur is the disk processed, and it may come in random order
* # depending on which disk is faster
* #
* # INTERNAL: It may wait for the write_done condition in case
@ -327,7 +327,7 @@ struct snapraid_io {
* it goes again to 0.
*
* When the caller finish with this index, it calls read_sched(),
* and this ::reader_index is increamended, meaning that the data of
* and this ::reader_index is incremented, meaning that the data of
* the just finished index is not needed anymore and the buffer is
* available to be used for the following read-ahead.
*
@ -352,7 +352,7 @@ struct snapraid_io {
*
* When the caller finish writing the data in the buffer for this
* index, it calls write_sched() and ::writer_index is incremented,
* meaning the the just finished index is scheduled to be written
* meaning that the just finished index is scheduled to be written
* to disk.
*
* When this happens a write_sched signal is broadcasted, and all the

View file

@ -860,7 +860,7 @@ void selftest(void)
log_tag("selftest:\n");
log_flush();
msg_progress("Self test...\n");
msg_progress("Self-test...\n");
/* large file check */
if (sizeof(off_t) < sizeof(uint64_t)) {

View file

@ -4454,7 +4454,7 @@ int state_progress_begin(struct snapraid_state* state, block_off_t blockstart, b
if (global_interrupt) {
/* LCOV_EXCL_START */
if (!state->opt.gui) {
msg_status("Not starting for interruption\n");
msg_status("Not starting due to interruption\n");
}
log_tag("sigint:0: SIGINT received\n");
log_flush();

View file

@ -619,7 +619,7 @@ static void sync_data_reader(struct snapraid_worker* worker, struct snapraid_tas
/* LCOV_EXCL_START */
if (errno == EIO) {
log_tag("error_io:%u:%s:%s: Read EIO error at position %u. %s\n", blockcur, disk->name, esc_tag(task->file->sub, esc_buffer), task->file_pos, strerror(errno));
log_fatal("DANGER! Unexpected input/output open error in a data disk, it isn't possible to sync.\n");
log_fatal("DANGER! Unexpected input/output read error in a data disk, it isn't possible to sync.\n");
log_error("Input/Output error in file '%s' at position '%u'\n", handle->path, task->file_pos);
task->state = TASK_STATE_IOERROR_CONTINUE;
return;

View file

@ -376,7 +376,7 @@ int state_thermal_begin(struct snapraid_state* state, time_t now)
if (state->thermal_temperature_limit != 0 && state->thermal_temperature_limit <= state->thermal_ambient_temperature) {
/* LCOV_EXCL_START */
log_fatal("DANGER! System temperature of %d degrees is higher than the temperature limit of %d degrees. Unable to proceeed!\n", state->thermal_ambient_temperature, state->thermal_temperature_limit);
log_fatal("DANGER! System temperature of %d degrees is higher than the temperature limit of %d degrees. Unable to proceed!\n", state->thermal_ambient_temperature, state->thermal_temperature_limit);
log_flush();
return 0;
/* LCOV_EXCL_STOP */
@ -385,7 +385,7 @@ int state_thermal_begin(struct snapraid_state* state, time_t now)
if (state_thermal_alarm(state)) {
/* LCOV_EXCL_START */
log_fatal("DANGER! Hard disk temperature of %d degrees is already outside the operating range. Unable to proceeed!\n", state->thermal_highest_temperature);
log_fatal("DANGER! Hard disk temperature of %d degrees is already outside the operating range. Unable to proceed!\n", state->thermal_highest_temperature);
log_flush();
return 0;
/* LCOV_EXCL_STOP */

View file

@ -12,7 +12,7 @@
* GNU General Public License for more details.
*/
/* Self sanity test for the RAID library */
/* Self-test for the RAID library */
#include "internal.h"
#include "cpu.h"
@ -22,11 +22,11 @@
int main(void)
{
printf("Self sanity test for the RAID Cauchy library\n\n");
printf("Self-test for the RAID Cauchy library\n\n");
raid_init();
printf("Self test...\n");
printf("Self-test...\n");
if (raid_selftest() != 0) {
/* LCOV_EXCL_START */
printf("FAILED!\n");