]> git.hungrycats.org Git - linux/commitdiff
btrfs: add flags to give an hint to the chunk allocator (rebased on v6.2)
authorZygo Blaxell <ce3g8jdj@umail.furryterror.org>
Mon, 20 Feb 2023 03:41:53 +0000 (22:41 -0500)
committerZygo Blaxell <ce3g8jdj@umail.furryterror.org>
Sat, 19 Sep 2026 16:33:50 +0000 (12:33 -0400)
Add the following flags to give an hint about which chunk should be
allocated in which a disk.
The following flags are created:

- BTRFS_DEV_ALLOCATION_PREFERRED_DATA
  preferred data chunk, but metadata chunk allowed
- BTRFS_DEV_ALLOCATION_PREFERRED_METADATA
  preferred metadata chunk, but data chunk allowed
- BTRFS_DEV_ALLOCATION_METADATA_ONLY
  only metadata chunk allowed
- BTRFS_DEV_ALLOCATION_DATA_ONLY
  only data chunk allowed

Signed-off-by: Goffredo Baroncelli <kreijack@inwid.it>
include/uapi/linux/btrfs_tree.h

index fc29d273845d8406cec45ffb4eaba284f1016c50..71c6135dc7cfb2c5e787d397f7d4fdd25fd4ef22 100644 (file)
@@ -578,6 +578,20 @@ struct btrfs_node {
        struct btrfs_key_ptr ptrs[];
 } __attribute__ ((__packed__));
 
+/* dev_item.type */
+
+/* btrfs chunk allocation hints */
+#define BTRFS_DEV_ALLOCATION_MASK_BIT_COUNT    3
+/* preferred data chunk, but metadata chunk allowed */
+#define BTRFS_DEV_ALLOCATION_PREFERRED_DATA    (0ULL)
+/* preferred metadata chunk, but data chunk allowed */
+#define BTRFS_DEV_ALLOCATION_PREFERRED_METADATA        (1ULL)
+/* only metadata chunk are allowed */
+#define BTRFS_DEV_ALLOCATION_METADATA_ONLY     (2ULL)
+/* only data chunk allowed */
+#define BTRFS_DEV_ALLOCATION_DATA_ONLY         (3ULL)
+/* 5..7 are unused values */
+
 struct btrfs_dev_item {
        /* the internal btrfs device id */
        __le64 devid;