]> 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>
Sun, 8 Nov 2026 06:08:59 +0000 (01:08 -0500)
commitc1a7a613ce71fc95364bb6f0cce0288037871fe1
treec78f3b55658e953f3cf258404ddd6c9ae153c214
parent6a9d40158a7b47e19f1406c7913f95daf6b0e1b1
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