mirror of
https://github.com/amadvance/snapraid.git
synced 2026-11-20 15:06:34 -05:00
Resolve file-to-parity mappings once per extent while writing content
This commit is contained in:
parent
69e3a845e4
commit
a1ff18fcbd
4 changed files with 82 additions and 7 deletions
|
|
@ -1475,7 +1475,7 @@ struct snapraid_file* fs_par2file_find(struct snapraid_disk* disk, block_off_t p
|
|||
return file;
|
||||
}
|
||||
|
||||
block_off_t fs_file2par_find(struct snapraid_disk* disk, struct snapraid_file* file, block_off_t file_pos)
|
||||
block_off_t fs_file2par_find_run(struct snapraid_disk* disk, struct snapraid_file* file, block_off_t file_pos, block_off_t* count)
|
||||
{
|
||||
struct snapraid_extent* extent;
|
||||
block_off_t ret;
|
||||
|
|
@ -1488,12 +1488,20 @@ block_off_t fs_file2par_find(struct snapraid_disk* disk, struct snapraid_file* f
|
|||
return POS_NULL;
|
||||
}
|
||||
|
||||
if (count)
|
||||
*count = extent->count - (file_pos - extent->file_pos);
|
||||
|
||||
ret = extent->parity_pos + (file_pos - extent->file_pos);
|
||||
|
||||
fs_unlock(disk);
|
||||
return ret;
|
||||
}
|
||||
|
||||
block_off_t fs_file2par_find(struct snapraid_disk* disk, struct snapraid_file* file, block_off_t file_pos)
|
||||
{
|
||||
return fs_file2par_find_run(disk, file, file_pos, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Allocate a run of file blocks mapping it to a run of parity positions.
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue