Commit 0eee8a49 authored by Nikolay Borisov's avatar Nikolay Borisov Committed by David Sterba

btrfs: Use btrfs_space_info_used instead of opencoding it

Signed-off-by: default avatarNikolay Borisov <nborisov@suse.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 4fc6441a
...@@ -4949,9 +4949,8 @@ btrfs_calc_reclaim_metadata_size(struct btrfs_fs_info *fs_info, ...@@ -4949,9 +4949,8 @@ btrfs_calc_reclaim_metadata_size(struct btrfs_fs_info *fs_info,
BTRFS_RESERVE_FLUSH_ALL, system_chunk)) BTRFS_RESERVE_FLUSH_ALL, system_chunk))
return 0; return 0;
used = space_info->bytes_used + space_info->bytes_reserved + used = btrfs_space_info_used(space_info, true);
space_info->bytes_pinned + space_info->bytes_readonly +
space_info->bytes_may_use;
if (can_overcommit(fs_info, space_info, SZ_1M, if (can_overcommit(fs_info, space_info, SZ_1M,
BTRFS_RESERVE_FLUSH_ALL, system_chunk)) BTRFS_RESERVE_FLUSH_ALL, system_chunk))
expected = div_factor_fine(space_info->total_bytes, 95); 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, ...@@ -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 * overcommit, and if we can't then we just need to free up our space
* and not satisfy any requests. * and not satisfy any requests.
*/ */
used = space_info->bytes_used + space_info->bytes_reserved + used = btrfs_space_info_used(space_info, true);
space_info->bytes_pinned + space_info->bytes_readonly +
space_info->bytes_may_use;
if (used - num_bytes >= space_info->total_bytes) if (used - num_bytes >= space_info->total_bytes)
check_overcommit = true; check_overcommit = true;
again: again:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment