mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-26 19:01:57 -04:00
Keep different the functions that may not find the parity
This commit is contained in:
parent
3194ea653f
commit
eaa89473b4
3 changed files with 31 additions and 4 deletions
|
|
@ -1155,7 +1155,7 @@ struct snapraid_file* fs_par2file_get_ts(struct snapraid_disk* disk, struct snap
|
|||
return chunk->file;
|
||||
}
|
||||
|
||||
block_off_t fs_file2par_get_ts(struct snapraid_disk* disk, struct snapraid_chunk** fs_last, struct snapraid_file* file, block_off_t file_pos)
|
||||
block_off_t fs_file2par_maybe_ts(struct snapraid_disk* disk, struct snapraid_chunk** fs_last, struct snapraid_file* file, block_off_t file_pos)
|
||||
{
|
||||
struct snapraid_chunk* chunk;
|
||||
|
||||
|
|
|
|||
|
|
@ -937,13 +937,40 @@ static inline struct snapraid_file* fs_par2file_get(struct snapraid_disk* disk,
|
|||
/**
|
||||
* Like fs_file2par_get() but thread-safe.
|
||||
*/
|
||||
block_off_t fs_file2par_get_ts(struct snapraid_disk* disk, struct snapraid_chunk** fs_last, struct snapraid_file* file, block_off_t file_pos);
|
||||
block_off_t fs_file2par_maybe_ts(struct snapraid_disk* disk, struct snapraid_chunk** fs_last, struct snapraid_file* file, block_off_t file_pos);
|
||||
|
||||
/**
|
||||
* Get the parity position from the file position.
|
||||
* Return POS_INVALID if no parity is allocated.
|
||||
* \note This function is NOT thread-safe as it uses the the disk cache.
|
||||
*/
|
||||
static inline block_off_t fs_file2par_maybe(struct snapraid_disk* disk, struct snapraid_file* file, block_off_t file_pos)
|
||||
{
|
||||
return fs_file2par_maybe_ts(disk, &disk->fs_last, file, file_pos);
|
||||
}
|
||||
|
||||
/**
|
||||
* Like fs_file2par_get() but thread-safe.
|
||||
*/
|
||||
static inline block_off_t fs_file2par_get_ts(struct snapraid_disk* disk, struct snapraid_chunk** fs_last, struct snapraid_file* file, block_off_t file_pos)
|
||||
{
|
||||
block_off_t ret;
|
||||
|
||||
ret = fs_file2par_maybe_ts(disk, fs_last, file, file_pos);
|
||||
if (ret == POS_INVALID) {
|
||||
/* 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);
|
||||
os_abort();
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the parity position from the file position.
|
||||
* \note This function is NOT thread-safe as it uses the the disk cache.
|
||||
*/
|
||||
static inline block_off_t fs_file2par_get(struct snapraid_disk* disk, struct snapraid_file* file, block_off_t file_pos)
|
||||
{
|
||||
return fs_file2par_get_ts(disk, &disk->fs_last, file, file_pos);
|
||||
|
|
|
|||
|
|
@ -385,7 +385,7 @@ static int file_is_full_invalid_parity_and_stable(struct snapraid_state* state,
|
|||
*
|
||||
* Anyway, checking for POS_INVALID doesn't hurt.
|
||||
*/
|
||||
parity_pos = fs_file2par_get(disk, file, i);
|
||||
parity_pos = fs_file2par_maybe(disk, file, i);
|
||||
|
||||
/* if it's not mapped, it cannot have rehash */
|
||||
if (parity_pos != POS_INVALID) {
|
||||
|
|
@ -437,7 +437,7 @@ static int file_is_full_hashed_and_stable(struct snapraid_state* state, struct s
|
|||
* that such files are used as 'source' to copy
|
||||
* hashes, and then to get them inside this function.
|
||||
*/
|
||||
parity_pos = fs_file2par_get(disk, file, i);
|
||||
parity_pos = fs_file2par_maybe(disk, file, i);
|
||||
|
||||
/* if it's not mapped, it cannot have rehash */
|
||||
if (parity_pos != POS_INVALID) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue