Commit 90e86a63 authored by Jan Kara's avatar Jan Kara Committed by Mark Fasheh

ocfs2: Support nested transactions

OCFS2 can easily support nested transactions. We just have to
take care and not spoil statistics acquire semaphore unnecessarily.
Signed-off-by: default avatarJan Kara <jack@suse.cz>
Signed-off-by: default avatarMark Fasheh <mfasheh@suse.com>
parent 12c77527
...@@ -256,11 +256,9 @@ handle_t *ocfs2_start_trans(struct ocfs2_super *osb, int max_buffs) ...@@ -256,11 +256,9 @@ handle_t *ocfs2_start_trans(struct ocfs2_super *osb, int max_buffs)
BUG_ON(osb->journal->j_state == OCFS2_JOURNAL_FREE); BUG_ON(osb->journal->j_state == OCFS2_JOURNAL_FREE);
BUG_ON(max_buffs <= 0); BUG_ON(max_buffs <= 0);
/* JBD might support this, but our journalling code doesn't yet. */ /* Nested transaction? Just return the handle... */
if (journal_current_handle()) { if (journal_current_handle())
mlog(ML_ERROR, "Recursive transaction attempted!\n"); return jbd2_journal_start(journal, max_buffs);
BUG();
}
down_read(&osb->journal->j_trans_barrier); down_read(&osb->journal->j_trans_barrier);
...@@ -285,16 +283,18 @@ handle_t *ocfs2_start_trans(struct ocfs2_super *osb, int max_buffs) ...@@ -285,16 +283,18 @@ handle_t *ocfs2_start_trans(struct ocfs2_super *osb, int max_buffs)
int ocfs2_commit_trans(struct ocfs2_super *osb, int ocfs2_commit_trans(struct ocfs2_super *osb,
handle_t *handle) handle_t *handle)
{ {
int ret; int ret, nested;
struct ocfs2_journal *journal = osb->journal; struct ocfs2_journal *journal = osb->journal;
BUG_ON(!handle); BUG_ON(!handle);
nested = handle->h_ref > 1;
ret = jbd2_journal_stop(handle); ret = jbd2_journal_stop(handle);
if (ret < 0) if (ret < 0)
mlog_errno(ret); mlog_errno(ret);
up_read(&journal->j_trans_barrier); if (!nested)
up_read(&journal->j_trans_barrier);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment