From: Darrick J. Wong Date: Tue, 6 Apr 2021 20:56:27 +0000 (-0400) Subject: xfs: allow reservation of rtblocks with xfs_trans_alloc_inode X-Git-Tag: v5.12.0-rc0~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=36bd1bdd0ddbfab7aaaf8c78c330477329aa6e78;p=thirdparty%2Fxfsprogs-dev.git xfs: allow reservation of rtblocks with xfs_trans_alloc_inode Source kernel commit: 3de4eb106fcc97f086b78bd17a0c3529691e8259 Make it so that we can reserve rt blocks with the xfs_trans_alloc_inode wrapper function, then convert a few more callsites. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig Reviewed-by: Brian Foster Signed-off-by: Eric Sandeen --- diff --git a/include/xfs_trans.h b/include/xfs_trans.h index 281caf306..ad76ecfdd 100644 --- a/include/xfs_trans.h +++ b/include/xfs_trans.h @@ -86,7 +86,8 @@ int libxfs_trans_alloc(struct xfs_mount *mp, struct xfs_trans_res *resp, uint blocks, uint rtextents, uint flags, struct xfs_trans **tpp); int libxfs_trans_alloc_inode(struct xfs_inode *ip, struct xfs_trans_res *resv, - unsigned int dblocks, bool force, struct xfs_trans **tpp); + unsigned int dblocks, unsigned int rblocks, bool force, + struct xfs_trans **tpp); int libxfs_trans_alloc_rollable(struct xfs_mount *mp, uint blocks, struct xfs_trans **tpp); int libxfs_trans_alloc_empty(struct xfs_mount *mp, struct xfs_trans **tpp); diff --git a/libxfs/trans.c b/libxfs/trans.c index 04f878c52..fd2e6f9df 100644 --- a/libxfs/trans.c +++ b/libxfs/trans.c @@ -1009,6 +1009,7 @@ libxfs_trans_alloc_inode( struct xfs_inode *ip, struct xfs_trans_res *resv, unsigned int dblocks, + unsigned int rblocks, bool force, struct xfs_trans **tpp) { @@ -1016,7 +1017,8 @@ libxfs_trans_alloc_inode( struct xfs_mount *mp = ip->i_mount; int error; - error = libxfs_trans_alloc(mp, resv, dblocks, 0, + error = libxfs_trans_alloc(mp, resv, dblocks, + rblocks / mp->m_sb.sb_rextsize, force ? XFS_TRANS_RESERVE : 0, &tp); if (error) return error; diff --git a/libxfs/xfs_attr.c b/libxfs/xfs_attr.c index 8cf631b67..f7ed4e267 100644 --- a/libxfs/xfs_attr.c +++ b/libxfs/xfs_attr.c @@ -458,7 +458,7 @@ xfs_attr_set( * Root fork attributes can use reserved data blocks for this * operation if necessary */ - error = xfs_trans_alloc_inode(dp, &tres, total, rsvd, &args->trans); + error = xfs_trans_alloc_inode(dp, &tres, total, 0, rsvd, &args->trans); if (error) return error; diff --git a/libxfs/xfs_bmap.c b/libxfs/xfs_bmap.c index 445280f44..52e680dec 100644 --- a/libxfs/xfs_bmap.c +++ b/libxfs/xfs_bmap.c @@ -1072,7 +1072,7 @@ xfs_bmap_add_attrfork( blks = XFS_ADDAFORK_SPACE_RES(mp); - error = xfs_trans_alloc_inode(ip, &M_RES(mp)->tr_addafork, blks, + error = xfs_trans_alloc_inode(ip, &M_RES(mp)->tr_addafork, blks, 0, rsvd, &tp); if (error) return error;