aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWang Xiaoguang <wangxg.fnst@cn.fujitsu.com>2016-07-11 07:30:04 -0400
committerDavid Sterba <dsterba@suse.com>2016-07-26 07:52:25 -0400
commit39581a3a1af7e03af41dde62a6485a934deb109b (patch)
tree357f62d91afca7d631b96744c86d70d4eae0fdbf
parent751bebbe0ad261b3ac5d9e75eaec4d5fe9e23160 (diff)
btrfs: fix free space calculation in dump_space_info()
In btrfs, btrfs_space_info's bytes_may_use is treated as fs used space, as what we do in reserve_metadata_bytes() or btrfs_alloc_data_chunk_ondemand(), so in dump_space_info(), when calculating free space, we should also subtract btrfs_space_info's bytes_may_use. Signed-off-by: Wang Xiaoguang <wangxg.fnst@cn.fujitsu.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r--fs/btrfs/extent-tree.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index cab2f9c8d321..3bb9607edc5d 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -7906,8 +7906,8 @@ static void dump_space_info(struct btrfs_space_info *info, u64 bytes,
7906 printk(KERN_INFO "BTRFS: space_info %llu has %llu free, is %sfull\n", 7906 printk(KERN_INFO "BTRFS: space_info %llu has %llu free, is %sfull\n",
7907 info->flags, 7907 info->flags,
7908 info->total_bytes - info->bytes_used - info->bytes_pinned - 7908 info->total_bytes - info->bytes_used - info->bytes_pinned -
7909 info->bytes_reserved - info->bytes_readonly, 7909 info->bytes_reserved - info->bytes_readonly -
7910 (info->full) ? "" : "not "); 7910 info->bytes_may_use, (info->full) ? "" : "not ");
7911 printk(KERN_INFO "BTRFS: space_info total=%llu, used=%llu, pinned=%llu, " 7911 printk(KERN_INFO "BTRFS: space_info total=%llu, used=%llu, pinned=%llu, "
7912 "reserved=%llu, may_use=%llu, readonly=%llu\n", 7912 "reserved=%llu, may_use=%llu, readonly=%llu\n",
7913 info->total_bytes, info->bytes_used, info->bytes_pinned, 7913 info->total_bytes, info->bytes_used, info->bytes_pinned,