]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: add firstblock field to xfs_trans
authorBrian Foster <bfoster@redhat.com>
Fri, 5 Oct 2018 02:35:54 +0000 (21:35 -0500)
committerEric Sandeen <sandeen@redhat.com>
Fri, 5 Oct 2018 02:35:54 +0000 (21:35 -0500)
Source kernel commit: bba59c5e4b38e160c6be25b2f4fe36ebc84f53df

A firstblock var is typically allocated and initialized along with
xfs_defer_ops structures and passed around independent from the
associated transaction. To facilitate combining the two, add an
optional ->t_firstblock field to xfs_trans that can be used in place
of an on-stack variable.

The firstblock value follows the lifetime of the transaction, so
initialize it on allocation and when a transaction rolls.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
include/xfs_trans.h
libxfs/trans.c

index 3cabf3d23c6679f03474b7b38907de3b972e04aa..1ad4e958d4a09fa7142999c6f9f2abb1888870c5 100644 (file)
@@ -65,6 +65,7 @@ typedef struct xfs_trans {
        unsigned int    t_log_res;              /* amt of log space resvd */
        unsigned int    t_log_count;            /* count for perm log res */
        unsigned int    t_blk_res;              /* # of blocks resvd */
+       xfs_fsblock_t   t_firstblock;           /* first block allocated */
        struct xfs_mount *t_mountp;             /* ptr to fs mount struct */
        unsigned int    t_blk_res_used;         /* # of resvd blocks used */
        unsigned int    t_flags;                /* misc flags */
index 2fef72914d5819c88ef3d1b6d84d4c791c7a0c00..bee4a761c60a8a604a51da2e4f89c8909cd60ba8 100644 (file)
@@ -146,6 +146,7 @@ xfs_trans_dup(
         */
        ntp->t_mountp = tp->t_mountp;
        INIT_LIST_HEAD(&ntp->t_items);
+       ntp->t_firstblock = NULLFSBLOCK;
 
        ASSERT(tp->t_flags & XFS_TRANS_PERM_LOG_RES);
 
@@ -257,6 +258,7 @@ libxfs_trans_alloc(
                (flags & XFS_TRANS_NOFS) ? KM_NOFS : KM_SLEEP);
        tp->t_mountp = mp;
        INIT_LIST_HEAD(&tp->t_items);
+       tp->t_firstblock = NULLFSBLOCK;
 
        error = xfs_trans_reserve(tp, resp, blocks, rtextents);
        if (error) {