mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-28 11:18:45 +07:00
xfs: xfs_defer_capture should absorb remaining transaction reservation
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>
This commit is contained in:
parent
4f9a60c480
commit
929b92f640
@ -579,6 +579,9 @@ xfs_defer_ops_capture(
|
|||||||
dfc->dfc_blkres = tp->t_blk_res - tp->t_blk_res_used;
|
dfc->dfc_blkres = tp->t_blk_res - tp->t_blk_res_used;
|
||||||
dfc->dfc_rtxres = tp->t_rtx_res - tp->t_rtx_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;
|
return dfc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,6 +79,9 @@ struct xfs_defer_capture {
|
|||||||
/* Block reservations for the data and rt devices. */
|
/* Block reservations for the data and rt devices. */
|
||||||
unsigned int dfc_blkres;
|
unsigned int dfc_blkres;
|
||||||
unsigned int dfc_rtxres;
|
unsigned int dfc_rtxres;
|
||||||
|
|
||||||
|
/* Log reservation saved from the transaction. */
|
||||||
|
unsigned int dfc_logres;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -2442,9 +2442,20 @@ xlog_finish_defer_ops(
|
|||||||
int error = 0;
|
int error = 0;
|
||||||
|
|
||||||
list_for_each_entry_safe(dfc, next, capture_list, dfc_list) {
|
list_for_each_entry_safe(dfc, next, capture_list, dfc_list) {
|
||||||
error = xfs_trans_alloc(mp, &M_RES(mp)->tr_itruncate,
|
struct xfs_trans_res resv;
|
||||||
dfc->dfc_blkres, dfc->dfc_rtxres,
|
|
||||||
XFS_TRANS_RESERVE, &tp);
|
/*
|
||||||
|
* Create a new transaction reservation from the captured
|
||||||
|
* information. Set logcount to 1 to force the new transaction
|
||||||
|
* to regrant every roll so that we can make forward progress
|
||||||
|
* in recovery no matter how full the log might be.
|
||||||
|
*/
|
||||||
|
resv.tr_logres = dfc->dfc_logres;
|
||||||
|
resv.tr_logcount = 1;
|
||||||
|
resv.tr_logflags = XFS_TRANS_PERM_LOG_RES;
|
||||||
|
|
||||||
|
error = xfs_trans_alloc(mp, &resv, dfc->dfc_blkres,
|
||||||
|
dfc->dfc_rtxres, XFS_TRANS_RESERVE, &tp);
|
||||||
if (error)
|
if (error)
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user