Skip to content

Commit f73bee4

Browse files
jankaraJens Axboe
authored andcommitted
jbd2: Modify ASYNC_COMMIT code to not rely on queue draining on barrier
Currently JBD2 relies blkdev_issue_flush() draining the queue when ASYNC_COMMIT feature is set. This property is going away so make JBD2 wait for buffers it needs on its own before submitting the cache flush. Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
1 parent 4524451 commit f73bee4

1 file changed

Lines changed: 16 additions & 13 deletions

File tree

‎fs/jbd2/commit.c‎

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -701,6 +701,16 @@ void jbd2_journal_commit_transaction(journal_t *journal)
701701
}
702702
}
703703

704+
err = journal_finish_inode_data_buffers(journal, commit_transaction);
705+
if (err) {
706+
printk(KERN_WARNING
707+
"JBD2: Detected IO errors while flushing file data "
708+
"on %s\n", journal->j_devname);
709+
if (journal->j_flags & JBD2_ABORT_ON_SYNCDATA_ERR)
710+
jbd2_journal_abort(journal, err);
711+
err = 0;
712+
}
713+
704714
/*
705715
* If the journal is not located on the file system device,
706716
* then we must flush the file system device before we issue
@@ -719,19 +729,6 @@ void jbd2_journal_commit_transaction(journal_t *journal)
719729
&cbh, crc32_sum);
720730
if (err)
721731
__jbd2_journal_abort_hard(journal);
722-
if (journal->j_flags & JBD2_BARRIER)
723-
blkdev_issue_flush(journal->j_dev, GFP_KERNEL, NULL,
724-
BLKDEV_IFL_WAIT);
725-
}
726-
727-
err = journal_finish_inode_data_buffers(journal, commit_transaction);
728-
if (err) {
729-
printk(KERN_WARNING
730-
"JBD2: Detected IO errors while flushing file data "
731-
"on %s\n", journal->j_devname);
732-
if (journal->j_flags & JBD2_ABORT_ON_SYNCDATA_ERR)
733-
jbd2_journal_abort(journal, err);
734-
err = 0;
735732
}
736733

737734
/* Lo and behold: we have just managed to send a transaction to
@@ -845,6 +842,12 @@ void jbd2_journal_commit_transaction(journal_t *journal)
845842
}
846843
if (!err && !is_journal_aborted(journal))
847844
err = journal_wait_on_commit_record(journal, cbh);
845+
if (JBD2_HAS_INCOMPAT_FEATURE(journal,
846+
JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT) &&
847+
journal->j_flags & JBD2_BARRIER) {
848+
blkdev_issue_flush(journal->j_dev, GFP_KERNEL, NULL,
849+
BLKDEV_IFL_WAIT);
850+
}
848851

849852
if (err)
850853
jbd2_journal_abort(journal, err);

0 commit comments

Comments
 (0)