Skip to content

[btrfs] add btrfs-specific bdi/read_ahead_kb#2156

Merged
k8s-ci-robot merged 1 commit into
kubernetes-sigs:masterfrom
motiejus:btrfs-read_ahead_kb
Sep 2, 2025
Merged

[btrfs] add btrfs-specific bdi/read_ahead_kb#2156
k8s-ci-robot merged 1 commit into
kubernetes-sigs:masterfrom
motiejus:btrfs-read_ahead_kb

Conversation

@motiejus
Copy link
Copy Markdown
Contributor

@motiejus motiejus commented Aug 30, 2025

Add a knob for the btrfs-specific bdi/read_ahead_kb. AFAIK this value is the upper limit of the btrfs read-ahead of the underlying file.

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:

Confusingly, this option is not related to /sys/block/sdX/queue/read_ahead_kb, which is what controls the read-ahead of the block device (regardless of what's in there). The current read_ahead_kb "special" mount option configures the value of the block device.

The default bdi/read_ahead_kb is 4MiB (on all the systems I've checked). Ext4 does not have this option and relies on the block-device specific readahead, which is 128KiB (again, on all the systems I've checked). After migrating to btrfs we have experienced a notable read amplification and tracked to this setting. Once we changed bdi/read_ahead_kb to 128, our IO utilization (and the properties of the underlying workload) became very similar to the one of ext4.

Which issue(s) this PR fixes:

Fixes #2155

Special notes for your reviewer:

Now that we have 3 btrfs-specific "special" mount options, I refactored the code and tests to make it less repetitive.

Does this PR introduce a user-facing change?:

add `btrfs-bdi-read_ahead_kb` to control btrfs-specific readahead.

@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 Aug 30, 2025
@k8s-ci-robot k8s-ci-robot requested review from tonyzhc and tyuchn August 30, 2025 17:49
@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 Aug 30, 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 Aug 30, 2025
Add a knob for the btrfs-specific `bdi/read_ahead_kb`. If my
understanding is correct, this value is the upper limit of the btrfs
read-ahead of the _underlying file_.

Confusingly, this option is not related to
`/sys/block/sdX/queue/read_ahead_kb`, which is what controls the
read-ahead of the block device (regardless of what's in there). The
current `read_ahead_kb` "special" mount option configures the value of
the block device.

The default `bdi/read_ahead_kb` is 4MiB (on all the systems I've
checked). Ext4 does not have this option and relies on the block-device
specific readahead, which is 128KiB (again, on all the systems I've
checked). After migrating to btrfs we have experienced a notable write
amplification and tracked to this setting. Once we changed
`bdi/read_ahead_kb` to 128, our IO utilization (and the properties of
the underlying workload) became very similar to the one of ext4.

Now that we have 3 btrfs-specific "special" mount options, I refactored
the code and tests to make it less repetitive.
@motiejus motiejus force-pushed the btrfs-read_ahead_kb branch from 2493129 to f6c8051 Compare August 30, 2025 17:50
@mattcary
Copy link
Copy Markdown
Contributor

mattcary commented Sep 2, 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 2, 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 2, 2025
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

@motiejus: The following tests 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 f6c8051 link false /test pull-gcp-compute-persistent-disk-csi-driver-e2e-arm
pull-gcp-compute-persistent-disk-csi-driver-e2e-windows-2022 f6c8051 link false /test pull-gcp-compute-persistent-disk-csi-driver-e2e-windows-2022

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 da59cfb into kubernetes-sigs:master Sep 2, 2025
7 of 10 checks passed
@motiejus motiejus deleted the btrfs-read_ahead_kb branch September 3, 2025 11:58
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. needs-ok-to-test Indicates a PR that requires an org member to verify it 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 bdi/read_ahead_kb

3 participants