btrfs: Use btrfs_space_info_used instead of opencoding it
authorNikolay Borisov <nborisov@suse.com>
Wed, 14 Jun 2017 08:35:34 +0000 (11:35 +0300)
committerDavid Sterba <dsterba@suse.com>
Mon, 19 Jun 2017 16:26:04 +0000 (18:26 +0200)
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/extent-tree.c

index 4689b88ac408538e865f9e890bab6becf5b27074..65659bd55a4e638a7c2d62cd7e83b50c7d7647a6 100644 (file)
@@ -4949,9 +4949,8 @@ btrfs_calc_reclaim_metadata_size(struct btrfs_fs_info *fs_info,
                           BTRFS_RESERVE_FLUSH_ALL, system_chunk))
                return 0;
 
-       used = space_info->bytes_used + space_info->bytes_reserved +
-              space_info->bytes_pinned + space_info->bytes_readonly +
-              space_info->bytes_may_use;
+       used = btrfs_space_info_used(space_info, true);
+
        if (can_overcommit(fs_info, space_info, SZ_1M,
                           BTRFS_RESERVE_FLUSH_ALL, system_chunk))
                expected = div_factor_fine(space_info->total_bytes, 95);
@@ -5398,9 +5397,7 @@ static void space_info_add_old_bytes(struct btrfs_fs_info *fs_info,
         * overcommit, and if we can't then we just need to free up our space
         * and not satisfy any requests.
         */
-       used = space_info->bytes_used + space_info->bytes_reserved +
-               space_info->bytes_pinned + space_info->bytes_readonly +
-               space_info->bytes_may_use;
+       used = btrfs_space_info_used(space_info, true);
        if (used - num_bytes >= space_info->total_bytes)
                check_overcommit = true;
 again: