ref: b8f9e381ce116851390ed96570bcbfdd4af29438
parent: 740927e660015515a8ab6c3e777e76aeffcd140f
author: ngkaho1234 <[email protected]>
date: Thu Dec 17 16:16:13 EST 2015
ext4_journal: forcibly flush data to disk when stop journalling.
--- a/lwext4/ext4_journal.c
+++ b/lwext4/ext4_journal.c
@@ -39,6 +39,7 @@
#include "ext4_types.h"
#include "ext4_fs.h"
#include "ext4_super.h"
+#include "ext4_journal.h"
#include "ext4_errno.h"
#include "ext4_blockdev.h"
#include "ext4_crc32c.h"
@@ -815,11 +816,17 @@
int jbd_journal_stop(struct jbd_journal *journal)
{
+
int r;
struct jbd_fs *jbd_fs = journal->jbd_fs;
- uint32_t features_incompatible =
- ext4_get32(&jbd_fs->inode_ref.fs->sb,
- features_incompatible);
+ uint32_t features_incompatible;
+
+ jbd_journal_commit_all(journal);
+ ext4_block_cache_flush(jbd_fs->inode_ref.fs->bdev);
+
+ features_incompatible =
+ ext4_get32(&jbd_fs->inode_ref.fs->sb,
+ features_incompatible);
features_incompatible &= ~EXT4_FINCOM_RECOVER;
ext4_set32(&jbd_fs->inode_ref.fs->sb,
features_incompatible,
--- a/lwext4/ext4_journal.h
+++ b/lwext4/ext4_journal.h
@@ -65,6 +65,7 @@
void jbd_journal_submit_trans(struct jbd_journal *journal,
struct jbd_trans *trans);
void jbd_journal_commit_one(struct jbd_journal *journal);
+void jbd_journal_commit_all(struct jbd_journal *journal);
#ifdef __cplusplus
}