From 50ae9f62c7ba31a0bc210a3abc48164e4e6a3f63 Mon Sep 17 00:00:00 2001 From: Naohiro Aota Date: Mon, 26 Apr 2021 15:27:29 +0900 Subject: [PATCH] btrfs-progs: zoned: implement sequential extent allocation Implement a sequential extent allocator for zoned filesystems. This allocator only needs to check if there is enough space in the block group after the allocation pointer to satisfy the extent allocation request. Since the allocator is really simple, we implement it directly in find_search_start(). Signed-off-by: Naohiro Aota Signed-off-by: David Sterba --- kernel-shared/extent-tree.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/kernel-shared/extent-tree.c b/kernel-shared/extent-tree.c index ec5ea9a8..7453bf9f 100644 --- a/kernel-shared/extent-tree.c +++ b/kernel-shared/extent-tree.c @@ -284,6 +284,14 @@ again: if (cache->ro || !block_group_bits(cache, data)) goto new_group; + if (btrfs_is_zoned(root->fs_info)) { + if (cache->length - cache->alloc_offset < num) + goto new_group; + *start_ret = cache->start + cache->alloc_offset; + cache->alloc_offset += num; + return 0; + } + while(1) { ret = find_first_extent_bit(&root->fs_info->free_space_cache, last, &start, &end, EXTENT_DIRTY);