]> git.hungrycats.org Git - linux/commit
btrfs: add allocator_hint mode
authorGoffredo Baroncelli <kreijack@inwind.it>
Sun, 24 Oct 2021 15:31:07 +0000 (17:31 +0200)
committerZygo Blaxell <ce3g8jdj@umail.furryterror.org>
Fri, 18 Sep 2026 21:36:34 +0000 (17:36 -0400)
commite0daf39e650994c755ef44708e660b9d17d4767f
tree5549e4969d12f6e8aaeff7b692df9a12a0d2ff11
parentf81fdacd5450cea4f36006ef929ea9dc94c25017
btrfs: add allocator_hint mode

When this mode is enabled, the chunk allocation policy is modified as
follow.

Each disk may have a different tag:
- BTRFS_DEV_ALLOCATION_PREFERRED_METADATA
- BTRFS_DEV_ALLOCATION_METADATA_ONLY
- BTRFS_DEV_ALLOCATION_DATA_ONLY
- BTRFS_DEV_ALLOCATION_PREFERRED_DATA (default)

Where:
- ALLOCATION_PREFERRED_X means that it is preferred to use this disk for
the X chunk type (the other type may be allowed when the space is low)
- ALLOCATION_X_ONLY means that it is used *only* for the X chunk type.
This means also that it is a preferred choice.

Each time the allocator allocates a chunk of type X , first it takes the
disks tagged as ALLOCATION_X_ONLY or ALLOCATION_PREFERRED_X; if the space
is not enough, it uses also the disks tagged as ALLOCATION_METADATA_ONLY;
if the space is not enough, it uses also the other disks, with the
exception of the one marked as ALLOCATION_PREFERRED_Y, where Y the other
type of chunk (i.e. not X).

Signed-off-by: Goffredo Baroncelli <kreijack@inwind.it>
(cherry picked from commit 67aff1593c65f5fddd8a5a23addc124be6b23d32)
(cherry picked from commit 0851c8d1545a76ef495256d7707c30671ad0087c)
fs/btrfs/volumes.c
fs/btrfs/volumes.h