diff options
| author | Jeff Liu <jeff.liu@oracle.com> | 2013-01-28 08:26:49 -0500 |
|---|---|---|
| committer | Ben Myers <bpm@sgi.com> | 2013-02-01 15:43:11 -0500 |
| commit | f0f2df94faca43fd26f85af7e83df240777c8c37 (patch) | |
| tree | 21b0af2cfb1cb7df0a5c4f501d263f96e4af0924 | |
| parent | f910a8c620e21fdb53384ad741ff9e4995cc6e67 (diff) | |
xfs: calcuate XFS_TRANS_QM_SETQLIM space log reservation at mount time
For adjusting quota limits transactions, we calculate out the log space
reservation at runtime, this patch does it at 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>
| -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 4e9aa9524840..9baa7e0fbd45 100644 --- a/fs/xfs/xfs_mount.h +++ b/fs/xfs/xfs_mount.h | |||
| @@ -41,6 +41,7 @@ typedef struct xfs_trans_reservations { | |||
| 41 | uint tr_growrtzero; /* grow realtime zeroing */ | 41 | uint tr_growrtzero; /* grow realtime zeroing */ |
| 42 | uint tr_growrtfree; /* grow realtime freeing */ | 42 | uint tr_growrtfree; /* grow realtime freeing */ |
| 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 | } xfs_trans_reservations_t; | 45 | } xfs_trans_reservations_t; |
| 45 | 46 | ||
| 46 | #ifndef __KERNEL__ | 47 | #ifndef __KERNEL__ |
diff --git a/fs/xfs/xfs_qm_syscalls.c b/fs/xfs/xfs_qm_syscalls.c index 33d9c2b6f555..1476b6fd4ed5 100644 --- a/fs/xfs/xfs_qm_syscalls.c +++ b/fs/xfs/xfs_qm_syscalls.c | |||
| @@ -490,8 +490,9 @@ xfs_qm_scall_setqlim( | |||
| 490 | return 0; | 490 | return 0; |
| 491 | 491 | ||
| 492 | tp = xfs_trans_alloc(mp, XFS_TRANS_QM_SETQLIM); | 492 | tp = xfs_trans_alloc(mp, XFS_TRANS_QM_SETQLIM); |
| 493 | if ((error = xfs_trans_reserve(tp, 0, sizeof(xfs_disk_dquot_t) + 128, | 493 | error = xfs_trans_reserve(tp, 0, XFS_QM_SETQLIM_LOG_RES(mp), |
| 494 | 0, 0, XFS_DEFAULT_LOG_COUNT))) { | 494 | 0, 0, XFS_DEFAULT_LOG_COUNT); |
| 495 | if (error) { | ||
| 495 | xfs_trans_cancel(tp, 0); | 496 | xfs_trans_cancel(tp, 0); |
| 496 | return (error); | 497 | return (error); |
| 497 | } | 498 | } |
diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c index 6ba62c0e24d1..1838850de145 100644 --- a/fs/xfs/xfs_trans.c +++ b/fs/xfs/xfs_trans.c | |||
| @@ -557,6 +557,17 @@ xfs_calc_qm_sbchange_reservation( | |||
| 557 | } | 557 | } |
| 558 | 558 | ||
| 559 | /* | 559 | /* |
| 560 | * Adjusting quota limits. | ||
| 561 | * the xfs_disk_dquot_t: sizeof(struct xfs_disk_dquot) | ||
| 562 | */ | ||
| 563 | STATIC uint | ||
| 564 | xfs_calc_qm_setqlim_reservation( | ||
| 565 | struct xfs_mount *mp) | ||
| 566 | { | ||
| 567 | return xfs_calc_buf_res(1, sizeof(struct xfs_disk_dquot)); | ||
| 568 | } | ||
| 569 | |||
| 570 | /* | ||
| 560 | * Initialize the precomputed transaction reservation values | 571 | * Initialize the precomputed transaction reservation values |
| 561 | * in the mount structure. | 572 | * in the mount structure. |
| 562 | */ | 573 | */ |
| @@ -588,6 +599,7 @@ xfs_trans_init( | |||
| 588 | resp->tr_growrtzero = xfs_calc_growrtzero_reservation(mp); | 599 | resp->tr_growrtzero = xfs_calc_growrtzero_reservation(mp); |
| 589 | resp->tr_growrtfree = xfs_calc_growrtfree_reservation(mp); | 600 | resp->tr_growrtfree = xfs_calc_growrtfree_reservation(mp); |
| 590 | resp->tr_qm_sbchange = xfs_calc_qm_sbchange_reservation(mp); | 601 | resp->tr_qm_sbchange = xfs_calc_qm_sbchange_reservation(mp); |
| 602 | resp->tr_qm_setqlim = xfs_calc_qm_setqlim_reservation(mp); | ||
| 591 | } | 603 | } |
| 592 | 604 | ||
| 593 | /* | 605 | /* |
diff --git a/fs/xfs/xfs_trans.h b/fs/xfs/xfs_trans.h index a690f2803594..93a0ec73c6fe 100644 --- a/fs/xfs/xfs_trans.h +++ b/fs/xfs/xfs_trans.h | |||
| @@ -263,6 +263,7 @@ struct xfs_log_item_desc { | |||
| 263 | #define XFS_ATTRRM_LOG_RES(mp) ((mp)->m_reservations.tr_attrrm) | 263 | #define XFS_ATTRRM_LOG_RES(mp) ((mp)->m_reservations.tr_attrrm) |
| 264 | #define XFS_CLEAR_AGI_BUCKET_LOG_RES(mp) ((mp)->m_reservations.tr_clearagi) | 264 | #define XFS_CLEAR_AGI_BUCKET_LOG_RES(mp) ((mp)->m_reservations.tr_clearagi) |
| 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 | 267 | ||
| 267 | /* | 268 | /* |
| 268 | * Various log count values. | 269 | * Various log count values. |
