Skip to content

[btrfs] support dynamic_reclaim#2164

Merged
k8s-ci-robot merged 5 commits intokubernetes-sigs:masterfrom
motiejus:dynamic-reclaim
Sep 9, 2025
Merged

[btrfs] support dynamic_reclaim#2164
k8s-ci-robot merged 5 commits intokubernetes-sigs:masterfrom
motiejus:dynamic-reclaim

Conversation

@motiejus
Copy link
Copy Markdown
Contributor

@motiejus motiejus commented Sep 4, 2025

What type of PR is this?

Uncomment only one /kind <> line, hit enter to put that in a new line, and remove leading whitespaces from that line:

/kind api-change
/kind bug
/kind cleanup
/kind design
/kind documentation
/kind failing-test

/kind feature

/kind flake

What this PR does / why we need it:

Currently btrfs offers 3 methods to balance the filesystem:

  1. beginning of time: btrfs filesystem balance.
  2. kernel v5.19+: /sys/fs/btrfs/UUID/allocation/{meta,}data/bg_reclaim_threshold.
  3. kernel v6.11+: /sys/fs/btrfs/UUID/allocation/{meta,}data/dynamic_reclaim.

(3) is most robust out of the 3, and best documented in the kernel commit f5ff64ccf7bb7274ed66b0d835b2f6ae10af5d7a. Once GKE rolls up to the kernel v6.11, this seems to be the best/recommended option to set.

Fixes #2163

Special notes for your reviewer:

So far we have landed all btrfs-specific options we use today. However, it's quite certain we will move from bg_reclaim_threshold to dynamic_reclaim when we catch up on the kernel.

Does this PR introduce a user-facing change?: yes.

add btrfs-specific option to control [`dynamic_reclaim`](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=f5ff64ccf7bb7274ed66b0d835b2f6ae10af5d7a).

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/feature Categorizes issue or PR as related to a new feature. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Sep 4, 2025
@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Sep 4, 2025
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

Hi @motiejus. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Sep 4, 2025
Currently btrfs offers 3 methods to balance the filesystem:

1. beginning of time: `btrfs filesystem balance`.
2. kernel v5.19+: `/sys/fs/btrfs/UUID/allocation/{meta,}data/bg_reclaim_threshold`.
3. kernel v6.11+: `/sys/fs/btrfs/UUID/allocation/{meta,}data/dynamic_reclaim`.

(3) is most robust out of the 3, and best documented in the kernel commit
[f5ff64ccf7bb7274ed66b0d835b2f6ae10af5d7a](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=f5ff64ccf7bb7274ed66b0d835b2f6ae10af5d7a).
Once GKE rolls up to the kernel v6.11, this will be the recommended
option to set.
Comment thread README.md Outdated
- `btrfs-data-bg_reclaim_threshold`: `/sys/fs/btrfs/FS-UUID/allocation/data/bg_reclaim_threshold`. Supported on Linux v5.19+.
- `btrfs-metadata-bg_reclaim_thresho: `/sys/fs/btrfs/FS-UUID/allocation/metadata/bg_reclaim_threshold`. Supported on Linux v5.19+.
- `btrfs-data-dynamic_reclaim`: `/sys/fs/btrfs/FS-UUID/allocation/data/dynamic_reclaim`. Supported on Linux v6.11+.
- `btrfs-metadata-bg_reclaim_thresho: `/sys/fs/btrfs/FS-UUID/allocation/metadata/bg_reclaim_threshold`. Supported on Linux v6.11+.
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.

typo "thresho"

Comment thread README.md Outdated
- `btrfs-data-bg_reclaim_threshold`: `/sys/fs/btrfs/FS-UUID/allocation/data/bg_reclaim_threshold`.
- `btrfs-metadata-bg_reclaim_thresho: `/sys/fs/btrfs/FS-UUID/allocation/metadata/bg_reclaim_threshold`.
- `btrfs-data-bg_reclaim_threshold`: `/sys/fs/btrfs/FS-UUID/allocation/data/bg_reclaim_threshold`. Supported on Linux v5.19+.
- `btrfs-metadata-bg_reclaim_thresho: `/sys/fs/btrfs/FS-UUID/allocation/metadata/bg_reclaim_threshold`. Supported on Linux v5.19+.
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.

typo "thresho"

Comment thread README.md Outdated

- `btrfs-data-bg_reclaim_threshold`: `/sys/fs/btrfs/FS-UUID/allocation/data/bg_reclaim_threshold`.
- `btrfs-metadata-bg_reclaim_thresho: `/sys/fs/btrfs/FS-UUID/allocation/metadata/bg_reclaim_threshold`.
- `btrfs-data-bg_reclaim_threshold`: `/sys/fs/btrfs/FS-UUID/allocation/data/bg_reclaim_threshold`. Supported on Linux v5.19+.
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.

Might be nice in these docs to put the values supported; eg it wasn't obvious to me that dynamic_reclaim took 0/1.

@motiejus
Copy link
Copy Markdown
Contributor Author

motiejus commented Sep 9, 2025

@mattcary upon closer inspection I found that I got the setting names wrong in the first place!

I converted it to a table now, added value ranges and a bit of explanation for each setting.

@mattcary
Copy link
Copy Markdown
Contributor

mattcary commented Sep 9, 2025

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Sep 9, 2025
@mattcary
Copy link
Copy Markdown
Contributor

mattcary commented Sep 9, 2025

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 9, 2025
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mattcary, motiejus

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 9, 2025
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

@motiejus: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-gcp-compute-persistent-disk-csi-driver-e2e-arm 427e119 link false /test pull-gcp-compute-persistent-disk-csi-driver-e2e-arm

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@k8s-ci-robot k8s-ci-robot merged commit 116e31a into kubernetes-sigs:master Sep 9, 2025
7 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

expose btrfs-specific allocation/{meta,}data/dynamic_reclaim

3 participants