[v10,15/16] Btrfs: use total_bytes instead of bytes_used for global_rsv
diff mbox

Message ID 1397101727-20806-16-git-send-email-bo.li.liu@oracle.com
State Under Review
Headers show

Commit Message

Liu Bo April 10, 2014, 3:48 a.m. UTC
Because of dedupe, data space info cannot reflect how many data has
been written, in order to get global_rsv more proper, use total_bytes
instead.

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
---
 fs/btrfs/extent-tree.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Patch
diff mbox

diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index b8fee86..6f8b012 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -4692,14 +4692,14 @@  static u64 calc_global_metadata_size(struct btrfs_fs_info *fs_info)
 
 	sinfo = __find_space_info(fs_info, BTRFS_BLOCK_GROUP_DATA);
 	spin_lock(&sinfo->lock);
-	data_used = sinfo->bytes_used;
+	data_used = sinfo->total_bytes;
 	spin_unlock(&sinfo->lock);
 
 	sinfo = __find_space_info(fs_info, BTRFS_BLOCK_GROUP_METADATA);
 	spin_lock(&sinfo->lock);
 	if (sinfo->flags & BTRFS_BLOCK_GROUP_DATA)
 		data_used = 0;
-	meta_used = sinfo->bytes_used;
+	meta_used = sinfo->total_bytes;
 	spin_unlock(&sinfo->lock);
 
 	num_bytes = (data_used >> fs_info->sb->s_blocksize_bits) *