diff options
author | Jeff Liu <jeff.liu@oracle.com> | 2013-01-28 08:27:21 -0500 |
---|---|---|
committer | Ben Myers <bpm@sgi.com> | 2013-02-01 15:45:50 -0500 |
commit | 762d7ba657ed4a0934b4da7dcef058012f252e0f (patch) | |
tree | 631ac6adc3f028ea55339889ad870206c3ccef23 /fs | |
parent | a1bd9557544d59140c4ac87fe405069b9e1aaf99 (diff) |
xfs: calculate XFS_TRANS_QM_QUOTAOFF_END space log reservation at mount time
Convert the calculation for end of quotaoff 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')
-rw-r--r-- | fs/xfs/xfs_mount.h | 1 | ||||
-rw-r--r-- | fs/xfs/xfs_qm_syscalls.c | 5 | ||||
-rw-r--r-- | fs/xfs/xfs_trans.c | 12 | ||||
-rw-r--r-- | fs/xfs/xfs_trans.h | 1 |
4 files changed, 17 insertions, 2 deletions
diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h index 4f5e148ffd1c..b46009dc7b13 100644 --- a/fs/xfs/xfs_mount.h +++ b/fs/xfs/xfs_mount.h | |||
@@ -44,6 +44,7 @@ typedef struct xfs_trans_reservations { | |||
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 | uint tr_qm_quotaoff; /* turn quota off */ |
47 | uint tr_qm_equotaoff;/* end of turn quota off */ | ||
47 | } xfs_trans_reservations_t; | 48 | } xfs_trans_reservations_t; |
48 | 49 | ||
49 | #ifndef __KERNEL__ | 50 | #ifndef __KERNEL__ |
diff --git a/fs/xfs/xfs_qm_syscalls.c b/fs/xfs/xfs_qm_syscalls.c index 4605f8914cb4..cf9a34051e07 100644 --- a/fs/xfs/xfs_qm_syscalls.c +++ b/fs/xfs/xfs_qm_syscalls.c | |||
@@ -639,8 +639,9 @@ xfs_qm_log_quotaoff_end( | |||
639 | 639 | ||
640 | tp = xfs_trans_alloc(mp, XFS_TRANS_QM_QUOTAOFF_END); | 640 | tp = xfs_trans_alloc(mp, XFS_TRANS_QM_QUOTAOFF_END); |
641 | 641 | ||
642 | if ((error = xfs_trans_reserve(tp, 0, sizeof(xfs_qoff_logitem_t) * 2, | 642 | error = xfs_trans_reserve(tp, 0, XFS_QM_QUOTAOFF_END_LOG_RES(mp), |
643 | 0, 0, XFS_DEFAULT_LOG_COUNT))) { | 643 | 0, 0, XFS_DEFAULT_LOG_COUNT); |
644 | if (error) { | ||
644 | xfs_trans_cancel(tp, 0); | 645 | xfs_trans_cancel(tp, 0); |
645 | return (error); | 646 | return (error); |
646 | } | 647 | } |
diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c index a557c82e58f0..84643fa5e465 100644 --- a/fs/xfs/xfs_trans.c +++ b/fs/xfs/xfs_trans.c | |||
@@ -595,6 +595,17 @@ xfs_calc_qm_quotaoff_reservation( | |||
595 | } | 595 | } |
596 | 596 | ||
597 | /* | 597 | /* |
598 | * End of turning off quotas. | ||
599 | * the xfs_qoff_logitem_t: sizeof(struct xfs_qoff_logitem) * 2 | ||
600 | */ | ||
601 | STATIC uint | ||
602 | xfs_calc_qm_quotaoff_end_reservation( | ||
603 | struct xfs_mount *mp) | ||
604 | { | ||
605 | return sizeof(struct xfs_qoff_logitem) * 2; | ||
606 | } | ||
607 | |||
608 | /* | ||
598 | * Initialize the precomputed transaction reservation values | 609 | * Initialize the precomputed transaction reservation values |
599 | * in the mount structure. | 610 | * in the mount structure. |
600 | */ | 611 | */ |
@@ -629,6 +640,7 @@ xfs_trans_init( | |||
629 | resp->tr_qm_setqlim = xfs_calc_qm_setqlim_reservation(mp); | 640 | resp->tr_qm_setqlim = xfs_calc_qm_setqlim_reservation(mp); |
630 | resp->tr_qm_dqalloc = xfs_calc_qm_dqalloc_reservation(mp); | 641 | resp->tr_qm_dqalloc = xfs_calc_qm_dqalloc_reservation(mp); |
631 | resp->tr_qm_quotaoff = xfs_calc_qm_quotaoff_reservation(mp); | 642 | resp->tr_qm_quotaoff = xfs_calc_qm_quotaoff_reservation(mp); |
643 | resp->tr_qm_equotaoff = xfs_calc_qm_quotaoff_end_reservation(mp); | ||
632 | } | 644 | } |
633 | 645 | ||
634 | /* | 646 | /* |
diff --git a/fs/xfs/xfs_trans.h b/fs/xfs/xfs_trans.h index 1e103dad17d1..57339e404cf6 100644 --- a/fs/xfs/xfs_trans.h +++ b/fs/xfs/xfs_trans.h | |||
@@ -266,6 +266,7 @@ struct xfs_log_item_desc { | |||
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 | #define XFS_QM_QUOTAOFF_LOG_RES(mp) ((mp)->m_reservations.tr_qm_quotaoff) |
269 | #define XFS_QM_QUOTAOFF_END_LOG_RES(mp) ((mp)->m_reservations.tr_qm_equotaoff) | ||
269 | 270 | ||
270 | /* | 271 | /* |
271 | * Various log count values. | 272 | * Various log count values. |