summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/extent-tree.c
diff options
context:
space:
mode:
authorNaohiro Aota <naohiro.aota@wdc.com>2020-02-25 12:56:16 +0900
committerDavid Sterba <dsterba@suse.com>2020-03-23 17:01:49 +0100
commitcb2f96f8ab68812fa3e6f32ec763fb15ae6395c6 (patch)
tree80a43a89cef6ad1fe6fe1ea3a6e0328b5d191358 /fs/btrfs/extent-tree.c
parent6aafb3038454bf137463f2c2096065ba9a452ccc (diff)
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: Josef Bacik <josef@toxicpanda.com> Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/extent-tree.c')
-rw-r--r--fs/btrfs/extent-tree.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 9d5563a63a1f..bd0d13661ea7 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -3427,6 +3427,10 @@ btrfs_release_block_group(struct btrfs_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
* parameters.
@@ -3478,6 +3482,9 @@ struct find_free_extent_ctl {
/* Found result */
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,
ffe_ctl.have_caching_bg = false;
ffe_ctl.orig_have_caching_bg = false;
ffe_ctl.found_offset = 0;
+ ffe_ctl.policy = BTRFS_EXTENT_ALLOC_CLUSTERED;
ins->type = BTRFS_EXTENT_ITEM_KEY;
ins->objectid = 0;