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

btrfs: introduce extent allocation policy

This commit introduces extent allocation policy for btrfs. This policy
controls how btrfs allocate an extents from block groups.  There is no
functional change introduced with this commit.
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 6aafb303
...@@ -3427,6 +3427,10 @@ btrfs_release_block_group(struct btrfs_block_group *cache, ...@@ -3427,6 +3427,10 @@ btrfs_release_block_group(struct btrfs_block_group *cache,
btrfs_put_block_group(cache); btrfs_put_block_group(cache);
} }
enum btrfs_extent_allocation_policy {
BTRFS_EXTENT_ALLOC_CLUSTERED,
};
/* /*
* Structure used internally for find_free_extent() function. Wraps needed * Structure used internally for find_free_extent() function. Wraps needed
* parameters. * parameters.
...@@ -3478,6 +3482,9 @@ struct find_free_extent_ctl { ...@@ -3478,6 +3482,9 @@ struct find_free_extent_ctl {
/* Found result */ /* Found result */
u64 found_offset; u64 found_offset;
/* Allocation policy */
enum btrfs_extent_allocation_policy policy;
}; };
...@@ -3815,6 +3822,7 @@ static noinline int find_free_extent(struct btrfs_fs_info *fs_info, ...@@ -3815,6 +3822,7 @@ static noinline int find_free_extent(struct btrfs_fs_info *fs_info,
ffe_ctl.have_caching_bg = false; ffe_ctl.have_caching_bg = false;
ffe_ctl.orig_have_caching_bg = false; ffe_ctl.orig_have_caching_bg = false;
ffe_ctl.found_offset = 0; ffe_ctl.found_offset = 0;
ffe_ctl.policy = BTRFS_EXTENT_ALLOC_CLUSTERED;
ins->type = BTRFS_EXTENT_ITEM_KEY; ins->type = BTRFS_EXTENT_ITEM_KEY;
ins->objectid = 0; ins->objectid = 0;
......
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