aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs
diff options
context:
space:
mode:
authorJeff Liu <jeff.liu@oracle.com>2013-01-28 08:27:15 -0500
committerBen Myers <bpm@sgi.com>2013-02-01 15:44:29 -0500
commita1bd9557544d59140c4ac87fe405069b9e1aaf99 (patch)
tree5eb50503490c1882d7c15afc05a9260ee54d23ae /fs/xfs
parent4800104438a4467ffa5ae1e51d5a59c0f64e5f9a (diff)
xfs: calculate XFS_TRANS_QM_QUOTAOFF space log reservation at mount time
Convert the calculation of quota off transaction log space reservation from runtime to mount time. Signed-off-by: Jie Liu <jeff.liu@oracle.com> CC: Dave Chinner <david@fromorbit.com> Reviewed-by: Mark Tinguely <tinguely@sgi.com> Signed-off-by: Ben Myers <bpm@sgi.com>
Diffstat (limited to 'fs/xfs')
-rw-r--r--fs/xfs/xfs_mount.h1
-rw-r--r--fs/xfs/xfs_qm_syscalls.c10
-rw-r--r--fs/xfs/xfs_trans.c14
-rw-r--r--fs/xfs/xfs_trans.h1
4 files changed, 19 insertions, 7 deletions
diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h
index fc500c6c8800..4f5e148ffd1c 100644
--- a/fs/xfs/xfs_mount.h
+++ b/fs/xfs/xfs_mount.h
@@ -43,6 +43,7 @@ typedef struct xfs_trans_reservations {
43 uint tr_qm_sbchange; /* change quota flags */ 43 uint tr_qm_sbchange; /* change quota flags */
44 uint tr_qm_setqlim; /* adjust quota limits */ 44 uint tr_qm_setqlim; /* adjust quota limits */
45 uint tr_qm_dqalloc; /* allocate quota on disk */ 45 uint tr_qm_dqalloc; /* allocate quota on disk */
46 uint tr_qm_quotaoff; /* turn quota off */
46} xfs_trans_reservations_t; 47} xfs_trans_reservations_t;
47 48
48#ifndef __KERNEL__ 49#ifndef __KERNEL__
diff --git a/fs/xfs/xfs_qm_syscalls.c b/fs/xfs/xfs_qm_syscalls.c
index 1476b6fd4ed5..4605f8914cb4 100644
--- a/fs/xfs/xfs_qm_syscalls.c
+++ b/fs/xfs/xfs_qm_syscalls.c
@@ -672,14 +672,10 @@ xfs_qm_log_quotaoff(
672 uint oldsbqflag=0; 672 uint oldsbqflag=0;
673 673
674 tp = xfs_trans_alloc(mp, XFS_TRANS_QM_QUOTAOFF); 674 tp = xfs_trans_alloc(mp, XFS_TRANS_QM_QUOTAOFF);
675 if ((error = xfs_trans_reserve(tp, 0, 675 error = xfs_trans_reserve(tp, 0, XFS_QM_QUOTAOFF_LOG_RES(mp),
676 sizeof(xfs_qoff_logitem_t) * 2 + 676 0, 0, XFS_DEFAULT_LOG_COUNT);
677 mp->m_sb.sb_sectsize + 128, 677 if (error)
678 0,
679 0,
680 XFS_DEFAULT_LOG_COUNT))) {
681 goto error0; 678 goto error0;
682 }
683 679
684 qoffi = xfs_trans_get_qoff_item(tp, NULL, flags & XFS_ALL_QUOTA_ACCT); 680 qoffi = xfs_trans_get_qoff_item(tp, NULL, flags & XFS_ALL_QUOTA_ACCT);
685 xfs_trans_log_quotaoff_item(tp, qoffi); 681 xfs_trans_log_quotaoff_item(tp, qoffi);
diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c
index 6dd2c043efcd..a557c82e58f0 100644
--- a/fs/xfs/xfs_trans.c
+++ b/fs/xfs/xfs_trans.c
@@ -582,6 +582,19 @@ xfs_calc_qm_dqalloc_reservation(
582} 582}
583 583
584/* 584/*
585 * Turning off quotas.
586 * the xfs_qoff_logitem_t: sizeof(struct xfs_qoff_logitem) * 2
587 * the superblock for the quota flags: sector size
588 */
589STATIC uint
590xfs_calc_qm_quotaoff_reservation(
591 struct xfs_mount *mp)
592{
593 return sizeof(struct xfs_qoff_logitem) * 2 +
594 xfs_calc_buf_res(1, mp->m_sb.sb_sectsize);
595}
596
597/*
585 * Initialize the precomputed transaction reservation values 598 * Initialize the precomputed transaction reservation values
586 * in the mount structure. 599 * in the mount structure.
587 */ 600 */
@@ -615,6 +628,7 @@ xfs_trans_init(
615 resp->tr_qm_sbchange = xfs_calc_qm_sbchange_reservation(mp); 628 resp->tr_qm_sbchange = xfs_calc_qm_sbchange_reservation(mp);
616 resp->tr_qm_setqlim = xfs_calc_qm_setqlim_reservation(mp); 629 resp->tr_qm_setqlim = xfs_calc_qm_setqlim_reservation(mp);
617 resp->tr_qm_dqalloc = xfs_calc_qm_dqalloc_reservation(mp); 630 resp->tr_qm_dqalloc = xfs_calc_qm_dqalloc_reservation(mp);
631 resp->tr_qm_quotaoff = xfs_calc_qm_quotaoff_reservation(mp);
618} 632}
619 633
620/* 634/*
diff --git a/fs/xfs/xfs_trans.h b/fs/xfs/xfs_trans.h
index 04575db806d4..1e103dad17d1 100644
--- a/fs/xfs/xfs_trans.h
+++ b/fs/xfs/xfs_trans.h
@@ -265,6 +265,7 @@ struct xfs_log_item_desc {
265#define XFS_QM_SBCHANGE_LOG_RES(mp) ((mp)->m_reservations.tr_qm_sbchange) 265#define XFS_QM_SBCHANGE_LOG_RES(mp) ((mp)->m_reservations.tr_qm_sbchange)
266#define XFS_QM_SETQLIM_LOG_RES(mp) ((mp)->m_reservations.tr_qm_setqlim) 266#define XFS_QM_SETQLIM_LOG_RES(mp) ((mp)->m_reservations.tr_qm_setqlim)
267#define XFS_QM_DQALLOC_LOG_RES(mp) ((mp)->m_reservations.tr_qm_dqalloc) 267#define XFS_QM_DQALLOC_LOG_RES(mp) ((mp)->m_reservations.tr_qm_dqalloc)
268#define XFS_QM_QUOTAOFF_LOG_RES(mp) ((mp)->m_reservations.tr_qm_quotaoff)
268 269
269/* 270/*
270 * Various log count values. 271 * Various log count values.