diff mbox series

[15/21] xfs: xfs_defer_capture should absorb remaining transaction reservation

Message ID 160375551194.882906.1246656019413196331.stgit@magnolia
State Accepted
Headers show
Series xfsprogs: sync with 5.10, part 2 | expand

Commit Message

Darrick J. Wong Oct. 26, 2020, 11:38 p.m. UTC
From: Darrick J. Wong <darrick.wong@oracle.com>

Source kernel commit: 929b92f64048d90d23e40a59c47adf59f5026903

When xfs_defer_capture extracts the deferred ops and transaction state
from a transaction, it should record the transaction reservation type
from the old transaction so that when we continue the dfops chain, we
still use the same reservation parameters.

Doing this means that the log item recovery functions get to determine
the transaction reservation instead of abusing tr_itruncate in yet
another part of xfs.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 libxfs/xfs_defer.c |    3 +++
 libxfs/xfs_defer.h |    3 +++
 2 files changed, 6 insertions(+)
diff mbox series

Patch

diff --git a/libxfs/xfs_defer.c b/libxfs/xfs_defer.c
index fc5c860e5d56..8e660f1a6cfc 100644
--- a/libxfs/xfs_defer.c
+++ b/libxfs/xfs_defer.c
@@ -577,6 +577,9 @@  xfs_defer_ops_capture(
 	dfc->dfc_blkres = tp->t_blk_res - tp->t_blk_res_used;
 	dfc->dfc_rtxres = tp->t_rtx_res - tp->t_rtx_res_used;
 
+	/* Preserve the log reservation size. */
+	dfc->dfc_logres = tp->t_log_res;
+
 	return dfc;
 }
 
diff --git a/libxfs/xfs_defer.h b/libxfs/xfs_defer.h
index 5c0e59b69ffa..6cde6f0713f7 100644
--- a/libxfs/xfs_defer.h
+++ b/libxfs/xfs_defer.h
@@ -79,6 +79,9 @@  struct xfs_defer_capture {
 	/* Block reservations for the data and rt devices. */
 	unsigned int		dfc_blkres;
 	unsigned int		dfc_rtxres;
+
+	/* Log reservation saved from the transaction. */
+	unsigned int		dfc_logres;
 };
 
 /*