|
Basic Solution File System - BSFS
|
Recovery garbage collection (GC) routines for BSFS. 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. | |
Recovery garbage collection (GC) routines for BSFS.
Provides on-demand purge functions that reclaim disk space occupied by recovery entries (snapshots of deleted files). These are intended to be invoked from allocation paths when the filesystem runs out of free blocks.
| 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. |