diff options
author | Josef Bacik <josef@toxicpanda.com> | 2022-08-08 22:10:27 +0200 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2022-09-26 12:27:58 +0200 |
commit | fc80f7aca55bfff8378f9aa3e6aa52015609132f (patch) | |
tree | 3c61631eccedbc18a805a0a62e373c9468939a77 /fs/btrfs/free-space-cache.c | |
parent | btrfs: call __btrfs_remove_free_space_cache_locked on cache load failure (diff) | |
download | linux-fc80f7aca55bfff8378f9aa3e6aa52015609132f.tar.xz linux-fc80f7aca55bfff8378f9aa3e6aa52015609132f.zip |
btrfs: remove use btrfs_remove_free_space_cache instead of variant
We are calling __btrfs_remove_free_space_cache everywhere to cleanup the
block group free space, however we can just use
btrfs_remove_free_space_cache and pass in the block group in all of
these places. Then we can remove __btrfs_remove_free_space_cache and
rename __btrfs_remove_free_space_cache_locked to
__btrfs_remove_free_space_cache.
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/free-space-cache.c')
-rw-r--r-- | fs/btrfs/free-space-cache.c | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c index f2a6dd033623..0c94bbb5dcd7 100644 --- a/fs/btrfs/free-space-cache.c +++ b/fs/btrfs/free-space-cache.c @@ -48,8 +48,7 @@ static void bitmap_clear_bits(struct btrfs_free_space_ctl *ctl, struct btrfs_free_space *info, u64 offset, u64 bytes, bool update_stats); -static void __btrfs_remove_free_space_cache_locked( - struct btrfs_free_space_ctl *ctl) +static void __btrfs_remove_free_space_cache(struct btrfs_free_space_ctl *ctl) { struct btrfs_free_space *info; struct rb_node *node; @@ -898,12 +897,8 @@ out: free_cache: io_ctl_drop_pages(&io_ctl); - /* - * We need to call the _locked variant so we don't try to update the - * discard counters. - */ spin_lock(&ctl->tree_lock); - __btrfs_remove_free_space_cache_locked(ctl); + __btrfs_remove_free_space_cache(ctl); spin_unlock(&ctl->tree_lock); goto out; } @@ -3010,15 +3005,6 @@ static void __btrfs_return_cluster_to_free_space( btrfs_put_block_group(block_group); } -void __btrfs_remove_free_space_cache(struct btrfs_free_space_ctl *ctl) -{ - spin_lock(&ctl->tree_lock); - __btrfs_remove_free_space_cache_locked(ctl); - if (ctl->block_group) - btrfs_discard_update_discardable(ctl->block_group); - spin_unlock(&ctl->tree_lock); -} - void btrfs_remove_free_space_cache(struct btrfs_block_group *block_group) { struct btrfs_free_space_ctl *ctl = block_group->free_space_ctl; @@ -3036,7 +3022,7 @@ void btrfs_remove_free_space_cache(struct btrfs_block_group *block_group) cond_resched_lock(&ctl->tree_lock); } - __btrfs_remove_free_space_cache_locked(ctl); + __btrfs_remove_free_space_cache(ctl); btrfs_discard_update_discardable(block_group); spin_unlock(&ctl->tree_lock); |