diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2019-01-21 15:32:13 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:08:14 -0400 |
commit | 7ef2a73a5881323d53453cc3be7261fe1a49af1d (patch) | |
tree | 85e8d67b00a6c28dd8691e79d1674c111e8a1328 /fs/bcachefs/chardev.c | |
parent | dbaee468461bfa82e6453ca0e009e9661cc570da (diff) | |
download | linux-stable-7ef2a73a5881323d53453cc3be7261fe1a49af1d.tar.gz linux-stable-7ef2a73a5881323d53453cc3be7261fe1a49af1d.tar.bz2 linux-stable-7ef2a73a5881323d53453cc3be7261fe1a49af1d.zip |
bcachefs: Fix check for if extent update is allocating
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/chardev.c')
-rw-r--r-- | fs/bcachefs/chardev.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/fs/bcachefs/chardev.c b/fs/bcachefs/chardev.c index 7f79f020d904..f090b61f23f1 100644 --- a/fs/bcachefs/chardev.c +++ b/fs/bcachefs/chardev.c @@ -394,21 +394,31 @@ static long bch2_ioctl_usage(struct bch_fs *c, } { - struct bch_fs_usage src = bch2_fs_usage_read(c); + struct bch_fs_usage *src; struct bch_ioctl_fs_usage dst = { .capacity = c->capacity, - .used = bch2_fs_sectors_used(c, src), - .online_reserved = src.s.online_reserved, }; + src = bch2_fs_usage_read(c); + if (!src) + return -ENOMEM; + + percpu_up_read(&c->mark_lock); + + dst.used = bch2_fs_sectors_used(c, *src); + dst.online_reserved = src->s.online_reserved; + for (i = 0; i < BCH_REPLICAS_MAX; i++) { dst.persistent_reserved[i] = - src.replicas[i].persistent_reserved; - + src->persistent_reserved[i]; +#if 0 for (j = 0; j < BCH_DATA_NR; j++) dst.sectors[j][i] = src.replicas[i].data[j]; +#endif } + kfree(src); + ret = copy_to_user(&user_arg->fs, &dst, sizeof(dst)); if (ret) return ret; |