diff options
Diffstat (limited to 'fs/jbd/commit.c')
-rw-r--r-- | fs/jbd/commit.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/fs/jbd/commit.c b/fs/jbd/commit.c index f2b9a571f4cf..52c15c776029 100644 --- a/fs/jbd/commit.c +++ b/fs/jbd/commit.c | |||
@@ -298,6 +298,7 @@ void journal_commit_transaction(journal_t *journal) | |||
298 | int tag_flag; | 298 | int tag_flag; |
299 | int i; | 299 | int i; |
300 | struct blk_plug plug; | 300 | struct blk_plug plug; |
301 | int write_op = WRITE; | ||
301 | 302 | ||
302 | /* | 303 | /* |
303 | * First job: lock down the current transaction and wait for | 304 | * First job: lock down the current transaction and wait for |
@@ -307,7 +308,16 @@ void journal_commit_transaction(journal_t *journal) | |||
307 | /* Do we need to erase the effects of a prior journal_flush? */ | 308 | /* Do we need to erase the effects of a prior journal_flush? */ |
308 | if (journal->j_flags & JFS_FLUSHED) { | 309 | if (journal->j_flags & JFS_FLUSHED) { |
309 | jbd_debug(3, "super block updated\n"); | 310 | jbd_debug(3, "super block updated\n"); |
310 | journal_update_superblock(journal, 1); | 311 | mutex_lock(&journal->j_checkpoint_mutex); |
312 | /* | ||
313 | * We hold j_checkpoint_mutex so tail cannot change under us. | ||
314 | * We don't need any special data guarantees for writing sb | ||
315 | * since journal is empty and it is ok for write to be | ||
316 | * flushed only with transaction commit. | ||
317 | */ | ||
318 | journal_update_sb_log_tail(journal, journal->j_tail_sequence, | ||
319 | journal->j_tail, WRITE_SYNC); | ||
320 | mutex_unlock(&journal->j_checkpoint_mutex); | ||
311 | } else { | 321 | } else { |
312 | jbd_debug(3, "superblock not updated\n"); | 322 | jbd_debug(3, "superblock not updated\n"); |
313 | } | 323 | } |
@@ -413,13 +423,16 @@ void journal_commit_transaction(journal_t *journal) | |||
413 | 423 | ||
414 | jbd_debug (3, "JBD: commit phase 2\n"); | 424 | jbd_debug (3, "JBD: commit phase 2\n"); |
415 | 425 | ||
426 | if (tid_geq(journal->j_commit_waited, commit_transaction->t_tid)) | ||
427 | write_op = WRITE_SYNC; | ||
428 | |||
416 | /* | 429 | /* |
417 | * Now start flushing things to disk, in the order they appear | 430 | * Now start flushing things to disk, in the order they appear |
418 | * on the transaction lists. Data blocks go first. | 431 | * on the transaction lists. Data blocks go first. |
419 | */ | 432 | */ |
420 | blk_start_plug(&plug); | 433 | blk_start_plug(&plug); |
421 | err = journal_submit_data_buffers(journal, commit_transaction, | 434 | err = journal_submit_data_buffers(journal, commit_transaction, |
422 | WRITE_SYNC); | 435 | write_op); |
423 | blk_finish_plug(&plug); | 436 | blk_finish_plug(&plug); |
424 | 437 | ||
425 | /* | 438 | /* |
@@ -478,7 +491,7 @@ void journal_commit_transaction(journal_t *journal) | |||
478 | 491 | ||
479 | blk_start_plug(&plug); | 492 | blk_start_plug(&plug); |
480 | 493 | ||
481 | journal_write_revoke_records(journal, commit_transaction, WRITE_SYNC); | 494 | journal_write_revoke_records(journal, commit_transaction, write_op); |
482 | 495 | ||
483 | /* | 496 | /* |
484 | * If we found any dirty or locked buffers, then we should have | 497 | * If we found any dirty or locked buffers, then we should have |
@@ -649,7 +662,7 @@ start_journal_io: | |||
649 | clear_buffer_dirty(bh); | 662 | clear_buffer_dirty(bh); |
650 | set_buffer_uptodate(bh); | 663 | set_buffer_uptodate(bh); |
651 | bh->b_end_io = journal_end_buffer_io_sync; | 664 | bh->b_end_io = journal_end_buffer_io_sync; |
652 | submit_bh(WRITE_SYNC, bh); | 665 | submit_bh(write_op, bh); |
653 | } | 666 | } |
654 | cond_resched(); | 667 | cond_resched(); |
655 | 668 | ||