]> git.hungrycats.org Git - linux/commitdiff
btrfs: allocator hints: define the hint values unconditionally in the UAPI header
authorZygo Blaxell <ce3g8jdj@umail.furryterror.org>
Sun, 4 Oct 2026 04:44:02 +0000 (00:44 -0400)
committerZygo Blaxell <ce3g8jdj@umail.furryterror.org>
Thu, 12 Nov 2026 15:24:16 +0000 (10:24 -0500)
The BTRFS_DEV_ALLOCATION_* values sit in include/uapi/linux/btrfs_tree.h
inside #ifdef CONFIG_BTRFS_ALLOCATOR_HINTS, to keep them away from
userspace until the interface is settled.  A CONFIG_ symbol in a UAPI
header is rejected by scripts/headers_install.sh:

  error: include/uapi/linux/btrfs_tree.h: leak CONFIG_BTRFS_ALLOCATOR_HINTS to user-space

so 'make headers_install' (and the deb/rpm package targets, which run
it) fail with the patch set applied.

The values are on-disk format: they give the meaning of the low bits of
dev_item.type, and userspace (btrfs-progs) needs them to read and set a
device's hint.  Defining them changes no userspace-visible structure.
So drop the guard and always export the values.  The code that acts on
the hints stays under CONFIG_BTRFS_ALLOCATOR_HINTS.

Assisted-by: Claude:claude-opus-5-5
include/uapi/linux/btrfs_tree.h

index 8a6087d6e967aa60010f4ebc3d2347525f86f8df..9b1887915fd14b20ac83f4ff4f9bc72d03d0d6e0 100644 (file)
@@ -578,11 +578,6 @@ struct btrfs_node {
        struct btrfs_key_ptr ptrs[];
 } __attribute__ ((__packed__));
 
-/*
- * This defines the chunk allocation hints for a device. It uses an ifdef guard
- * in UAPI to avoid exposing it to userspace.
- */
-#ifdef CONFIG_BTRFS_ALLOCATOR_HINTS
 /* dev_item.type */
 
 /* btrfs chunk allocation hints */
@@ -601,8 +596,6 @@ struct btrfs_node {
 #define BTRFS_DEV_ALLOCATION_NONE_ONLY         (5ULL)
 /* 6..7 are unused values */
 
-#endif /* CONFIG_BTRFS_ALLOCATOR_HINTS */
-
 struct btrfs_dev_item {
        /* the internal btrfs device id */
        __le64 devid;