diff options
| author | ngkaho1234 <ngkaho1234@gmail.com> | 2015-12-17 09:04:15 +0000 |
|---|---|---|
| committer | ngkaho1234 <ngkaho1234@gmail.com> | 2015-12-17 09:38:04 +0000 |
| commit | 6cb2cd7182476f06e85b699bc41fef11a3324792 (patch) | |
| tree | dc3cae9f549a807332fb3048d021e1f293d4b162 | |
| parent | 1e40e86f90db6a80c2217eb74ddd198d7073a258 (diff) | |
ext4_journal: flush all data to disk when journal is full.
| -rw-r--r-- | lwext4/ext4_journal.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lwext4/ext4_journal.c b/lwext4/ext4_journal.c index 4bbaeb0..7e148e8 100644 --- a/lwext4/ext4_journal.c +++ b/lwext4/ext4_journal.c @@ -838,9 +838,14 @@ int jbd_journal_stop(struct jbd_journal *journal) 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 @@ void jbd_journal_commit_one(struct jbd_journal *journal) 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); |
