summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/extent-tree.c
diff options
context:
space:
mode:
authorNikolay Borisov <nborisov@suse.com>2017-05-11 09:17:46 +0300
committerDavid Sterba <dsterba@suse.com>2017-06-19 18:25:58 +0200
commita5ed45f8224f2c7e4ad5a9673cb50e8e3128bd88 (patch)
tree0fe59f8adb887bfab495948f2d7278c16daea491 /fs/btrfs/extent-tree.c
parent401b41e5a85a635fd9888ba8969c5006a5dbd399 (diff)
downloadlinux-stable-a5ed45f8224f2c7e4ad5a9673cb50e8e3128bd88.tar.gz
linux-stable-a5ed45f8224f2c7e4ad5a9673cb50e8e3128bd88.tar.bz2
linux-stable-a5ed45f8224f2c7e4ad5a9673cb50e8e3128bd88.zip
btrfs: Convert fs_info->free_chunk_space to atomic64_t
The ->free_chunk_space variable is used to track the unallocated space and access to it is protected by a spinlock, which is not used for anything else. Make the code a bit self-explanatory by switching the variable to an atomic64_t type and kill the spinlock. Signed-off-by: Nikolay Borisov <nborisov@suse.com> [ not a performance critical code, use of atomic type is ok ] 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.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 33d979e9ea2a..4c0d3980fe3f 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -4646,9 +4646,7 @@ static int can_overcommit(struct btrfs_root *root,
used += space_info->bytes_may_use;
- spin_lock(&fs_info->free_chunk_lock);
- avail = fs_info->free_chunk_space;
- spin_unlock(&fs_info->free_chunk_lock);
+ avail = atomic64_read(&fs_info->free_chunk_space);
/*
* If we have dup, raid1 or raid10 then only half of the free