Commit 0d95c1bec906dd1ad951c9c001e798ca52baeb0f
Committed by
Chris Mason
1 parent
321592427c
Exists in
ti-lsk-linux-4.1.y
and in
10 other branches
btrfs: fix wrong accounting of raid1 data profile in statfs
The sizes that are obtained from space infos are in raw units and have to be adjusted according to the raid factor. This was missing for f_bavail and df reported doubled size for raid1. Reported-by: Martin Steigerwald <Martin@lichtvoll.de> Fixes: ba7b6e62f420 ("btrfs: adjust statfs calculations according to raid profiles") CC: stable@vger.kernel.org Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
Showing 1 changed file with 1 additions and 1 deletions Side-by-side Diff
fs/btrfs/super.c
... | ... | @@ -1851,7 +1851,7 @@ |
1851 | 1851 | buf->f_bfree -= block_rsv->size >> bits; |
1852 | 1852 | spin_unlock(&block_rsv->lock); |
1853 | 1853 | |
1854 | - buf->f_bavail = total_free_data; | |
1854 | + buf->f_bavail = div_u64(total_free_data, factor); | |
1855 | 1855 | ret = btrfs_calc_avail_data_space(fs_info->tree_root, &total_free_data); |
1856 | 1856 | if (ret) |
1857 | 1857 | return ret; |