diff options
author | Jan Kara <jack@suse.cz> | 2008-08-27 16:30:28 -0400 |
---|---|---|
committer | Mark Fasheh <mfasheh@suse.com> | 2009-01-05 11:40:23 -0500 |
commit | 90e86a63eadf1a3b2f19b68d82150dc63fe01443 (patch) | |
tree | 4168749ab4c9a0e849c9ad419ee66a2992053243 /fs/ocfs2/journal.c | |
parent | 12c77527e4138bc3b17d17b0e0c909e4fc84924f (diff) |
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: Jan Kara <jack@suse.cz>
Signed-off-by: Mark Fasheh <mfasheh@suse.com>
Diffstat (limited to 'fs/ocfs2/journal.c')
-rw-r--r-- | fs/ocfs2/journal.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c index 12b62a3cbf6..11a1178d5ee 100644 --- a/fs/ocfs2/journal.c +++ b/fs/ocfs2/journal.c | |||
@@ -256,11 +256,9 @@ handle_t *ocfs2_start_trans(struct ocfs2_super *osb, int max_buffs) | |||
256 | BUG_ON(osb->journal->j_state == OCFS2_JOURNAL_FREE); | 256 | BUG_ON(osb->journal->j_state == OCFS2_JOURNAL_FREE); |
257 | BUG_ON(max_buffs <= 0); | 257 | BUG_ON(max_buffs <= 0); |
258 | 258 | ||
259 | /* JBD might support this, but our journalling code doesn't yet. */ | 259 | /* Nested transaction? Just return the handle... */ |
260 | if (journal_current_handle()) { | 260 | if (journal_current_handle()) |
261 | mlog(ML_ERROR, "Recursive transaction attempted!\n"); | 261 | return jbd2_journal_start(journal, max_buffs); |
262 | BUG(); | ||
263 | } | ||
264 | 262 | ||
265 | down_read(&osb->journal->j_trans_barrier); | 263 | down_read(&osb->journal->j_trans_barrier); |
266 | 264 | ||
@@ -285,16 +283,18 @@ handle_t *ocfs2_start_trans(struct ocfs2_super *osb, int max_buffs) | |||
285 | int ocfs2_commit_trans(struct ocfs2_super *osb, | 283 | int ocfs2_commit_trans(struct ocfs2_super *osb, |
286 | handle_t *handle) | 284 | handle_t *handle) |
287 | { | 285 | { |
288 | int ret; | 286 | int ret, nested; |
289 | struct ocfs2_journal *journal = osb->journal; | 287 | struct ocfs2_journal *journal = osb->journal; |
290 | 288 | ||
291 | BUG_ON(!handle); | 289 | BUG_ON(!handle); |
292 | 290 | ||
291 | nested = handle->h_ref > 1; | ||
293 | ret = jbd2_journal_stop(handle); | 292 | ret = jbd2_journal_stop(handle); |
294 | if (ret < 0) | 293 | if (ret < 0) |
295 | mlog_errno(ret); | 294 | mlog_errno(ret); |
296 | 295 | ||
297 | up_read(&journal->j_trans_barrier); | 296 | if (!nested) |
297 | up_read(&journal->j_trans_barrier); | ||
298 | 298 | ||
299 | return ret; | 299 | return ret; |
300 | } | 300 | } |