shithub: lwext4

Download patch

ref: f50e499b22fabdb125ac03a4cf8619c5cc3bae27
parent: 9dc5fd9ed3705ab5ff9244ae77cb57598074aee5
author: Kaho Ng <ngkaho1234@gmail.com>
date: Sun Apr 24 17:12:43 EDT 2016

ext4_journal: add once parameter to loops.

--- a/src/ext4_journal.c
+++ b/src/ext4_journal.c
@@ -1323,7 +1323,8 @@
 
 static void
 jbd_journal_purge_cp_trans(struct jbd_journal *journal,
-			   bool flush)
+			   bool flush,
+			   bool once)
 {
 	struct jbd_trans *trans;
 	while ((trans = TAILQ_FIRST(&journal->cp_queue))) {
@@ -1361,6 +1362,8 @@
 			} else
 				jbd_journal_flush_trans(trans);
 		}
+		if (once)
+			break;
 	}
 }
 
@@ -1375,7 +1378,7 @@
 
 	/* Make sure that journalled content have reached
 	 * the disk.*/
-	jbd_journal_purge_cp_trans(journal, true);
+	jbd_journal_purge_cp_trans(journal, true, false);
 
 	/* There should be no block record in this journal
 	 * session. */
@@ -1418,7 +1421,7 @@
 	/* If there is no space left, flush all journalled
 	 * blocks to disk first.*/
 	if (journal->last == journal->start)
-		jbd_journal_purge_cp_trans(journal, true);
+		jbd_journal_purge_cp_trans(journal, true, false);
 
 	return start_block;
 }
@@ -2083,7 +2086,7 @@
 			TAILQ_REMOVE(&journal->cp_queue, trans, trans_node);
 			jbd_journal_free_trans(journal, trans, false);
 
-			jbd_journal_purge_cp_trans(journal, false);
+			jbd_journal_purge_cp_trans(journal, false, true);
 			jbd_journal_write_sb(journal);
 			jbd_write_sb(journal->jbd_fs);
 		}