xfs: reserve data and rt quota at the same time

Modify xfs_trans_reserve_quota_nblks so that we can reserve data and
realtime blocks from the dquot at the same time.  This change has the
theoretical side effect that for allocations to realtime files we will
reserve from the dquot both the number of rtblocks being allocated and
the number of bmbt blocks that might be needed to add the mapping.
However, since the mount code disables quota if it finds a realtime
device, this should not result in any behavior changes.

Now that we've moved the inode creation callers away from using the
_nblks function, we can repurpose the (now unused) ninos argument for
realtime blocks, so make that change.  This also replaces the flags
argument with a boolean parameter to force the reservation since we
don't need to distinguish between data and rt quota reservations any
more, and the only flag being passed in was FORCE_RES.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Brian Foster <bfoster@redhat.com>
This commit is contained in:
Darrick J. Wong
2021-01-26 17:20:42 -08:00
parent 7ac6eb46c9
commit 02b7ee4eb6
7 changed files with 60 additions and 56 deletions

View File

@ -398,8 +398,7 @@ xfs_reflink_allocate_cow(
goto convert;
}
error = xfs_trans_reserve_quota_nblks(tp, ip, resblks, 0,
XFS_QMOPT_RES_REGBLKS);
error = xfs_trans_reserve_quota_nblks(tp, ip, resblks, 0, false);
if (error)
goto out_trans_cancel;
@ -1090,8 +1089,7 @@ xfs_reflink_remap_extent(
if (!smap_real && dmap_written)
qres += dmap->br_blockcount;
if (qres > 0) {
error = xfs_trans_reserve_quota_nblks(tp, ip, qres, 0,
XFS_QMOPT_RES_REGBLKS);
error = xfs_trans_reserve_quota_nblks(tp, ip, qres, 0, false);
if (error)
goto out_cancel;
}