]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: reserve data and rt quota at the same time
authorDarrick J. Wong <djwong@kernel.org>
Tue, 6 Apr 2021 20:38:24 +0000 (16:38 -0400)
committerEric Sandeen <sandeen@sandeen.net>
Tue, 6 Apr 2021 20:38:24 +0000 (16:38 -0400)
Source kernel commit: 02b7ee4eb613240d2bb3f6a67723f94ceda19eb6

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>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
libxfs/xfs_attr.c
libxfs/xfs_bmap.c

index 237f36b468560e06dfbb5b0ba48bc509e8b5c8e5..6e38eae5f943accc880eb3f548ddeeba0df03d25 100644 (file)
@@ -474,12 +474,8 @@ xfs_attr_set(
        }
 
        if (args->value) {
-               unsigned int    quota_flags = XFS_QMOPT_RES_REGBLKS;
-
-               if (rsvd)
-                       quota_flags |= XFS_QMOPT_FORCE_RES;
                error = xfs_trans_reserve_quota_nblks(args->trans, dp,
-                               args->total, 0, quota_flags);
+                               args->total, 0, rsvd);
                if (error)
                        goto out_trans_cancel;
 
index 2866134a6d54ebaad39c27620c941e7945ce1e22..2079bc2f929501069328f2957638811570cdbfff 100644 (file)
@@ -1078,9 +1078,7 @@ xfs_bmap_add_attrfork(
                return error;
 
        xfs_ilock(ip, XFS_ILOCK_EXCL);
-       error = xfs_trans_reserve_quota_nblks(tp, ip, blks, 0, rsvd ?
-                       XFS_QMOPT_RES_REGBLKS | XFS_QMOPT_FORCE_RES :
-                       XFS_QMOPT_RES_REGBLKS);
+       error = xfs_trans_reserve_quota_nblks(tp, ip, blks, 0, rsvd);
        if (error)
                goto trans_cancel;
        if (XFS_IFORK_Q(ip))