Commit 78f2f471 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] JBD: journal_get_write_access() speedup

Move some lock_kernel() calls from the caller to the callee, reducing
holdtimes.
parent 3307fbd1
...@@ -688,7 +688,9 @@ do_get_write_access(handle_t *handle, struct journal_head *jh, int force_copy) ...@@ -688,7 +688,9 @@ do_get_write_access(handle_t *handle, struct journal_head *jh, int force_copy)
/* If we are about to journal a buffer, then any revoke pending /* If we are about to journal a buffer, then any revoke pending
on it is no longer valid. */ on it is no longer valid. */
lock_kernel();
journal_cancel_revoke(handle, jh); journal_cancel_revoke(handle, jh);
unlock_kernel();
out_unlocked: out_unlocked:
if (frozen_buffer) if (frozen_buffer)
...@@ -720,9 +722,7 @@ int journal_get_write_access (handle_t *handle, struct buffer_head *bh) ...@@ -720,9 +722,7 @@ int journal_get_write_access (handle_t *handle, struct buffer_head *bh)
* log thread also manipulates. Make sure that the buffer * log thread also manipulates. Make sure that the buffer
* completes any outstanding IO before proceeding. */ * completes any outstanding IO before proceeding. */
lock_journal(journal); lock_journal(journal);
lock_kernel();
rc = do_get_write_access(handle, jh, 0); rc = do_get_write_access(handle, jh, 0);
unlock_kernel();
journal_unlock_journal_head(jh); journal_unlock_journal_head(jh);
unlock_journal(journal); unlock_journal(journal);
return rc; return rc;
...@@ -846,11 +846,14 @@ int journal_get_undo_access (handle_t *handle, struct buffer_head *bh) ...@@ -846,11 +846,14 @@ int journal_get_undo_access (handle_t *handle, struct buffer_head *bh)
/* Do this first --- it can drop the journal lock, so we want to /* Do this first --- it can drop the journal lock, so we want to
* make sure that obtaining the committed_data is done * make sure that obtaining the committed_data is done
* atomically wrt. completion of any outstanding commits. */ * atomically wrt. completion of any outstanding commits. */
lock_kernel();
err = do_get_write_access (handle, jh, 1); err = do_get_write_access (handle, jh, 1);
if (err) if (err)
goto out; goto out;
/*
* lock_journal() prevents jh->b_committed_data from getting set
* by two CPUs at the same time.
*/
if (!jh->b_committed_data) { if (!jh->b_committed_data) {
/* Copy out the current buffer contents into the /* Copy out the current buffer contents into the
* preserved, committed copy. */ * preserved, committed copy. */
...@@ -870,7 +873,6 @@ int journal_get_undo_access (handle_t *handle, struct buffer_head *bh) ...@@ -870,7 +873,6 @@ int journal_get_undo_access (handle_t *handle, struct buffer_head *bh)
} }
out: out:
unlock_kernel();
if (!err) if (!err)
J_ASSERT_JH(jh, jh->b_committed_data); J_ASSERT_JH(jh, jh->b_committed_data);
journal_unlock_journal_head(jh); journal_unlock_journal_head(jh);
......
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