]> git.hungrycats.org Git - linux/commit
btrfs: add allocator_hint to disable allocation completely
authorKai Krakow <kai@kaishome.de>
Fri, 10 Jul 2026 21:51:46 +0000 (23:51 +0200)
committerZygo Blaxell <ce3g8jdj@umail.furryterror.org>
Mon, 2 Nov 2026 02:17:17 +0000 (21:17 -0500)
commitdda4a4d6074a36cce3f9e0ab8fa2843e540c81ab
treee13f5234e93b30e4d976da2724d17269d05a6dc7
parentbfa30f0ddca8c443fe656cbf4b1122977d742bd6
btrfs: add allocator_hint to disable allocation completely

This is useful where you want to prevent new allocations of chunks to a
set of multiple disks which are going to be removed from the pool. This
acts as a multiple `btrfs dev remove` on steroids that can remove
multiple disks in parallel without moving data to disks which would be
removed in the next round. In such cases, it will avoid moving the same
data multiple times, and thus avoid placing it on potentially bad
disks.

The restriction applies to non-mixed block groups. Mixed data and
metadata block groups intentionally ignore allocator hints. Device
replace does not copy the hint to the target device, so reapply it
after replacement.

v2:
- Clarify the mixed-block-group scope and device replace behavior.

Thanks to @Zygo for the explanation and suggestion.

Link: https://github.com/kdave/btrfs-progs/issues/907#issuecomment-2520897104
Signed-off-by: Kai Krakow <kai@kaishome.de>
fs/btrfs/Kconfig
fs/btrfs/sysfs.c
fs/btrfs/volumes.c
include/uapi/linux/btrfs_tree.h