Fix an invalid assumption about allocated parity

In the copy detection it's possible to need to
copy from a file wihout parity. This could result
in the parity position not found.
This commit is contained in:
Andrea Mazzoleni 2016-01-15 19:50:21 +01:00
parent 2f5c6a39a9
commit 56bef0d90f
4 changed files with 47 additions and 29 deletions

View file

@ -1160,12 +1160,8 @@ block_off_t fs_file2par_get_ts(struct snapraid_disk* disk, struct snapraid_chunk
struct snapraid_chunk* chunk;
chunk = fs_file2chunk_get_ts(disk, fs_last, file, file_pos);
if (!chunk) {
/* 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 */
}
if (!chunk)
return POS_INVALID;
return chunk->parity_pos + (file_pos - chunk->file_pos);
}