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 <naohiro.aota@wdc.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Naohiro Aota 2021-04-26 15:27:29 +09:00 committed by David Sterba
parent f08410f078
commit 50ae9f62c7

View file

@ -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);