]> git.hungrycats.org Git - linux/commitdiff
btrfs: add flags to give an hint to the chunk allocator
authorGoffredo Baroncelli <kreijack@inwind.it>
Sun, 24 Oct 2021 15:31:04 +0000 (17:31 +0200)
committerZygo Blaxell <ce3g8jdj@umail.furryterror.org>
Sun, 5 Dec 2021 08:11:09 +0000 (03:11 -0500)
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>
(cherry picked from commit 67029cb5ff72d6fa8fc3146496129518fa332bcd)
(cherry picked from commit b3d43b50ef1d9b85bdd97a78d8d45de2d0f82950)

include/uapi/linux/btrfs_tree.h

index 58d7cff9afb17f8d79ed2b7f927a0fac4d996ddc..25f522bcdadc433c79ed93d80761bfd291bca394 100644 (file)
@@ -361,6 +361,20 @@ struct btrfs_key {
        __u64 offset;
 } __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;