Commit 2c941f77 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] jbd: journal_dirty_metadata locking speedup

Reduce the locking coverage of the oft-used j_list_lock: the per-bh
jbd_lock_bh_state() gives us sufficient locking of buffer_head and
journal_head internals.
parent dd9fd0e0
...@@ -1111,26 +1111,21 @@ int journal_dirty_metadata(handle_t *handle, struct buffer_head *bh) ...@@ -1111,26 +1111,21 @@ int journal_dirty_metadata(handle_t *handle, struct buffer_head *bh)
* I _think_ we're OK here with SMP barriers - a mistaken decision will * I _think_ we're OK here with SMP barriers - a mistaken decision will
* result in this test being false, so we go in and take the locks. * result in this test being false, so we go in and take the locks.
*/ */
if (jh->b_transaction == handle->h_transaction && if (jh->b_transaction == transaction && jh->b_jlist == BJ_Metadata) {
jh->b_jlist == BJ_Metadata) {
JBUFFER_TRACE(jh, "fastpath"); JBUFFER_TRACE(jh, "fastpath");
J_ASSERT_JH(jh, jh->b_transaction == J_ASSERT_JH(jh, jh->b_transaction ==
journal->j_running_transaction); journal->j_running_transaction);
goto out_unlock_bh; goto out_unlock_bh;
} }
spin_lock(&journal->j_list_lock);
set_buffer_jbddirty(bh); set_buffer_jbddirty(bh);
J_ASSERT_JH(jh, jh->b_transaction != NULL);
/* /*
* Metadata already on the current transaction list doesn't * Metadata already on the current transaction list doesn't
* need to be filed. Metadata on another transaction's list must * need to be filed. Metadata on another transaction's list must
* be committing, and will be refiled once the commit completes: * be committing, and will be refiled once the commit completes:
* leave it alone for now. * leave it alone for now.
*/ */
if (jh->b_transaction != transaction) { if (jh->b_transaction != transaction) {
JBUFFER_TRACE(jh, "already on other transaction"); JBUFFER_TRACE(jh, "already on other transaction");
J_ASSERT_JH(jh, jh->b_transaction == J_ASSERT_JH(jh, jh->b_transaction ==
...@@ -1138,17 +1133,15 @@ int journal_dirty_metadata(handle_t *handle, struct buffer_head *bh) ...@@ -1138,17 +1133,15 @@ int journal_dirty_metadata(handle_t *handle, struct buffer_head *bh)
J_ASSERT_JH(jh, jh->b_next_transaction == transaction); J_ASSERT_JH(jh, jh->b_next_transaction == transaction);
/* And this case is illegal: we can't reuse another /* And this case is illegal: we can't reuse another
* transaction's data buffer, ever. */ * transaction's data buffer, ever. */
/* FIXME: writepage() should be journalled */ goto out_unlock_bh;
goto out_unlock_list;
} }
/* That test should have eliminated the following case: */ /* That test should have eliminated the following case: */
J_ASSERT_JH(jh, jh->b_frozen_data == 0); J_ASSERT_JH(jh, jh->b_frozen_data == 0);
JBUFFER_TRACE(jh, "file as BJ_Metadata"); JBUFFER_TRACE(jh, "file as BJ_Metadata");
spin_lock(&journal->j_list_lock);
__journal_file_buffer(jh, handle->h_transaction, BJ_Metadata); __journal_file_buffer(jh, handle->h_transaction, BJ_Metadata);
out_unlock_list:
spin_unlock(&journal->j_list_lock); spin_unlock(&journal->j_list_lock);
out_unlock_bh: out_unlock_bh:
jbd_unlock_bh_state(bh); jbd_unlock_bh_state(bh);
......
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