]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: allow reservation of rtblocks with xfs_trans_alloc_inode
authorDarrick J. Wong <djwong@kernel.org>
Tue, 6 Apr 2021 20:56:27 +0000 (16:56 -0400)
committerEric Sandeen <sandeen@sandeen.net>
Tue, 6 Apr 2021 20:56:27 +0000 (16:56 -0400)
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 <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>
include/xfs_trans.h
libxfs/trans.c
libxfs/xfs_attr.c
libxfs/xfs_bmap.c

index 281caf306d031a45c7cf85d9d24195c419e93ddd..ad76ecfddebc9e6e11eea4506a33764e5f158742 100644 (file)
@@ -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);
index 04f878c521a0ce4a26d6798c28a01201ae5e0bb6..fd2e6f9dfbd99beec2dc24366e8ac1abd7905195 100644 (file)
@@ -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;
index 8cf631b675def13d1aa299bfffdf39084799543a..f7ed4e267894430f5a84a03c4bfa84d1aa545543 100644 (file)
@@ -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;
 
index 445280f44a6e8b176b3ac91a523a700a3c35b5ae..52e680dec6d494c6cb1e9c685f81ff9cfc278460 100644 (file)
@@ -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;