[RFC v5 PATCH 2/9] xfs: introduce ->tr_relog transaction

Brian Foster
2020-02-27T13:43:28Z

Create a transaction reservation specifically for relog
transactions. For now it only supports the quotaoff intent, so use
the associated reservation.

Signed-off-by: Brian Foster <bfoster@redhat.com>
---
fs/xfs/libxfs/xfs_trans_resv.c | 15 +++++++++++++++
fs/xfs/libxfs/xfs_trans_resv.h | 1 +
2 files changed, 16 insertions(+)

diff --git a/fs/xfs/libxfs/xfs_trans_resv.c b/fs/xfs/libxfs/xfs_trans_resv.c
index 7a9c04920505..1f5c9e6e1afc 100644
--- a/fs/xfs/libxfs/xfs_trans_resv.c
+++ b/fs/xfs/libxfs/xfs_trans_resv.c
@@ -832,6 +832,17 @@ xfs_calc_sb_reservation(
return xfs_calc_buf_res(1, mp->m_sb.sb_sectsize);
}

+/*
+ * Internal relog transaction.
+ * quotaoff intent
+ */
+STATIC uint
+xfs_calc_relog_reservation(
+ struct xfs_mount *mp)
+{
+ return xfs_calc_qm_quotaoff_reservation(mp);
+}
+
void
xfs_trans_resv_calc(
struct xfs_mount *mp,
@@ -946,4 +957,8 @@ xfs_trans_resv_calc(
resp->tr_clearagi.tr_logres = xfs_calc_clear_agi_bucket_reservation(mp);
resp->tr_growrtzero.tr_logres = xfs_calc_growrtzero_reservation(mp);
resp->tr_growrtfree.tr_logres = xfs_calc_growrtfree_reservation(mp);
+
+ resp->tr_relog.tr_logres = xfs_calc_relog_reservation(mp);
+ resp->tr_relog.tr_logcount = XFS_DEFAULT_PERM_LOG_COUNT;
+ resp->tr_relog.tr_logflags |= XFS_TRANS_PERM_LOG_RES;
}
diff --git a/fs/xfs/libxfs/xfs_trans_resv.h b/fs/xfs/libxfs/xfs_trans_resv.h
index 7241ab28cf84..b723979cad09 100644
--- a/fs/xfs/libxfs/xfs_trans_resv.h
+++ b/fs/xfs/libxfs/xfs_trans_resv.h
@@ -50,6 +50,7 @@ struct xfs_trans_resv {
struct xfs_trans_res tr_qm_equotaoff;/* end of turn quota off */
struct xfs_trans_res tr_sb; /* modify superblock */
struct xfs_trans_res tr_fsyncts; /* update timestamps on fsync */
+ struct xfs_trans_res tr_relog; /* internal relog transaction */
};

/* shorthand way of accessing reservation structure */
--
2.21.1