Comment about extends shrinking directly in the tree

This commit is contained in:
Andrea Mazzoleni 2026-05-21 13:13:56 +02:00
parent 492ad40f2c
commit 4c8aa12ab1

View file

@ -1371,6 +1371,12 @@ void fs_deallocate(struct snapraid_disk* disk, block_off_t parity_pos)
/* if it's at the start of the extent, shrink the extent */
if (parity_pos == extent->parity_pos) {
/*
* Note that modifying parity_pos and file_pos in-place is safe
* because extents never overlap. Shrinking the start of the extent
* keeps the relative sorted order of all nodes completely unchanged,
* preserving the tree invariants without delete/insert overhead.
*/
++extent->parity_pos;
++extent->file_pos;
--extent->count;