summaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/journal.c
diff options
context:
space:
mode:
authorMark Fasheh <mark.fasheh@oracle.com>2006-10-09 17:26:22 -0700
committerMark Fasheh <mark.fasheh@oracle.com>2006-12-01 18:28:23 -0800
commit65eff9ccf86d63eb5c3e9071450a36e4e4fa9564 (patch)
tree3610e008294ce4e5cfbc9abff3c98153f35ed2d4 /fs/ocfs2/journal.c
parentdae85832ffe2879b57b23aea319a0ec17667898d (diff)
downloadblackbird-op-linux-65eff9ccf86d63eb5c3e9071450a36e4e4fa9564.tar.gz
blackbird-op-linux-65eff9ccf86d63eb5c3e9071450a36e4e4fa9564.zip
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.c29
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)
* you pass it a handle however, it may still return error, in which
* case it has free'd the passed handle for you. */
struct ocfs2_journal_handle *ocfs2_start_trans(struct ocfs2_super *osb,
- struct ocfs2_journal_handle *handle,
int max_buffs)
{
int ret;
journal_t *journal = osb->journal->j_journal;
-
- mlog_entry("(max_buffs = %d)\n", max_buffs);
+ struct ocfs2_journal_handle *handle;
BUG_ON(!osb || !osb->journal->j_journal);
- if (ocfs2_is_hard_readonly(osb)) {
- ret = -EROFS;
- goto done_free;
- }
+ if (ocfs2_is_hard_readonly(osb))
+ return ERR_PTR(-EROFS);
BUG_ON(osb->journal->j_state == OCFS2_JOURNAL_FREE);
BUG_ON(max_buffs <= 0);
@@ -153,13 +149,11 @@ struct ocfs2_journal_handle *ocfs2_start_trans(struct ocfs2_super *osb,
BUG();
}
- if (!handle)
- handle = ocfs2_alloc_handle(osb);
+ handle = ocfs2_alloc_handle(osb);
if (!handle) {
ret = -ENOMEM;
- mlog(ML_ERROR, "Failed to allocate memory for journal "
- "handle!\n");
- goto done_free;
+ mlog_errno(ret);
+ return ERR_PTR(ret);
}
down_read(&osb->journal->j_trans_barrier);
@@ -168,6 +162,7 @@ struct ocfs2_journal_handle *ocfs2_start_trans(struct ocfs2_super *osb,
handle->k_handle = journal_start(journal, max_buffs);
if (IS_ERR(handle->k_handle)) {
up_read(&osb->journal->j_trans_barrier);
+ kfree(handle);
ret = PTR_ERR(handle->k_handle);
handle->k_handle = NULL;
@@ -177,20 +172,12 @@ struct ocfs2_journal_handle *ocfs2_start_trans(struct ocfs2_super *osb,
ocfs2_abort(osb->sb, "Detected aborted journal");
ret = -EROFS;
}
- goto done_free;
+ return ERR_PTR(ret);
}
atomic_inc(&(osb->journal->j_num_trans));
- mlog_exit_ptr(handle);
return handle;
-
-done_free:
- if (handle)
- kfree(handle);
-
- mlog_exit(ret);
- return ERR_PTR(ret);
}
void ocfs2_commit_trans(struct ocfs2_super *osb,
OpenPOWER on IntegriCloud