mirror of
https://github.com/amadvance/snapraid.git
synced 2026-12-03 13:20:28 -05:00
Document fs_allocate behavior, performance rationale, and invariant checks
This commit is contained in:
parent
30f78a4190
commit
4f286a2faa
1 changed files with 13 additions and 0 deletions
|
|
@ -1414,6 +1414,19 @@ block_off_t fs_file2par_find(struct snapraid_disk* disk, struct snapraid_file* f
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allocate a file block mapping it to a parity position.
|
||||||
|
*
|
||||||
|
* If the block is contiguous with the previous block of the file and follows
|
||||||
|
* the current extent in parity space, the existing extent is extended in-place.
|
||||||
|
* Otherwise, a new extent is created and inserted into the parity and file trees.
|
||||||
|
*
|
||||||
|
* Callers ensure allocations are sequential and do not overwrite live blocks.
|
||||||
|
* To keep per-block allocation fast, full overlap checks across all existing
|
||||||
|
* extents are omitted here; global non-overlap and complete coverage invariants
|
||||||
|
* are verified in batch by fs_check() at major checkpoints (after read/scan,
|
||||||
|
* before write).
|
||||||
|
*/
|
||||||
void fs_allocate(struct snapraid_disk* disk, block_off_t parity_pos, struct snapraid_file* file, block_off_t file_pos)
|
void fs_allocate(struct snapraid_disk* disk, block_off_t parity_pos, struct snapraid_file* file, block_off_t file_pos)
|
||||||
{
|
{
|
||||||
struct snapraid_extent* extent;
|
struct snapraid_extent* extent;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue