From: Wang Shilong <wangshilong1991@gmail.com>
To: linux-ext4@vger.kernel.org
Subject: [PATCH] jbd2: wake up j_wait_done_commit before commit callback
Date: Thu, 16 Jun 2016 12:45:28 +0900 [thread overview]
Message-ID: <1466048728-4325-1-git-send-email-wangshilong1991@gmail.com> (raw)
From: Wang Shilong <wshilong@ddn.com>
Lustre register some callbacks in ext4 to keep data consistency,
we see millons callbacks possibility on MDS for metadata operations.
If there are many commit callbacks which might take some cpu
time, we can mark commit done before we call commit callback.
this can relax some thread waiting for commit finished, for example
transaction throttle in end transaction.
Signed-off-by: Wang Shilong <wshilong@ddn.com>
---
fs/jbd2/commit.c | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c
index 7007809..a9cf5a4 100644
--- a/fs/jbd2/commit.c
+++ b/fs/jbd2/commit.c
@@ -379,6 +379,7 @@ void jbd2_journal_commit_transaction(journal_t *journal)
tid_t first_tid;
int update_tail;
int csum_size = 0;
+ int need_free = 0;
LIST_HEAD(io_bufs);
LIST_HEAD(log_bufs);
@@ -1100,9 +1101,6 @@ restart_loop:
write_unlock(&journal->j_state_lock);
- if (journal->j_commit_callback)
- journal->j_commit_callback(journal, commit_transaction);
-
trace_jbd2_end_commit(journal, commit_transaction);
jbd_debug(1, "JBD2: commit %d complete, head %d\n",
journal->j_commit_sequence, journal->j_tail_sequence);
@@ -1114,12 +1112,18 @@ restart_loop:
if (commit_transaction->t_checkpoint_list == NULL &&
commit_transaction->t_checkpoint_io_list == NULL) {
__jbd2_journal_drop_transaction(journal, commit_transaction);
- jbd2_journal_free_transaction(commit_transaction);
+ need_free = 1;
}
spin_unlock(&journal->j_list_lock);
write_unlock(&journal->j_state_lock);
wake_up(&journal->j_wait_done_commit);
+ if (journal->j_commit_callback)
+ journal->j_commit_callback(journal, commit_transaction);
+
+ if (need_free)
+ jbd2_journal_free_transaction(commit_transaction);
+
/*
* Calculate overall stats
*/
--
1.7.1
next reply other threads:[~2016-06-16 3:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-16 3:45 Wang Shilong [this message]
2016-06-17 10:05 ` [PATCH] jbd2: wake up j_wait_done_commit before commit callback Wang Shilong
2016-06-22 11:04 ` Wang Shilong
2016-06-20 14:45 ` Jan Kara
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1466048728-4325-1-git-send-email-wangshilong1991@gmail.com \
--to=wangshilong1991@gmail.com \
--cc=linux-ext4@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).