aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_iomap.c
diff options
context:
space:
mode:
authorJie Liu <jeff.liu@oracle.com>2013-08-12 06:49:59 -0400
committerBen Myers <bpm@sgi.com>2013-08-12 18:47:34 -0400
commit3d3c8b5222b92447bffaa4127ee18c757f32a460 (patch)
tree250f3b61679231944b5272d18d17e6ceabfc62d1 /fs/xfs/xfs_iomap.c
parent783cb6d172358892d6af394ebe2876bcbfcc6499 (diff)
xfs: refactor xfs_trans_reserve() interface
With the new xfs_trans_res structure has been introduced, the log reservation size, log count as well as log flags are pre-initialized at mount time. So it's time to refine xfs_trans_reserve() interface to be more neat. Also, introduce a new helper M_RES() to return a pointer to the mp->m_resv structure to simplify the input. Signed-off-by: Jie Liu <jeff.liu@oracle.com> Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Mark Tinguely <tinguely@sgi.com> Signed-off-by: Ben Myers <bpm@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_iomap.c')
-rw-r--r--fs/xfs/xfs_iomap.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c
index cf8f74407660..8d4d49b6fbf3 100644
--- a/fs/xfs/xfs_iomap.c
+++ b/fs/xfs/xfs_iomap.c
@@ -188,10 +188,8 @@ xfs_iomap_write_direct(
188 * Allocate and setup the transaction 188 * Allocate and setup the transaction
189 */ 189 */
190 tp = xfs_trans_alloc(mp, XFS_TRANS_DIOSTRAT); 190 tp = xfs_trans_alloc(mp, XFS_TRANS_DIOSTRAT);
191 error = xfs_trans_reserve(tp, resblks, 191 error = xfs_trans_reserve(tp, &M_RES(mp)->tr_write,
192 XFS_WRITE_LOG_RES(mp), resrtextents, 192 resblks, resrtextents);
193 XFS_TRANS_PERM_LOG_RES,
194 XFS_WRITE_LOG_COUNT);
195 /* 193 /*
196 * Check for running out of space, note: need lock to return 194 * Check for running out of space, note: need lock to return
197 */ 195 */
@@ -699,10 +697,8 @@ xfs_iomap_write_allocate(
699 tp = xfs_trans_alloc(mp, XFS_TRANS_STRAT_WRITE); 697 tp = xfs_trans_alloc(mp, XFS_TRANS_STRAT_WRITE);
700 tp->t_flags |= XFS_TRANS_RESERVE; 698 tp->t_flags |= XFS_TRANS_RESERVE;
701 nres = XFS_EXTENTADD_SPACE_RES(mp, XFS_DATA_FORK); 699 nres = XFS_EXTENTADD_SPACE_RES(mp, XFS_DATA_FORK);
702 error = xfs_trans_reserve(tp, nres, 700 error = xfs_trans_reserve(tp, &M_RES(mp)->tr_write,
703 XFS_WRITE_LOG_RES(mp), 701 nres, 0);
704 0, XFS_TRANS_PERM_LOG_RES,
705 XFS_WRITE_LOG_COUNT);
706 if (error) { 702 if (error) {
707 xfs_trans_cancel(tp, 0); 703 xfs_trans_cancel(tp, 0);
708 return XFS_ERROR(error); 704 return XFS_ERROR(error);
@@ -865,10 +861,8 @@ xfs_iomap_write_unwritten(
865 sb_start_intwrite(mp->m_super); 861 sb_start_intwrite(mp->m_super);
866 tp = _xfs_trans_alloc(mp, XFS_TRANS_STRAT_WRITE, KM_NOFS); 862 tp = _xfs_trans_alloc(mp, XFS_TRANS_STRAT_WRITE, KM_NOFS);
867 tp->t_flags |= XFS_TRANS_RESERVE | XFS_TRANS_FREEZE_PROT; 863 tp->t_flags |= XFS_TRANS_RESERVE | XFS_TRANS_FREEZE_PROT;
868 error = xfs_trans_reserve(tp, resblks, 864 error = xfs_trans_reserve(tp, &M_RES(mp)->tr_write,
869 XFS_WRITE_LOG_RES(mp), 0, 865 resblks, 0);
870 XFS_TRANS_PERM_LOG_RES,
871 XFS_WRITE_LOG_COUNT);
872 if (error) { 866 if (error) {
873 xfs_trans_cancel(tp, 0); 867 xfs_trans_cancel(tp, 0);
874 return XFS_ERROR(error); 868 return XFS_ERROR(error);