Commit 3469a32a authored by Theodore Ts'o's avatar Theodore Ts'o

jbd2: don't hold j_state_lock while calling wake_up()

The j_state_lock is one of the hottest locks in the jbd2 layer and
thus one of its scalability bottlenecks.

We don't need to be holding the j_state_lock while we are calling
wake_up(&journal->j_wait_commit), so release the lock a little bit
earlier.
Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
parent df3c1e9a
...@@ -302,8 +302,8 @@ static void journal_kill_thread(journal_t *journal) ...@@ -302,8 +302,8 @@ static void journal_kill_thread(journal_t *journal)
journal->j_flags |= JBD2_UNMOUNT; journal->j_flags |= JBD2_UNMOUNT;
while (journal->j_task) { while (journal->j_task) {
wake_up(&journal->j_wait_commit);
write_unlock(&journal->j_state_lock); write_unlock(&journal->j_state_lock);
wake_up(&journal->j_wait_commit);
wait_event(journal->j_wait_done_commit, journal->j_task == NULL); wait_event(journal->j_wait_done_commit, journal->j_task == NULL);
write_lock(&journal->j_state_lock); write_lock(&journal->j_state_lock);
} }
...@@ -710,8 +710,8 @@ int jbd2_log_wait_commit(journal_t *journal, tid_t tid) ...@@ -710,8 +710,8 @@ int jbd2_log_wait_commit(journal_t *journal, tid_t tid)
while (tid_gt(tid, journal->j_commit_sequence)) { while (tid_gt(tid, journal->j_commit_sequence)) {
jbd_debug(1, "JBD2: want %d, j_commit_sequence=%d\n", jbd_debug(1, "JBD2: want %d, j_commit_sequence=%d\n",
tid, journal->j_commit_sequence); tid, journal->j_commit_sequence);
wake_up(&journal->j_wait_commit);
read_unlock(&journal->j_state_lock); read_unlock(&journal->j_state_lock);
wake_up(&journal->j_wait_commit);
wait_event(journal->j_wait_done_commit, wait_event(journal->j_wait_done_commit,
!tid_gt(tid, journal->j_commit_sequence)); !tid_gt(tid, journal->j_commit_sequence));
read_lock(&journal->j_state_lock); read_lock(&journal->j_state_lock);
......
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