]>
Commit | Line | Data |
---|---|---|
2cb7cef9 BS |
1 | From: Jan Kara <jack@suse.cz> |
2 | References: fate#302681 | |
3 | Subject: [PATCH 19/28] ocfs2: Support nested transactions | |
4 | Patch-mainline: 2.6.29? | |
5 | ||
6 | OCFS2 can easily support nested transactions. We just have to | |
7 | take care and not spoil statistics acquire semaphore unnecessarily. | |
8 | ||
9 | Signed-off-by: Jan Kara <jack@suse.cz> | |
10 | --- | |
11 | fs/ocfs2/journal.c | 14 +++++++------- | |
12 | 1 files changed, 7 insertions(+), 7 deletions(-) | |
13 | ||
14 | Index: linux-2.6.27/fs/ocfs2/journal.c | |
15 | =================================================================== | |
16 | --- linux-2.6.27.orig/fs/ocfs2/journal.c 2008-10-24 11:40:35.000000000 +0200 | |
17 | +++ linux-2.6.27/fs/ocfs2/journal.c 2008-10-24 14:19:31.000000000 +0200 | |
18 | @@ -256,11 +256,9 @@ | |
19 | BUG_ON(osb->journal->j_state == OCFS2_JOURNAL_FREE); | |
20 | BUG_ON(max_buffs <= 0); | |
21 | ||
22 | - /* JBD might support this, but our journalling code doesn't yet. */ | |
23 | - if (journal_current_handle()) { | |
24 | - mlog(ML_ERROR, "Recursive transaction attempted!\n"); | |
25 | - BUG(); | |
26 | - } | |
27 | + /* Nested transaction? Just return the handle... */ | |
28 | + if (journal_current_handle()) | |
29 | + return jbd2_journal_start(journal, max_buffs); | |
30 | ||
31 | down_read(&osb->journal->j_trans_barrier); | |
32 | ||
33 | @@ -285,16 +283,18 @@ | |
34 | int ocfs2_commit_trans(struct ocfs2_super *osb, | |
35 | handle_t *handle) | |
36 | { | |
37 | - int ret; | |
38 | + int ret, nested; | |
39 | struct ocfs2_journal *journal = osb->journal; | |
40 | ||
41 | BUG_ON(!handle); | |
42 | ||
43 | + nested = handle->h_ref > 1; | |
44 | ret = jbd2_journal_stop(handle); | |
45 | if (ret < 0) | |
46 | mlog_errno(ret); | |
47 | ||
48 | - up_read(&journal->j_trans_barrier); | |
49 | + if (!nested) | |
50 | + up_read(&journal->j_trans_barrier); | |
51 | ||
52 | return ret; | |
53 | } |