diff options
Diffstat (limited to 'fs/jbd2/checkpoint.c')
-rw-r--r-- | fs/jbd2/checkpoint.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/fs/jbd2/checkpoint.c b/fs/jbd2/checkpoint.c index ca0f5eb62b20..30beb11ef928 100644 --- a/fs/jbd2/checkpoint.c +++ b/fs/jbd2/checkpoint.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/jbd2.h> | 22 | #include <linux/jbd2.h> |
23 | #include <linux/errno.h> | 23 | #include <linux/errno.h> |
24 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
25 | #include <linux/blkdev.h> | ||
25 | #include <trace/events/jbd2.h> | 26 | #include <trace/events/jbd2.h> |
26 | 27 | ||
27 | /* | 28 | /* |
@@ -506,6 +507,7 @@ int jbd2_cleanup_journal_tail(journal_t *journal) | |||
506 | if (blocknr < journal->j_tail) | 507 | if (blocknr < journal->j_tail) |
507 | freed = freed + journal->j_last - journal->j_first; | 508 | freed = freed + journal->j_last - journal->j_first; |
508 | 509 | ||
510 | trace_jbd2_cleanup_journal_tail(journal, first_tid, blocknr, freed); | ||
509 | jbd_debug(1, | 511 | jbd_debug(1, |
510 | "Cleaning journal tail from %d to %d (offset %lu), " | 512 | "Cleaning journal tail from %d to %d (offset %lu), " |
511 | "freeing %lu\n", | 513 | "freeing %lu\n", |
@@ -515,6 +517,20 @@ int jbd2_cleanup_journal_tail(journal_t *journal) | |||
515 | journal->j_tail_sequence = first_tid; | 517 | journal->j_tail_sequence = first_tid; |
516 | journal->j_tail = blocknr; | 518 | journal->j_tail = blocknr; |
517 | spin_unlock(&journal->j_state_lock); | 519 | spin_unlock(&journal->j_state_lock); |
520 | |||
521 | /* | ||
522 | * If there is an external journal, we need to make sure that | ||
523 | * any data blocks that were recently written out --- perhaps | ||
524 | * by jbd2_log_do_checkpoint() --- are flushed out before we | ||
525 | * drop the transactions from the external journal. It's | ||
526 | * unlikely this will be necessary, especially with a | ||
527 | * appropriately sized journal, but we need this to guarantee | ||
528 | * correctness. Fortunately jbd2_cleanup_journal_tail() | ||
529 | * doesn't get called all that often. | ||
530 | */ | ||
531 | if ((journal->j_fs_dev != journal->j_dev) && | ||
532 | (journal->j_flags & JBD2_BARRIER)) | ||
533 | blkdev_issue_flush(journal->j_fs_dev, NULL); | ||
518 | if (!(journal->j_flags & JBD2_ABORT)) | 534 | if (!(journal->j_flags & JBD2_ABORT)) |
519 | jbd2_journal_update_superblock(journal, 1); | 535 | jbd2_journal_update_superblock(journal, 1); |
520 | return 0; | 536 | return 0; |