fs/jbd/transaction.c | 16 ++++++++++++++++ 1 files changed, 16 insertions(+) diff -puN fs/jbd/transaction.c~journal_dirty_metadata-speedup fs/jbd/transaction.c --- 25/fs/jbd/transaction.c~journal_dirty_metadata-speedup 2003-04-02 00:46:13.000000000 -0800 +++ 25-akpm/fs/jbd/transaction.c 2003-04-02 00:49:21.000000000 -0800 @@ -1060,6 +1060,21 @@ int journal_dirty_metadata (handle_t *ha journal_t *journal = transaction->t_journal; struct journal_head *jh = bh2jh(bh); + /* + * fastpath, to avoid expensive locking. If this buffer is already + * on the running transaction's metadata list there is nothing to do. + * Nobody can take it off again because there is a handle open. + * 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. + */ + if (jh->b_transaction == handle->h_transaction && + jh->b_jlist == BJ_Metadata) { + JBUFFER_TRACE(jh, "fastpath"); + J_ASSERT_JH(jh, jh->b_transaction == + journal->j_running_transaction); + goto out; + } + jbd_debug(5, "journal_head %p\n", jh); JBUFFER_TRACE(jh, "entry"); lock_journal(journal); @@ -1100,6 +1115,7 @@ done_locked: JBUFFER_TRACE(jh, "exit"); out_unlock: unlock_journal(journal); +out: return 0; } _