Skip to content

Composefs GC changes#2206

Open
Johan-Liebert1 wants to merge 2 commits into
bootc-dev:mainfrom
Johan-Liebert1:finalize-gc
Open

Composefs GC changes#2206
Johan-Liebert1 wants to merge 2 commits into
bootc-dev:mainfrom
Johan-Liebert1:finalize-gc

Conversation

@Johan-Liebert1
Copy link
Copy Markdown
Collaborator

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

@Johan-Liebert1 Johan-Liebert1 requested a review from cgwalters May 21, 2026 06:22
@Johan-Liebert1 Johan-Liebert1 added the ci/tier-1 Run CI for tier-1 OS (centos-10) only label May 21, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread tmt/tests/booted/test-composefs-gc.nu Outdated
Comment thread crates/lib/src/cli.rs Outdated
Comment thread tmt/tests/booted/test-composefs-gc.nu Outdated
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>
Copy link
Copy Markdown
Contributor

@travier travier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
storage: &Storage,
booted_cfs: &BootedComposefs,
dry_run: bool,
prune_repo: bool,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two boolean arguments is ugly and confusing. Let's have a single enum GcMode.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or probably dry_run: bool with enum GcDepth or so.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eh it's fine we can just do this type of style fixup after too!

@cgwalters cgwalters enabled auto-merge May 21, 2026 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci/tier-1 Run CI for tier-1 OS (centos-10) only

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants