|
@@ -1308,6 +1308,7 @@ int journal_stop(handle_t *handle)
|
|
transaction_t *transaction = handle->h_transaction;
|
|
transaction_t *transaction = handle->h_transaction;
|
|
journal_t *journal = transaction->t_journal;
|
|
journal_t *journal = transaction->t_journal;
|
|
int old_handle_count, err;
|
|
int old_handle_count, err;
|
|
|
|
+ pid_t pid;
|
|
|
|
|
|
J_ASSERT(transaction->t_updates > 0);
|
|
J_ASSERT(transaction->t_updates > 0);
|
|
J_ASSERT(journal_current_handle() == handle);
|
|
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
|
|
* It doesn't cost much - we're about to run a commit and sleep
|
|
* on IO anyway. Speeds up many-threaded, many-dir operations
|
|
* on IO anyway. Speeds up many-threaded, many-dir operations
|
|
* by 30x or more...
|
|
* 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 {
|
|
do {
|
|
old_handle_count = transaction->t_handle_count;
|
|
old_handle_count = transaction->t_handle_count;
|
|
schedule_timeout_uninterruptible(1);
|
|
schedule_timeout_uninterruptible(1);
|