diff options
-rw-r--r-- | fs/jbd2/commit.c | 5 | ||||
-rw-r--r-- | fs/jbd2/transaction.c | 2 | ||||
-rw-r--r-- | include/linux/jbd2.h | 6 |
3 files changed, 12 insertions, 1 deletions
diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c index 62804e57a44c..4ea72377c7a2 100644 --- a/fs/jbd2/commit.c +++ b/fs/jbd2/commit.c | |||
@@ -367,6 +367,7 @@ void jbd2_journal_commit_transaction(journal_t *journal) | |||
367 | int tag_bytes = journal_tag_bytes(journal); | 367 | int tag_bytes = journal_tag_bytes(journal); |
368 | struct buffer_head *cbh = NULL; /* For transactional checksums */ | 368 | struct buffer_head *cbh = NULL; /* For transactional checksums */ |
369 | __u32 crc32_sum = ~0; | 369 | __u32 crc32_sum = ~0; |
370 | int write_op = WRITE; | ||
370 | 371 | ||
371 | /* | 372 | /* |
372 | * First job: lock down the current transaction and wait for | 373 | * First job: lock down the current transaction and wait for |
@@ -401,6 +402,8 @@ void jbd2_journal_commit_transaction(journal_t *journal) | |||
401 | spin_lock(&journal->j_state_lock); | 402 | spin_lock(&journal->j_state_lock); |
402 | commit_transaction->t_state = T_LOCKED; | 403 | commit_transaction->t_state = T_LOCKED; |
403 | 404 | ||
405 | if (commit_transaction->t_synchronous_commit) | ||
406 | write_op = WRITE_SYNC; | ||
404 | stats.u.run.rs_wait = commit_transaction->t_max_wait; | 407 | stats.u.run.rs_wait = commit_transaction->t_max_wait; |
405 | stats.u.run.rs_locked = jiffies; | 408 | stats.u.run.rs_locked = jiffies; |
406 | stats.u.run.rs_running = jbd2_time_diff(commit_transaction->t_start, | 409 | stats.u.run.rs_running = jbd2_time_diff(commit_transaction->t_start, |
@@ -680,7 +683,7 @@ start_journal_io: | |||
680 | clear_buffer_dirty(bh); | 683 | clear_buffer_dirty(bh); |
681 | set_buffer_uptodate(bh); | 684 | set_buffer_uptodate(bh); |
682 | bh->b_end_io = journal_end_buffer_io_sync; | 685 | bh->b_end_io = journal_end_buffer_io_sync; |
683 | submit_bh(WRITE, bh); | 686 | submit_bh(write_op, bh); |
684 | } | 687 | } |
685 | cond_resched(); | 688 | cond_resched(); |
686 | stats.u.run.rs_blocks_logged += bufs; | 689 | stats.u.run.rs_blocks_logged += bufs; |
diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c index 28ce21d8598e..996ffda06bf3 100644 --- a/fs/jbd2/transaction.c +++ b/fs/jbd2/transaction.c | |||
@@ -1315,6 +1315,8 @@ int jbd2_journal_stop(handle_t *handle) | |||
1315 | } | 1315 | } |
1316 | } | 1316 | } |
1317 | 1317 | ||
1318 | if (handle->h_sync) | ||
1319 | transaction->t_synchronous_commit = 1; | ||
1318 | current->journal_info = NULL; | 1320 | current->journal_info = NULL; |
1319 | spin_lock(&journal->j_state_lock); | 1321 | spin_lock(&journal->j_state_lock); |
1320 | spin_lock(&transaction->t_handle_lock); | 1322 | spin_lock(&transaction->t_handle_lock); |
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h index 4d248b3f1323..8815a3456b3b 100644 --- a/include/linux/jbd2.h +++ b/include/linux/jbd2.h | |||
@@ -649,6 +649,12 @@ struct transaction_s | |||
649 | int t_handle_count; | 649 | int t_handle_count; |
650 | 650 | ||
651 | /* | 651 | /* |
652 | * This transaction is being forced and some process is | ||
653 | * waiting for it to finish. | ||
654 | */ | ||
655 | int t_synchronous_commit:1; | ||
656 | |||
657 | /* | ||
652 | * For use by the filesystem to store fs-specific data | 658 | * For use by the filesystem to store fs-specific data |
653 | * structures associated with the transaction | 659 | * structures associated with the transaction |
654 | */ | 660 | */ |