summaryrefslogtreecommitdiff
path: root/fs/xfs/xfs_trans.c
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2021-02-01 21:38:51 +0300
committerDarrick J. Wong <djwong@kernel.org>2021-02-03 20:18:49 +0300
commit5c615f0feb9a559abd08da0842d6fcfee105b7e3 (patch)
tree3a69124d9fdf44c58d7b30c40eaf5eb0e3dfae69 /fs/xfs/xfs_trans.c
parent7317a03df703f7cdae3ae9e9635a0ef45849fe09 (diff)
downloadlinux-5c615f0feb9a559abd08da0842d6fcfee105b7e3.tar.xz
xfs: remove xfs_qm_vop_chown_reserve
Now that the only caller of this function is xfs_trans_alloc_ichange, just open-code the meat of _chown_reserve in that caller. Drop the (redundant) [ugp]id checks because xfs has a 1:1 relationship between quota ids and incore dquots. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'fs/xfs/xfs_trans.c')
-rw-r--r--fs/xfs/xfs_trans.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c
index 60672b5545c9..29dca1bc4c1a 100644
--- a/fs/xfs/xfs_trans.c
+++ b/fs/xfs/xfs_trans.c
@@ -1156,8 +1156,20 @@ xfs_trans_alloc_ichange(
if (pdqp == ip->i_pdquot)
pdqp = NULL;
if (udqp || gdqp || pdqp) {
- error = xfs_qm_vop_chown_reserve(tp, ip, udqp, gdqp, pdqp,
- force ? XFS_QMOPT_FORCE_RES : 0);
+ unsigned int qflags = XFS_QMOPT_RES_REGBLKS;
+
+ if (force)
+ qflags |= XFS_QMOPT_FORCE_RES;
+
+ /*
+ * Reserve enough quota to handle blocks on disk and reserved
+ * for a delayed allocation. We'll actually transfer the
+ * delalloc reservation between dquots at chown time, even
+ * though that part is only semi-transactional.
+ */
+ error = xfs_trans_reserve_quota_bydquots(tp, mp, udqp, gdqp,
+ pdqp, ip->i_d.di_nblocks + ip->i_delayed_blks,
+ 1, qflags);
if (error)
goto out_cancel;
}