From 82e40d2e03bb11d6fb6e34e7870739a58595b425 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Wed, 25 Mar 2009 23:35:46 -0400 Subject: [PATCH] --- yaml --- r: 139501 b: refs/heads/master c: 7058548cd50e5bda8db086bb2e5c1d82f746d047 h: refs/heads/master i: 139499: d58d9ab8b084fe017fd458f97fcce9bcb2ddb523 v: v3 --- [refs] | 2 +- trunk/fs/jbd2/commit.c | 5 ++++- trunk/fs/jbd2/transaction.c | 2 ++ trunk/include/linux/jbd2.h | 6 ++++++ 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index 3f4947d54f89..a4b6b9575023 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: afd4672dc7610b7feef5190168aa917cc2e417e4 +refs/heads/master: 7058548cd50e5bda8db086bb2e5c1d82f746d047 diff --git a/trunk/fs/jbd2/commit.c b/trunk/fs/jbd2/commit.c index 62804e57a44c..4ea72377c7a2 100644 --- a/trunk/fs/jbd2/commit.c +++ b/trunk/fs/jbd2/commit.c @@ -367,6 +367,7 @@ void jbd2_journal_commit_transaction(journal_t *journal) int tag_bytes = journal_tag_bytes(journal); struct buffer_head *cbh = NULL; /* For transactional checksums */ __u32 crc32_sum = ~0; + int write_op = WRITE; /* * First job: lock down the current transaction and wait for @@ -401,6 +402,8 @@ void jbd2_journal_commit_transaction(journal_t *journal) spin_lock(&journal->j_state_lock); commit_transaction->t_state = T_LOCKED; + if (commit_transaction->t_synchronous_commit) + write_op = WRITE_SYNC; stats.u.run.rs_wait = commit_transaction->t_max_wait; stats.u.run.rs_locked = jiffies; stats.u.run.rs_running = jbd2_time_diff(commit_transaction->t_start, @@ -680,7 +683,7 @@ void jbd2_journal_commit_transaction(journal_t *journal) clear_buffer_dirty(bh); set_buffer_uptodate(bh); bh->b_end_io = journal_end_buffer_io_sync; - submit_bh(WRITE, bh); + submit_bh(write_op, bh); } cond_resched(); stats.u.run.rs_blocks_logged += bufs; diff --git a/trunk/fs/jbd2/transaction.c b/trunk/fs/jbd2/transaction.c index 28ce21d8598e..996ffda06bf3 100644 --- a/trunk/fs/jbd2/transaction.c +++ b/trunk/fs/jbd2/transaction.c @@ -1315,6 +1315,8 @@ int jbd2_journal_stop(handle_t *handle) } } + if (handle->h_sync) + transaction->t_synchronous_commit = 1; current->journal_info = NULL; spin_lock(&journal->j_state_lock); spin_lock(&transaction->t_handle_lock); diff --git a/trunk/include/linux/jbd2.h b/trunk/include/linux/jbd2.h index 4d248b3f1323..8815a3456b3b 100644 --- a/trunk/include/linux/jbd2.h +++ b/trunk/include/linux/jbd2.h @@ -648,6 +648,12 @@ struct transaction_s */ int t_handle_count; + /* + * This transaction is being forced and some process is + * waiting for it to finish. + */ + int t_synchronous_commit:1; + /* * For use by the filesystem to store fs-specific data * structures associated with the transaction