[PATCH v2 11/12] xfs: calculate XFS_TRANS_DUMMY1 space log reservation at mount time

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Convert the calculation of log dummy1 transaction
 space log reservation from runtime to mount time.

Signed-off-by: Jie Liu <jeff.liu@xxxxxxxxxx>
---
 fs/xfs/xfs_fsops.c |    4 ++--
 fs/xfs/xfs_mount.h |    1 +
 fs/xfs/xfs_trans.c |   12 ++++++++++++
 fs/xfs/xfs_trans.h |    1 +
 4 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c
index 4beaede..7649d26 100644
--- a/fs/xfs/xfs_fsops.c
+++ b/fs/xfs/xfs_fsops.c
@@ -662,8 +662,8 @@ xfs_fs_log_dummy(
 	int		error;
 
 	tp = _xfs_trans_alloc(mp, XFS_TRANS_DUMMY1, KM_SLEEP);
-	error = xfs_trans_reserve(tp, 0, mp->m_sb.sb_sectsize + 128, 0, 0,
-					XFS_DEFAULT_LOG_COUNT);
+	error = xfs_trans_reserve(tp, 0, XFS_LOG_DUMMY1_LOG_RES(mp),
+				  0, 0, XFS_DEFAULT_LOG_COUNT);
 	if (error) {
 		xfs_trans_cancel(tp, 0);
 		return error;
diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h
index 7739e24..97f7962 100644
--- a/fs/xfs/xfs_mount.h
+++ b/fs/xfs/xfs_mount.h
@@ -47,6 +47,7 @@ typedef struct xfs_trans_reservations {
 	uint	tr_qm_equotaoff;/* end of turn quota off */
 	uint	tr_sicsbcount;	/* sync incore super block counters */
 	uint	tr_sicsbunit;	/* sync incore super block units */
+	uint	tr_logdummy1;	/* log a dummy trans */
 } xfs_trans_reservations_t;
 
 #ifndef __KERNEL__
diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c
index 079ded8..398c2a0 100644
--- a/fs/xfs/xfs_trans.c
+++ b/fs/xfs/xfs_trans.c
@@ -627,6 +627,17 @@ xfs_calc_sync_icsbunit_reservation(
 }
 
 /*
+ * Dumping a transaction into the log that contains no real change.
+ * 	sector size
+ */
+STATIC uint
+xfs_calc_logdummy1_reservation(
+	struct xfs_mount	*mp)
+{
+	return xfs_calc_buf_res(1, mp->m_sb.sb_sectsize);
+}
+
+/*
  * Initialize the precomputed transaction reservation values
  * in the mount structure.
  */
@@ -664,6 +675,7 @@ xfs_trans_init(
 	resp->tr_qm_equotaoff = xfs_calc_qm_quotaoff_end_reservation(mp);
 	resp->tr_sicsbcount = xfs_calc_sync_icsbcount_reservation(mp);
 	resp->tr_sicsbunit = xfs_calc_sync_icsbunit_reservation(mp);
+	resp->tr_logdummy1 = xfs_calc_logdummy1_reservation(mp);
 }
 
 /*
diff --git a/fs/xfs/xfs_trans.h b/fs/xfs/xfs_trans.h
index d2f0007..69a05a2 100644
--- a/fs/xfs/xfs_trans.h
+++ b/fs/xfs/xfs_trans.h
@@ -269,6 +269,7 @@ struct xfs_log_item_desc {
 #define XFS_QM_QUOTAOFF_END_LOG_RES(mp)	((mp)->m_reservations.tr_qm_equotaoff)
 #define XFS_SYNC_ICSBCOUNT_LOG_RES(mp)	((mp)->m_reservations.tr_sicsbcount)
 #define XFS_SYNC_ICSBUNIT_LOG_RES(mp)	((mp)->m_reservations.tr_sicsbunit)
+#define XFS_LOG_DUMMY1_LOG_RES(mp)	((mp)->m_reservations.tr_logdummy1)
 
 /*
  * Various log count values.
-- 
1.7.9.5

_______________________________________________
xfs mailing list
xfs@xxxxxxxxxxx
http://oss.sgi.com/mailman/listinfo/xfs


[Index of Archives]     [Linux XFS Devel]     [Linux Filesystem Development]     [Filesystem Testing]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux