summaryrefslogtreecommitdiff
path: root/fs/bcachefs/fs.c
diff options
context:
space:
mode:
authorDan Robertson <dan@dlrobertson.com>2021-05-19 03:36:20 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-23 00:09:03 +0300
commited34341189478344eb54588ce73f190b86da4d5e (patch)
tree15444c5676406966c91ac2a60375edc4e43b678c /fs/bcachefs/fs.c
parentc21d5377791d94fca0d990eee82111572412640c (diff)
downloadlinux-ed34341189478344eb54588ce73f190b86da4d5e.tar.xz
bcachefs: statfs resports incorrect avail blocks
The current implementation of bch_statfs does not scale the number of available blocks provided in f_bavail by the reserve factor. This causes an allocation of a file of this size to fail. Signed-off-by: Dan Robertson <dan@dlrobertson.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/fs.c')
-rw-r--r--fs/bcachefs/fs.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/bcachefs/fs.c b/fs/bcachefs/fs.c
index 5eef67358cfb..9a595c205dbf 100644
--- a/fs/bcachefs/fs.c
+++ b/fs/bcachefs/fs.c
@@ -1274,8 +1274,8 @@ static int bch2_statfs(struct dentry *dentry, struct kstatfs *buf)
buf->f_type = BCACHEFS_STATFS_MAGIC;
buf->f_bsize = sb->s_blocksize;
buf->f_blocks = usage.capacity >> shift;
- buf->f_bfree = (usage.capacity - usage.used) >> shift;
- buf->f_bavail = buf->f_bfree;
+ buf->f_bfree = usage.free >> shift;
+ buf->f_bavail = avail_factor(usage.free) >> shift;
buf->f_files = usage.nr_inodes + avail_inodes;
buf->f_ffree = avail_inodes;