diff mbox series

[01/12] btrfs-progs: introduce chunk allocation policy

Message ID 4bedaf48df7ba0a31ed0466bfd5645d3436dfe77.1617694997.git.naohiro.aota@wdc.com (mailing list archive)
State New, archived
Headers show
Series btrfs-progs: refactor and generalize chunk/dev_extent allocation | expand

Commit Message

Naohiro Aota April 6, 2021, 8:05 a.m. UTC
Introduce chunk allocation policy for btrfs. This policy controls how
chunks and device extents are allocated from devices.

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

Patch

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 {