Skip to content

Commit 9b28489

Browse files
kakraGoffredo Baroncelli
andcommitted
btrfs: add flags to give a hint to the chunk allocator
Add the following flags to give a hint about which chunk should be allocated on 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 Co-authored-by: Goffredo Baroncelli <kreijack@inwid.it> Signed-off-by: Kai Krakow <kai@kaishome.de>
1 parent 8ff33f9 commit 9b28489

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

include/uapi/linux/btrfs_tree.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,23 @@ struct btrfs_node {
578578
struct btrfs_key_ptr ptrs[];
579579
} __attribute__ ((__packed__));
580580

581+
#ifdef CONFIG_BTRFS_ALLOCATOR_HINTS
582+
/* dev_item.type */
583+
584+
/* btrfs chunk allocation hints */
585+
#define BTRFS_DEV_ALLOCATION_MASK_BIT_COUNT 3
586+
/* preferred data chunk, but metadata chunk allowed */
587+
#define BTRFS_DEV_ALLOCATION_PREFERRED_DATA (0ULL)
588+
/* preferred metadata chunk, but data chunk allowed */
589+
#define BTRFS_DEV_ALLOCATION_PREFERRED_METADATA (1ULL)
590+
/* only metadata chunk allowed */
591+
#define BTRFS_DEV_ALLOCATION_METADATA_ONLY (2ULL)
592+
/* only data chunk allowed */
593+
#define BTRFS_DEV_ALLOCATION_DATA_ONLY (3ULL)
594+
/* 5..7 are unused values */
595+
596+
#endif
597+
581598
struct btrfs_dev_item {
582599
/* the internal btrfs device id */
583600
__le64 devid;

0 commit comments

Comments
 (0)