ref: 6cb2cd7182476f06e85b699bc41fef11a3324792
parent: 1e40e86f90db6a80c2217eb74ddd198d7073a258
author: ngkaho1234 <[email protected]>
date: Thu Dec 17 04:04:15 EST 2015
ext4_journal: flush all data to disk when journal is full.
--- a/lwext4/ext4_journal.c
+++ b/lwext4/ext4_journal.c
@@ -838,9 +838,14 @@
static uint32_t jbd_journal_alloc_block(struct jbd_journal *journal,
struct jbd_trans *trans)
{
- uint32_t start_block = journal->last++;
+ uint32_t start_block;
+
+ start_block = journal->last++;
trans->alloc_blocks++;
wrap(&journal->jbd_fs->sb, journal->last);
+ if (journal->last == journal->start)
+ ext4_block_cache_flush(journal->jbd_fs->inode_ref.fs->bdev);
+
return start_block;
}
@@ -1190,6 +1195,7 @@
int rc = EOK;
uint32_t last = journal->last;
struct jbd_trans *trans;
+
if ((trans = TAILQ_FIRST(&journal->trans_queue))) {
TAILQ_REMOVE(&journal->trans_queue, trans, trans_node);