shithub: lwext4

Download patch

ref: 740927e660015515a8ab6c3e777e76aeffcd140f
parent: 824e15d0a277d9c6b9e357226dce4ae79d748bbc
author: ngkaho1234 <[email protected]>
date: Thu Dec 17 04:44:06 EST 2015

ext4_journal: wrap around journal->start if it overflows.

--- a/lwext4/ext4_journal.c
+++ b/lwext4/ext4_journal.c
@@ -1160,6 +1160,7 @@
 		if (first_in_queue) {
 			journal->start = trans->start_iblock +
 				trans->alloc_blocks;
+			wrap(&journal->jbd_fs->sb, journal->start);
 			journal->trans_id = trans->trans_id + 1;
 		}
 		jbd_journal_free_trans(journal, trans, false);
@@ -1172,11 +1173,13 @@
 						     trans_node);
 					journal->start = trans->start_iblock +
 						trans->alloc_blocks;
+					wrap(&journal->jbd_fs->sb, journal->start);
 					journal->trans_id = trans->trans_id + 1;
 					jbd_journal_free_trans(journal,
 							       trans, false);
 				} else {
 					journal->start = trans->start_iblock;
+					wrap(&journal->jbd_fs->sb, journal->start);
 					journal->trans_id = trans->trans_id;
 					break;
 				}
@@ -1213,6 +1216,7 @@
 		if (TAILQ_EMPTY(&journal->cp_queue)) {
 			if (trans->data_cnt) {
 				journal->start = trans->start_iblock;
+				wrap(&journal->jbd_fs->sb, journal->start);
 				journal->trans_id = trans->trans_id;
 				jbd_journal_write_sb(journal);
 				jbd_write_sb(journal->jbd_fs);
@@ -1222,6 +1226,7 @@
 			} else {
 				journal->start = trans->start_iblock +
 					trans->alloc_blocks;
+				wrap(&journal->jbd_fs->sb, journal->start);
 				journal->trans_id = trans->trans_id + 1;
 				jbd_journal_write_sb(journal);
 				jbd_journal_free_trans(journal, trans, false);