You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
btrfs recalim on kernel v5.19+: use bg_reclaim_threshold
Add a sysfs knob `btrfs-allocation-{,meta}data-bg_reclaim_threshold`, which will do
the equivalent of:
```
echo VALUE > /sys/fs/btrfs/FS-UUID/allocation/data/bg_reclaim_threshold
```
Or, in case of metadata, equivalently:
```
echo VALUE > /sys/fs/btrfs/FS-UUID/allocation/metadata/bg_reclaim_threshold
```
Where VALUE is a number between `0` and `99` inclusive.
Adding it as a "special" mount option, similarly to `read_ahead_kb`, as
that's quite convenient.
Some resources about `bg_reclaim_threshold` and more broadly balancing
of the btrfs filesystem:
- https://btrfs.readthedocs.io/en/latest/Administration.html#uuid-allocations-data-metadata-system
- https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=18bb8bbf13c1839b43c9e09e76d397b753989af2
- https://lwn.net/Articles/978826/ Linux v6.11+, this may obsolete `bg_reclaim_threshold`.
Author's interpretation
-----------------------
The higher the reclaim threshold, the more accurately btrfs will show
unused space (`Device Unallocated` row of `btrfs filesystem usage`) at
the expense of sometimes needlessly moving data around. The lower the
threshold, the less rebalancing, the less accurate metrics of the
remaining space.
The author of this commit prefers more IO in order to see more accurate
`Device Unallocated` metrics, and therefore sets
`btrfs-allocation-data-bg_reclaim_threshold=90`.
Copy file name to clipboardExpand all lines: README.md
+7-1Lines changed: 7 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -96,7 +96,13 @@ Controller-level and node-level deployments will both have priorityClassName set
96
96
97
97
As noted in [GCP PD documentation](https://cloud.google.com/kubernetes-engine/docs/how-to/persistent-volumes/gce-pd-csi-driver), `ext4` and `xfs` are officially supported. `btrfs` support is experimental:
98
98
- As of writing, Ubuntu VM images support btrfs, but [COS does not](https://cloud.google.com/container-optimized-os/docs/concepts/supported-filesystems).
99
-
- Early testers have observed CSI driver OOMs when mounting larger (1TiB+) btrfs volumes under default memory constraints. The default constraint, as of writing, is 50MiB.
99
+
100
+
`btrfs` filesystem accepts two "special" mount options:
101
+
102
+
-`btrfs-data-bg_reclaim_threshold`
103
+
-`btrfs-metadata-bg_reclaim_threshold`
104
+
105
+
Which writes to `/sys/fs/btrfs/FS-UUID/allocation/{,meta}data/bg_reclaim_threshold`, as documented [in btrfs docs](https://btrfs.readthedocs.io/en/latest/ch-sysfs.html#uuid-allocations-data-metadata-system).
0 commit comments