|
Basic Solution File System - BSFS
|
On-demand garbage collection for Recovery entries in BSFS. More...
Classes | |
| struct | rec_item_t |
| Internal item wrapper used during Recovery GC traversals. More... | |
Functions | |
| size_t | rec_gc_purge_until (FILE *disk, superblock_t *sb, uint32_t needed_blocks, uint64_t now) |
| Purge Recovery entries until at least a target number of blocks are freed. | |
On-demand garbage collection for Recovery entries in BSFS.
Implements routines to purge recovery entries in order to free disk space when allocations fail. The GC prefers removing expired entries first; if still insufficient, it removes the oldest non-expired entries until the requested number of blocks is freed.
| size_t rec_gc_purge_until | ( | FILE * | disk, |
| superblock_t * | sb, | ||
| uint32_t | needed_blocks, | ||
| uint64_t | now ) |
Purge Recovery entries until at least a target number of blocks are freed.
Attempts to reclaim space by first removing expired entries (those with retention_until <= now). If that is insufficient, continues by removing the oldest remaining entries (ascending deleted_at) until at least needed_blocks have been freed or there are no more entries.
For each purged entry, this routine deallocates blocks described by its 16 direct spans and, if present, traverses the per-file bspan B-tree to deallocate the remaining spans. Finally, it removes the metadata entry from the Recovery B-tree.
| disk | Open filesystem image. |
| sb | Loaded superblock (used for bitmap updates and recovery root). |
| needed_blocks | Minimum number of blocks to free. |
| now | Current timestamp used for retention checks. |