]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: xfs_defer_capture should absorb remaining block reservations
authorDarrick J. Wong <darrick.wong@oracle.com>
Thu, 12 Nov 2020 22:21:10 +0000 (17:21 -0500)
committerEric Sandeen <sandeen@sandeen.net>
Thu, 12 Nov 2020 22:21:10 +0000 (17:21 -0500)
Source kernel commit: 4f9a60c48078c0efa3459678fa8d6e050e8ada5d

When xfs_defer_capture extracts the deferred ops and transaction state
from a transaction, it should record the remaining block reservations so
that when we continue the dfops chain, we can reserve the same number of
blocks to use.  We capture the reservations for both data and realtime
volumes.

This adds the requirement that every log intent item recovery function
must be careful to reserve enough blocks to handle both itself and all
defer ops that it can queue.  On the other hand, this enables us to do
away with the handwaving block estimation nonsense that was going on in
xlog_finish_defer_ops.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
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/xfs_defer.c
libxfs/xfs_defer.h

index 9292a4a542372665b9c7007baf7564a07ddedea9..6daf35cfcf7671d2826db928c74419cb058eb59c 100644 (file)
@@ -64,10 +64,12 @@ 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_rtx_res;              /* # of rt extents resvd */
+       unsigned int    t_rtx_res_used;         /* # of resvd rt extents used */
        unsigned int    t_flags;                /* misc flags */
+       xfs_fsblock_t   t_firstblock;           /* first block allocated */
+       struct xfs_mount *t_mountp;             /* ptr to fs mount struct */
        long            t_icount_delta;         /* superblock icount change */
        long            t_ifree_delta;          /* superblock ifree change */
        long            t_fdblocks_delta;       /* superblock fdblocks chg */
index 90dc9ce921062f69d1b8510dc755e29b486a48ac..fc5c860e5d56918d12ff3d61e6fe2623da6ea385 100644 (file)
@@ -573,6 +573,10 @@ xfs_defer_ops_capture(
        dfc->dfc_tpflags = tp->t_flags & XFS_TRANS_LOWMODE;
        tp->t_flags &= ~XFS_TRANS_LOWMODE;
 
+       /* Capture the remaining block reservations along with the dfops. */
+       dfc->dfc_blkres = tp->t_blk_res - tp->t_blk_res_used;
+       dfc->dfc_rtxres = tp->t_rtx_res - tp->t_rtx_res_used;
+
        return dfc;
 }
 
index 3af82ebc124966778b582f21979361e9782fc988..5c0e59b69ffa9fbc498bfae3951a6945f9e55144 100644 (file)
@@ -75,6 +75,10 @@ struct xfs_defer_capture {
        /* Deferred ops state saved from the transaction. */
        struct list_head        dfc_dfops;
        unsigned int            dfc_tpflags;
+
+       /* Block reservations for the data and rt devices. */
+       unsigned int            dfc_blkres;
+       unsigned int            dfc_rtxres;
 };
 
 /*