Composefs GC changes#2206
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a prune_repo parameter to the composefs_gc function, allowing for more granular control over garbage collection by separating the cleanup of bootloader entries from the pruning of the composefs repository. This change is integrated into the finalize, update, and delete workflows, and a corresponding flag has been added to the CLI. Additionally, the test suite was refactored to use bootc internals cfs dump-files for locating test files. Review feedback identified a missing parameter in a renamed test function that will cause failures, a missing comma in a match arm, and suggested clearer help text for the new CLI flag.
On finalize, after we are done atomically exchanging staged bootloader entries with the current one, run GC for bootloader binaries that are no longer referenced We only GC the bootloader binaries and we do not touch the composefs repository as that can turn out to be quite expensive. The repo will be pruned in the next update/switch Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
25a3a36 to
0667cbf
Compare
travier
left a comment
There was a problem hiding this comment.
Logic looks good. Not tested
Now that we immediately remove unreferenced bootloader binaries, update tests to test for the same Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
0667cbf to
2c1b0ca
Compare
| storage: &Storage, | ||
| booted_cfs: &BootedComposefs, | ||
| dry_run: bool, | ||
| prune_repo: bool, |
There was a problem hiding this comment.
Two boolean arguments is ugly and confusing. Let's have a single enum GcMode.
There was a problem hiding this comment.
Or probably dry_run: bool with enum GcDepth or so.
There was a problem hiding this comment.
Eh it's fine we can just do this type of style fixup after too!
composefs/gc: Run GC for BLS/UKI binaries on finalize
On finalize, after we are done atomically exchanging staged bootloader
entries with the current one, run GC for bootloader binaries that are
no longer referenced
We only GC the bootloader binaries and we do not touch the composefs
repository as that can turn out to be quite expensive. The repo will be
pruned in the next update/switch