diff options
Diffstat (limited to 'fs/jbd/transaction.c')
-rw-r--r-- | fs/jbd/transaction.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/fs/jbd/transaction.c b/fs/jbd/transaction.c index 429f4b263cf1..ca917973c2c0 100644 --- a/fs/jbd/transaction.c +++ b/fs/jbd/transaction.c | |||
@@ -1308,6 +1308,7 @@ int journal_stop(handle_t *handle) | |||
1308 | transaction_t *transaction = handle->h_transaction; | 1308 | transaction_t *transaction = handle->h_transaction; |
1309 | journal_t *journal = transaction->t_journal; | 1309 | journal_t *journal = transaction->t_journal; |
1310 | int old_handle_count, err; | 1310 | int old_handle_count, err; |
1311 | pid_t pid; | ||
1311 | 1312 | ||
1312 | J_ASSERT(transaction->t_updates > 0); | 1313 | J_ASSERT(transaction->t_updates > 0); |
1313 | J_ASSERT(journal_current_handle() == handle); | 1314 | J_ASSERT(journal_current_handle() == handle); |
@@ -1333,8 +1334,15 @@ int journal_stop(handle_t *handle) | |||
1333 | * It doesn't cost much - we're about to run a commit and sleep | 1334 | * It doesn't cost much - we're about to run a commit and sleep |
1334 | * on IO anyway. Speeds up many-threaded, many-dir operations | 1335 | * on IO anyway. Speeds up many-threaded, many-dir operations |
1335 | * by 30x or more... | 1336 | * by 30x or more... |
1337 | * | ||
1338 | * But don't do this if this process was the most recent one to | ||
1339 | * perform a synchronous write. We do this to detect the case where a | ||
1340 | * single process is doing a stream of sync writes. No point in waiting | ||
1341 | * for joiners in that case. | ||
1336 | */ | 1342 | */ |
1337 | if (handle->h_sync) { | 1343 | pid = current->pid; |
1344 | if (handle->h_sync && journal->j_last_sync_writer != pid) { | ||
1345 | journal->j_last_sync_writer = pid; | ||
1338 | do { | 1346 | do { |
1339 | old_handle_count = transaction->t_handle_count; | 1347 | old_handle_count = transaction->t_handle_count; |
1340 | schedule_timeout_uninterruptible(1); | 1348 | schedule_timeout_uninterruptible(1); |