summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/tests/btrfs-tests.c
diff options
context:
space:
mode:
authorJosef Bacik <josef@toxicpanda.com>2020-10-23 09:58:08 -0400
committerDavid Sterba <dsterba@suse.com>2020-12-08 15:54:03 +0100
commitcd79909bc7cdd8043a22d699aae1e8435792c824 (patch)
treeb5afd7ce56ebec9e31fafaf5662301dbee896575 /fs/btrfs/tests/btrfs-tests.c
parent66b53bae46c84e00e276ee6e539eedfbcfe78573 (diff)
downloadlinux-cd79909bc7cdd8043a22d699aae1e8435792c824.tar.gz
linux-cd79909bc7cdd8043a22d699aae1e8435792c824.tar.bz2
linux-cd79909bc7cdd8043a22d699aae1e8435792c824.zip
btrfs: load free space cache into a temporary ctl
The free space cache has been special in that we would load it right away instead of farming the work off to a worker thread. This resulted in some weirdness that had to be taken into account for this fact, namely that if we every found a block group being cached the fast way we had to wait for it to finish, because we could get the cache before it had been validated and we may throw the cache away. To handle this particular case instead create a temporary btrfs_free_space_ctl to load the free space cache into. Then once we've validated that it makes sense, copy it's contents into the actual block_group->free_space_ctl. This allows us to avoid the problems of needing to wait for the caching to complete, we can clean up the discard extent handling stuff in __load_free_space_cache, and we no longer need to do the merge_space_tree() because the space is added one by one into the real free_space_ctl. This will allow further reworks of how we handle loading the free space cache. Reviewed-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: Josef Bacik <josef@toxicpanda.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/tests/btrfs-tests.c')
-rw-r--r--fs/btrfs/tests/btrfs-tests.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/btrfs/tests/btrfs-tests.c b/fs/btrfs/tests/btrfs-tests.c
index b36e88753f1f..8ca334d554af 100644
--- a/fs/btrfs/tests/btrfs-tests.c
+++ b/fs/btrfs/tests/btrfs-tests.c
@@ -225,7 +225,7 @@ btrfs_alloc_dummy_block_group(struct btrfs_fs_info *fs_info,
INIT_LIST_HEAD(&cache->list);
INIT_LIST_HEAD(&cache->cluster_list);
INIT_LIST_HEAD(&cache->bg_list);
- btrfs_init_free_space_ctl(cache);
+ btrfs_init_free_space_ctl(cache, cache->free_space_ctl);
mutex_init(&cache->free_space_lock);
return cache;