diff options
author | Mark Fasheh <mark.fasheh@oracle.com> | 2006-10-09 20:26:22 -0400 |
---|---|---|
committer | Mark Fasheh <mark.fasheh@oracle.com> | 2006-12-01 21:28:23 -0500 |
commit | 65eff9ccf86d63eb5c3e9071450a36e4e4fa9564 (patch) | |
tree | 3610e008294ce4e5cfbc9abff3c98153f35ed2d4 /fs/ocfs2/journal.c | |
parent | dae85832ffe2879b57b23aea319a0ec17667898d (diff) |
ocfs2: remove handle argument to ocfs2_start_trans()
All callers either pass in NULL directly, or a local variable that is
already set to NULL.
The internals of ocfs2_start_trans() get a nice cleanup as a result.
Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
Diffstat (limited to 'fs/ocfs2/journal.c')
-rw-r--r-- | fs/ocfs2/journal.c | 29 |
1 files changed, 8 insertions, 21 deletions
diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c index 81fb917475fd..6d9658b0c5db 100644 --- a/fs/ocfs2/journal.c +++ b/fs/ocfs2/journal.c | |||
@@ -129,20 +129,16 @@ static struct ocfs2_journal_handle *ocfs2_alloc_handle(struct ocfs2_super *osb) | |||
129 | * you pass it a handle however, it may still return error, in which | 129 | * you pass it a handle however, it may still return error, in which |
130 | * case it has free'd the passed handle for you. */ | 130 | * case it has free'd the passed handle for you. */ |
131 | struct ocfs2_journal_handle *ocfs2_start_trans(struct ocfs2_super *osb, | 131 | struct ocfs2_journal_handle *ocfs2_start_trans(struct ocfs2_super *osb, |
132 | struct ocfs2_journal_handle *handle, | ||
133 | int max_buffs) | 132 | int max_buffs) |
134 | { | 133 | { |
135 | int ret; | 134 | int ret; |
136 | journal_t *journal = osb->journal->j_journal; | 135 | journal_t *journal = osb->journal->j_journal; |
137 | 136 | struct ocfs2_journal_handle *handle; | |
138 | mlog_entry("(max_buffs = %d)\n", max_buffs); | ||
139 | 137 | ||
140 | BUG_ON(!osb || !osb->journal->j_journal); | 138 | BUG_ON(!osb || !osb->journal->j_journal); |
141 | 139 | ||
142 | if (ocfs2_is_hard_readonly(osb)) { | 140 | if (ocfs2_is_hard_readonly(osb)) |
143 | ret = -EROFS; | 141 | return ERR_PTR(-EROFS); |
144 | goto done_free; | ||
145 | } | ||
146 | 142 | ||
147 | BUG_ON(osb->journal->j_state == OCFS2_JOURNAL_FREE); | 143 | BUG_ON(osb->journal->j_state == OCFS2_JOURNAL_FREE); |
148 | BUG_ON(max_buffs <= 0); | 144 | BUG_ON(max_buffs <= 0); |
@@ -153,13 +149,11 @@ struct ocfs2_journal_handle *ocfs2_start_trans(struct ocfs2_super *osb, | |||
153 | BUG(); | 149 | BUG(); |
154 | } | 150 | } |
155 | 151 | ||
156 | if (!handle) | 152 | handle = ocfs2_alloc_handle(osb); |
157 | handle = ocfs2_alloc_handle(osb); | ||
158 | if (!handle) { | 153 | if (!handle) { |
159 | ret = -ENOMEM; | 154 | ret = -ENOMEM; |
160 | mlog(ML_ERROR, "Failed to allocate memory for journal " | 155 | mlog_errno(ret); |
161 | "handle!\n"); | 156 | return ERR_PTR(ret); |
162 | goto done_free; | ||
163 | } | 157 | } |
164 | 158 | ||
165 | down_read(&osb->journal->j_trans_barrier); | 159 | down_read(&osb->journal->j_trans_barrier); |
@@ -168,6 +162,7 @@ struct ocfs2_journal_handle *ocfs2_start_trans(struct ocfs2_super *osb, | |||
168 | handle->k_handle = journal_start(journal, max_buffs); | 162 | handle->k_handle = journal_start(journal, max_buffs); |
169 | if (IS_ERR(handle->k_handle)) { | 163 | if (IS_ERR(handle->k_handle)) { |
170 | up_read(&osb->journal->j_trans_barrier); | 164 | up_read(&osb->journal->j_trans_barrier); |
165 | kfree(handle); | ||
171 | 166 | ||
172 | ret = PTR_ERR(handle->k_handle); | 167 | ret = PTR_ERR(handle->k_handle); |
173 | handle->k_handle = NULL; | 168 | handle->k_handle = NULL; |
@@ -177,20 +172,12 @@ struct ocfs2_journal_handle *ocfs2_start_trans(struct ocfs2_super *osb, | |||
177 | ocfs2_abort(osb->sb, "Detected aborted journal"); | 172 | ocfs2_abort(osb->sb, "Detected aborted journal"); |
178 | ret = -EROFS; | 173 | ret = -EROFS; |
179 | } | 174 | } |
180 | goto done_free; | 175 | return ERR_PTR(ret); |
181 | } | 176 | } |
182 | 177 | ||
183 | atomic_inc(&(osb->journal->j_num_trans)); | 178 | atomic_inc(&(osb->journal->j_num_trans)); |
184 | 179 | ||
185 | mlog_exit_ptr(handle); | ||
186 | return handle; | 180 | return handle; |
187 | |||
188 | done_free: | ||
189 | if (handle) | ||
190 | kfree(handle); | ||
191 | |||
192 | mlog_exit(ret); | ||
193 | return ERR_PTR(ret); | ||
194 | } | 181 | } |
195 | 182 | ||
196 | void ocfs2_commit_trans(struct ocfs2_super *osb, | 183 | void ocfs2_commit_trans(struct ocfs2_super *osb, |