From e7519e14cb64ecc2ea8dcff1207e223432dd51c3 Mon Sep 17 00:00:00 2001 From: ngkaho1234 Date: Sun, 29 Nov 2015 02:57:05 +0000 Subject: [PATCH] ext4_journal: try to detect if any blocks are revoked in a transaction. --- lwext4/ext4_journal.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lwext4/ext4_journal.c b/lwext4/ext4_journal.c index 6297abc..074e374 100644 --- a/lwext4/ext4_journal.c +++ b/lwext4/ext4_journal.c @@ -32,6 +32,7 @@ struct recover_info { struct replay_arg { struct recover_info *info; uint32_t *this_block; + uint32_t this_trans_id; }; static int @@ -344,13 +345,15 @@ static void jbd_replay_block_tags(struct jbd_fs *jbd_fs, 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); (*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 @@ int jbd_iterate_log(struct jbd_fs *jbd_fs, 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); }