]> 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:25:35 +0000 (10:25 -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 5f1d85b9ad747a4ef2ac0e6341b38d6178af089c..6197cbf7c69fed1a787cdfcb10d65491d563c7a6 100644 (file)
@@ -585,11 +585,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 */
@@ -608,8 +603,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;