Skip to content

Mount btrfs volumes with space cache v2 on Fedora 41 and later - #67

Open
nabeya11 wants to merge 1 commit into
mainfrom
btrfs-space-cache-v2
Open

Mount btrfs volumes with space cache v2 on Fedora 41 and later#67
nabeya11 wants to merge 1 commit into
mainfrom
btrfs-space-cache-v2

Conversation

@nabeya11

Copy link
Copy Markdown
Member

Background

Filesystems created before btrfs-progs 5.15 enabled free-space-tree by default still use space cache v1, which kernel 6.11 and later report as deprecated on every mount. btrfs partitions are not recreated when the root partition is switched, so they survive OS updates.

Purpose

Convert them to space cache v2 (free space tree). Fresh installations already get v2 from mkfs.btrfs.

Implementation

Add space_cache=v2 to the btrfs --fsoptions through the new @@BTRFS_EXTRA_FSOPTIONS@@ placeholder. entrypoint.sh fills it in only for Fedora 41 and later, the first release shipping kernel 6.11.

Filesystems created before btrfs-progs 5.15 enabled free-space-tree by
default still use space cache v1, and kernel 6.11 warns that it is
deprecated on every mount. Since btrfs partitions are not recreated when
the root partition is switched, such filesystems survive OS updates and
need the mount option to be converted.

Fedora 41 is the first release shipping kernel 6.11, so older releases
keep the previous options.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The new Fedora-version conditional uses an unquoted numeric test on FEDORA_MAJOR, which can fail noisily or break execution under set -u if the variable is unset or non-numeric.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR updates the Fedora kickstart generation flow to add space_cache=v2 to btrfs mount options on Fedora 41+ (kernel 6.11+), avoiding deprecation warnings for space cache v1 and enabling conversion to free-space-tree on mount.

Changes:

  • Introduces a new @@BTRFS_EXTRA_FSOPTIONS@@ placeholder appended to btrfs --fsoptions in ks.tpl.cfg.
  • Populates that placeholder in entrypoint.sh with ,space_cache=v2 only when FEDORA_MAJOR >= 41.
File summaries
File Description
ks.tpl.cfg Appends a placeholder to btrfs --fsoptions so extra mount options can be conditionally injected.
entrypoint.sh Computes btrfs_extra_fsoptions for Fedora 41+ and adds a sed replacement for the new placeholder.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread entrypoint.sh
@nabeya11
nabeya11 requested a review from at-wat September 10, 2026 12:30
@nabeya11
nabeya11 marked this pull request as ready for review September 10, 2026 12:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants