shithub: lwext4

Download patch

ref: e7519e14cb64ecc2ea8dcff1207e223432dd51c3
parent: 9668eacad96304fd50a6d5bf8cda00ba915108a0
author: ngkaho1234 <ngkaho1234@gmail.com>
date: Sat Nov 28 21:57:05 EST 2015

ext4_journal: try to detect if any blocks are revoked in a transaction.

--- a/lwext4/ext4_journal.c
+++ b/lwext4/ext4_journal.c
@@ -32,6 +32,7 @@
 struct replay_arg {
 	struct recover_info *info;
 	uint32_t *this_block;
+	uint32_t this_trans_id;
 };
 
 static int
@@ -344,6 +345,7 @@
 	struct revoke_entry *revoke_entry;
 	struct ext4_block journal_block, ext4_block;
 	struct ext4_fs *fs = jbd_fs->inode_ref.fs;
+
 	ext4_dbg(DEBUG_JBD,
 		 "Replaying block in block_tag: %" PRIu64 "\n",
 		 block);
@@ -350,7 +352,8 @@
 	(*this_block)++;
 
 	revoke_entry = jbd_revoke_entry_lookup(info, block);
-	if (revoke_entry)
+	if (revoke_entry &&
+	    arg->this_trans_id < revoke_entry->trans_id)
 		return;
 
 	r = jbd_block_get(jbd_fs, &journal_block, *this_block);
@@ -551,6 +554,8 @@
 				struct replay_arg replay_arg;
 				replay_arg.info = info;
 				replay_arg.this_block = &this_block;
+				replay_arg.this_trans_id = this_trans_id;
+
 				jbd_replay_descriptor_block(jbd_fs,
 						header, &replay_arg);
 			}