summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/extent-tree.c
diff options
context:
space:
mode:
authorJosef Bacik <josef@toxicpanda.com>2019-06-20 15:37:46 -0400
committerDavid Sterba <dsterba@suse.com>2019-09-09 08:59:04 -0400
commit3cad128400c2445d9140c0f5720018e075ef66c6 (patch)
tree43632afb0ad6869ff72eac40183aaf03240bf7c9 /fs/btrfs/extent-tree.c
parent2e405ad842546a1a37aaa586d5140d071cb1f802 (diff)
btrfs: migrate the block group ref counting stuff
Another easy set to move over to block-group.c. Signed-off-by: Josef Bacik <josef@toxicpanda.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.c25
1 files changed, 0 insertions, 25 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index a454945227ca..dc1fb9286fee 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -68,31 +68,6 @@ static int block_group_bits(struct btrfs_block_group_cache *cache, u64 bits)
68 return (cache->flags & bits) == bits; 68 return (cache->flags & bits) == bits;
69} 69}
70 70
71void btrfs_get_block_group(struct btrfs_block_group_cache *cache)
72{
73 atomic_inc(&cache->count);
74}
75
76void btrfs_put_block_group(struct btrfs_block_group_cache *cache)
77{
78 if (atomic_dec_and_test(&cache->count)) {
79 WARN_ON(cache->pinned > 0);
80 WARN_ON(cache->reserved > 0);
81
82 /*
83 * If not empty, someone is still holding mutex of
84 * full_stripe_lock, which can only be released by caller.
85 * And it will definitely cause use-after-free when caller
86 * tries to release full stripe lock.
87 *
88 * No better way to resolve, but only to warn.
89 */
90 WARN_ON(!RB_EMPTY_ROOT(&cache->full_stripe_locks_root.root));
91 kfree(cache->free_space_ctl);
92 kfree(cache);
93 }
94}
95
96/* 71/*
97 * this adds the block group to the fs_info rb tree for the block group 72 * this adds the block group to the fs_info rb tree for the block group
98 * cache 73 * cache