From c6b2e10c2c9668d51565e641241fe9c5cc010176 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Sat, 4 Feb 2006 23:27:54 -0800 Subject: [PATCH] --- yaml --- r: 19805 b: refs/heads/master c: fe1dcbc4f311c2e6c23b33c0fa8572461618ab3e h: refs/heads/master i: 19803: e08f858bb5fccb05a7d25befe5bde318d3a45a11 v: v3 --- [refs] | 2 +- trunk/fs/jbd/transaction.c | 10 +++++++++- trunk/include/linux/jbd.h | 4 ++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index 1e4d7b8675d1..9e7cd707278b 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: bc5e483da61eb5ab8d24b4a919fb512e5886d02c +refs/heads/master: fe1dcbc4f311c2e6c23b33c0fa8572461618ab3e diff --git a/trunk/fs/jbd/transaction.c b/trunk/fs/jbd/transaction.c index 429f4b263cf1..ca917973c2c0 100644 --- a/trunk/fs/jbd/transaction.c +++ b/trunk/fs/jbd/transaction.c @@ -1308,6 +1308,7 @@ int journal_stop(handle_t *handle) transaction_t *transaction = handle->h_transaction; journal_t *journal = transaction->t_journal; int old_handle_count, err; + pid_t pid; J_ASSERT(transaction->t_updates > 0); J_ASSERT(journal_current_handle() == handle); @@ -1333,8 +1334,15 @@ int journal_stop(handle_t *handle) * It doesn't cost much - we're about to run a commit and sleep * on IO anyway. Speeds up many-threaded, many-dir operations * by 30x or more... + * + * But don't do this if this process was the most recent one to + * perform a synchronous write. We do this to detect the case where a + * single process is doing a stream of sync writes. No point in waiting + * for joiners in that case. */ - if (handle->h_sync) { + pid = current->pid; + if (handle->h_sync && journal->j_last_sync_writer != pid) { + journal->j_last_sync_writer = pid; do { old_handle_count = transaction->t_handle_count; schedule_timeout_uninterruptible(1); diff --git a/trunk/include/linux/jbd.h b/trunk/include/linux/jbd.h index 558cb4c26ec9..751bb3849467 100644 --- a/trunk/include/linux/jbd.h +++ b/trunk/include/linux/jbd.h @@ -23,6 +23,7 @@ #define jfs_debug jbd_debug #else +#include #include #include #include @@ -618,6 +619,7 @@ struct transaction_s * @j_wbuf: array of buffer_heads for journal_commit_transaction * @j_wbufsize: maximum number of buffer_heads allowed in j_wbuf, the * number that will fit in j_blocksize + * @j_last_sync_writer: most recent pid which did a synchronous write * @j_private: An opaque pointer to fs-private information. */ @@ -807,6 +809,8 @@ struct journal_s struct buffer_head **j_wbuf; int j_wbufsize; + pid_t j_last_sync_writer; + /* * An opaque pointer to fs-private information. ext3 puts its * superblock pointer here