From: Darrick J. Wong Date: Tue, 6 Apr 2021 20:38:16 +0000 (-0400) Subject: xfs: create convenience wrappers for incore quota block reservations X-Git-Tag: v5.12.0-rc0~7 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9fcc3af98a4611e407af275c888622d503cb8c70;p=thirdparty%2Fxfsprogs-dev.git xfs: create convenience wrappers for incore quota block reservations Source kernel commit: 8554650003b8a66f3dd357692ab73101d088d938 Create a couple of convenience wrappers for creating and deleting quota block reservations against future changes. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig Reviewed-by: Brian Foster Signed-off-by: Eric Sandeen --- diff --git a/libxfs/libxfs_priv.h b/libxfs/libxfs_priv.h index 084da32d6..e37d5933f 100644 --- a/libxfs/libxfs_priv.h +++ b/libxfs/libxfs_priv.h @@ -499,8 +499,10 @@ void __xfs_buf_mark_corrupt(struct xfs_buf *bp, xfs_failaddr_t fa); /* hack too silence gcc */ static inline int retzero(void) { return 0; } #define xfs_trans_unreserve_quota_nblks(t,i,b,n,f) retzero() +#define xfs_quota_unreserve_blkres(i,b) retzero() -#define xfs_qm_dqattach(i) (0) +#define xfs_quota_reserve_blkres(i,b) (0) +#define xfs_qm_dqattach(i) (0) #define uuid_copy(s,d) platform_uuid_copy((s),(d)) #define uuid_equal(s,d) (platform_uuid_compare((s),(d)) == 0) diff --git a/libxfs/xfs_bmap.c b/libxfs/xfs_bmap.c index dbff68d12..2866134a6 100644 --- a/libxfs/xfs_bmap.c +++ b/libxfs/xfs_bmap.c @@ -4090,8 +4090,7 @@ xfs_bmapi_reserve_delalloc( * blocks. This number gets adjusted later. We return if we haven't * allocated blocks already inside this loop. */ - error = xfs_trans_reserve_quota_nblks(NULL, ip, (long)alen, 0, - XFS_QMOPT_RES_REGBLKS); + error = xfs_quota_reserve_blkres(ip, alen); if (error) return error; @@ -4137,8 +4136,7 @@ out_unreserve_blocks: xfs_mod_fdblocks(mp, alen, false); out_unreserve_quota: if (XFS_IS_QUOTA_ON(mp)) - xfs_trans_unreserve_quota_nblks(NULL, ip, (long)alen, 0, - XFS_QMOPT_RES_REGBLKS); + xfs_quota_unreserve_blkres(ip, alen); return error; } @@ -4930,8 +4928,8 @@ xfs_bmap_del_extent_delay( * sb counters as we might have to borrow some blocks for the * indirect block accounting. */ - error = xfs_trans_unreserve_quota_nblks(NULL, ip, del->br_blockcount, 0, - isrt ? XFS_QMOPT_RES_RTBLKS : XFS_QMOPT_RES_REGBLKS); + ASSERT(!isrt); + error = xfs_quota_unreserve_blkres(ip, del->br_blockcount); if (error) return error; ip->i_delayed_blks -= del->br_blockcount;