[PATCH v2 10/12] xfs: calculate XFS_TRANS_SB_UNIT space log reservation at mount time

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

 



Convert the calculation of sync incore superblock units transaction log space reservation
from runtime to mount time.

Signed-off-by: Jie Liu <jeff.liu@xxxxxxxxxx>
---
 fs/xfs/xfs_mount.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_mount.c b/fs/xfs/xfs_mount.c
index a596705..ac3405e 100644
--- a/fs/xfs/xfs_mount.c
+++ b/fs/xfs/xfs_mount.c
@@ -1912,8 +1912,8 @@ xfs_mount_log_sb(
 			 XFS_SB_VERSIONNUM));
 
 	tp = xfs_trans_alloc(mp, XFS_TRANS_SB_UNIT);
-	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_SYNC_ICSBUNIT_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 d119a56..7739e24 100644
--- a/fs/xfs/xfs_mount.h
+++ b/fs/xfs/xfs_mount.h
@@ -46,6 +46,7 @@ typedef struct xfs_trans_reservations {
 	uint	tr_qm_quotaoff;	/* turn quota off */
 	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 */
 } xfs_trans_reservations_t;
 
 #ifndef __KERNEL__
diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c
index ae48a8d..079ded8 100644
--- a/fs/xfs/xfs_trans.c
+++ b/fs/xfs/xfs_trans.c
@@ -616,6 +616,17 @@ xfs_calc_sync_icsbcount_reservation(
 }
 
 /*
+ * Logging changes to the superblock unit and width fields.
+ *	the first super block to reflected the changes: sector size
+ */
+STATIC uint
+xfs_calc_sync_icsbunit_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.
  */
@@ -652,6 +663,7 @@ xfs_trans_init(
 	resp->tr_qm_quotaoff = xfs_calc_qm_quotaoff_reservation(mp);
 	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);
 }
 
 /*
diff --git a/fs/xfs/xfs_trans.h b/fs/xfs/xfs_trans.h
index 637f59b..d2f0007 100644
--- a/fs/xfs/xfs_trans.h
+++ b/fs/xfs/xfs_trans.h
@@ -268,6 +268,7 @@ struct xfs_log_item_desc {
 #define XFS_QM_QUOTAOFF_LOG_RES(mp)	((mp)->m_reservations.tr_qm_quotaoff)
 #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)
 
 /*
  * 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