Commit c4a816c6 authored by Naohiro Aota's avatar Naohiro Aota Committed by David Sterba

btrfs: introduce chunk allocation policy

Introduce chunk allocation policy for btrfs. This policy controls how
chunks and device extents are allocated from devices.
Reviewed-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: default avatarJosef Bacik <josef@toxicpanda.com>
Signed-off-by: default avatarNaohiro Aota <naohiro.aota@wdc.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent b25c19f4
...@@ -1205,6 +1205,7 @@ static int open_fs_devices(struct btrfs_fs_devices *fs_devices, ...@@ -1205,6 +1205,7 @@ static int open_fs_devices(struct btrfs_fs_devices *fs_devices,
fs_devices->opened = 1; fs_devices->opened = 1;
fs_devices->latest_bdev = latest_dev->bdev; fs_devices->latest_bdev = latest_dev->bdev;
fs_devices->total_rw_bytes = 0; fs_devices->total_rw_bytes = 0;
fs_devices->chunk_alloc_policy = BTRFS_CHUNK_ALLOC_REGULAR;
out: out:
return ret; return ret;
} }
......
...@@ -207,6 +207,10 @@ BTRFS_DEVICE_GETSET_FUNCS(total_bytes); ...@@ -207,6 +207,10 @@ BTRFS_DEVICE_GETSET_FUNCS(total_bytes);
BTRFS_DEVICE_GETSET_FUNCS(disk_total_bytes); BTRFS_DEVICE_GETSET_FUNCS(disk_total_bytes);
BTRFS_DEVICE_GETSET_FUNCS(bytes_used); BTRFS_DEVICE_GETSET_FUNCS(bytes_used);
enum btrfs_chunk_allocation_policy {
BTRFS_CHUNK_ALLOC_REGULAR,
};
struct btrfs_fs_devices { struct btrfs_fs_devices {
u8 fsid[BTRFS_FSID_SIZE]; /* FS specific uuid */ u8 fsid[BTRFS_FSID_SIZE]; /* FS specific uuid */
u8 metadata_uuid[BTRFS_FSID_SIZE]; u8 metadata_uuid[BTRFS_FSID_SIZE];
...@@ -258,6 +262,8 @@ struct btrfs_fs_devices { ...@@ -258,6 +262,8 @@ struct btrfs_fs_devices {
struct kobject *devices_kobj; struct kobject *devices_kobj;
struct kobject *devinfo_kobj; struct kobject *devinfo_kobj;
struct completion kobj_unregister; struct completion kobj_unregister;
enum btrfs_chunk_allocation_policy chunk_alloc_policy;
}; };
#define BTRFS_BIO_INLINE_CSUM_SIZE 64 #define BTRFS_BIO_INLINE_CSUM_SIZE 64
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment