diff options
author | Jie Liu <jeff.liu@oracle.com> | 2013-08-12 06:49:59 -0400 |
---|---|---|
committer | Ben Myers <bpm@sgi.com> | 2013-08-12 18:47:34 -0400 |
commit | 3d3c8b5222b92447bffaa4127ee18c757f32a460 (patch) | |
tree | 250f3b61679231944b5272d18d17e6ceabfc62d1 /fs/xfs/xfs_rtalloc.c | |
parent | 783cb6d172358892d6af394ebe2876bcbfcc6499 (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_rtalloc.c')
-rw-r--r-- | fs/xfs/xfs_rtalloc.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/fs/xfs/xfs_rtalloc.c b/fs/xfs/xfs_rtalloc.c index 6dbcb5e9fb5d..6f9e63c9fc26 100644 --- a/fs/xfs/xfs_rtalloc.c +++ b/fs/xfs/xfs_rtalloc.c | |||
@@ -100,10 +100,9 @@ xfs_growfs_rt_alloc( | |||
100 | /* | 100 | /* |
101 | * Reserve space & log for one extent added to the file. | 101 | * Reserve space & log for one extent added to the file. |
102 | */ | 102 | */ |
103 | if ((error = xfs_trans_reserve(tp, resblks, | 103 | error = xfs_trans_reserve(tp, &M_RES(mp)->tr_growdata, |
104 | XFS_GROWRTALLOC_LOG_RES(mp), 0, | 104 | resblks, 0); |
105 | XFS_TRANS_PERM_LOG_RES, | 105 | if (error) |
106 | XFS_DEFAULT_PERM_LOG_COUNT))) | ||
107 | goto error_cancel; | 106 | goto error_cancel; |
108 | cancelflags = XFS_TRANS_RELEASE_LOG_RES; | 107 | cancelflags = XFS_TRANS_RELEASE_LOG_RES; |
109 | /* | 108 | /* |
@@ -146,8 +145,9 @@ xfs_growfs_rt_alloc( | |||
146 | /* | 145 | /* |
147 | * Reserve log for one block zeroing. | 146 | * Reserve log for one block zeroing. |
148 | */ | 147 | */ |
149 | if ((error = xfs_trans_reserve(tp, 0, | 148 | error = xfs_trans_reserve(tp, &M_RES(mp)->tr_growrtzero, |
150 | XFS_GROWRTZERO_LOG_RES(mp), 0, 0, 0))) | 149 | 0, 0); |
150 | if (error) | ||
151 | goto error_cancel; | 151 | goto error_cancel; |
152 | /* | 152 | /* |
153 | * Lock the bitmap inode. | 153 | * Lock the bitmap inode. |
@@ -1957,8 +1957,9 @@ xfs_growfs_rt( | |||
1957 | * Start a transaction, get the log reservation. | 1957 | * Start a transaction, get the log reservation. |
1958 | */ | 1958 | */ |
1959 | tp = xfs_trans_alloc(mp, XFS_TRANS_GROWFSRT_FREE); | 1959 | tp = xfs_trans_alloc(mp, XFS_TRANS_GROWFSRT_FREE); |
1960 | if ((error = xfs_trans_reserve(tp, 0, | 1960 | error = xfs_trans_reserve(tp, &M_RES(mp)->tr_growrtfree, |
1961 | XFS_GROWRTFREE_LOG_RES(nmp), 0, 0, 0))) | 1961 | 0, 0); |
1962 | if (error) | ||
1962 | goto error_cancel; | 1963 | goto error_cancel; |
1963 | /* | 1964 | /* |
1964 | * Lock out other callers by grabbing the bitmap inode lock. | 1965 | * Lock out other callers by grabbing the bitmap inode lock. |