summaryrefslogtreecommitdiff
path: root/fs/bcachefs/fs-ioctl.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2018-12-17 13:43:00 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-23 00:08:13 +0300
commit0f5254aa98befa5187cc4d02584ab0f19d18ff68 (patch)
treef216065b3dd82d6f1f0d84d61e2a02b95dd5ebd8 /fs/bcachefs/fs-ioctl.c
parentd42dd4ad6d7e15a7742ed008d1be3c37247547c9 (diff)
downloadlinux-0f5254aa98befa5187cc4d02584ab0f19d18ff68.tar.xz
bcachefs: bch2_fs_quota_transfer
improve quota transfer locking & make ei_qid usage more consistent Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/fs-ioctl.c')
-rw-r--r--fs/bcachefs/fs-ioctl.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/fs/bcachefs/fs-ioctl.c b/fs/bcachefs/fs-ioctl.c
index a89786f295cf..701882ce6024 100644
--- a/fs/bcachefs/fs-ioctl.c
+++ b/fs/bcachefs/fs-ioctl.c
@@ -108,21 +108,12 @@ static int bch2_set_projid(struct bch_fs *c,
u32 projid)
{
struct bch_qid qid = inode->ei_qid;
- int ret;
-
- if (projid == inode->ei_qid.q[QTYP_PRJ])
- return 0;
qid.q[QTYP_PRJ] = projid;
- return bch2_quota_transfer(c, 1 << QTYP_PRJ, qid, inode->ei_qid,
- inode->v.i_blocks +
- inode->ei_quota_reserved);
- if (ret)
- return ret;
-
- inode->ei_qid.q[QTYP_PRJ] = projid;
- return 0;
+ return bch2_fs_quota_transfer(c, inode, qid,
+ 1 << QTYP_PRJ,
+ KEY_TYPE_QUOTA_PREALLOC);
}
static int fssetxattr_inode_update_fn(struct bch_inode_info *inode,