Introduce chunk allocation policy for btrfs. This policy controls how
chunks and device extents are allocated from devices.

Signed-off-by: Naohiro Aota <naohiro.a...@wdc.com>
---
 kernel-shared/volumes.c | 1 +
 kernel-shared/volumes.h | 6 ++++++
 2 files changed, 7 insertions(+)

diff --git a/kernel-shared/volumes.c b/kernel-shared/volumes.c
index ddddae62581c..7bd6af451e78 100644
--- a/kernel-shared/volumes.c
+++ b/kernel-shared/volumes.c
@@ -254,6 +254,7 @@ static int device_list_add(const char *path,
                fs_devices->latest_devid = devid;
                fs_devices->latest_trans = found_transid;
                fs_devices->lowest_devid = (u64)-1;
+               fs_devices->chunk_alloc_policy = BTRFS_CHUNK_ALLOC_REGULAR;
                device = NULL;
        } else {
                device = find_device(fs_devices, devid,
diff --git a/kernel-shared/volumes.h b/kernel-shared/volumes.h
index d6e92db298ca..e1d7918dd30b 100644
--- a/kernel-shared/volumes.h
+++ b/kernel-shared/volumes.h
@@ -69,6 +69,10 @@ struct btrfs_device {
        u8 uuid[BTRFS_UUID_SIZE];
 };
 
+enum btrfs_chunk_allocation_policy {
+       BTRFS_CHUNK_ALLOC_REGULAR,
+};
+
 struct btrfs_fs_devices {
        u8 fsid[BTRFS_FSID_SIZE]; /* FS specific uuid */
        u8 metadata_uuid[BTRFS_FSID_SIZE]; /* FS specific uuid */
@@ -87,6 +91,8 @@ struct btrfs_fs_devices {
 
        int seeding;
        struct btrfs_fs_devices *seed;
+
+       enum btrfs_chunk_allocation_policy chunk_alloc_policy;
 };
 
 struct btrfs_bio_stripe {
-- 
2.31.1

Reply via email to