[sheepdog] [PATCH 1/3] journal: ignore invalid journal files

Hitoshi Mitake mitake.hitoshi at gmail.com
Tue Apr 9 18:32:35 CEST 2013


Even if journal files are broken, we can do nothing for recoverying
it. It is better to inform it as log messages and continue the
initialization process.

Signed-off-by: Hitoshi Mitake <mitake.hitoshi at lab.ntt.co.jp>
---
 sheep/journal.c |   16 +++++++---------
 1 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/sheep/journal.c b/sheep/journal.c
index 2e1d21f..6669e79 100644
--- a/sheep/journal.c
+++ b/sheep/journal.c
@@ -245,31 +245,29 @@ skip:
  * we actually only recover one jfile, the other would be empty. This process
  * is fast with buffered IO that only take several secends at most.
  */
-static int check_recover_journal_file(const char *p)
+static void check_recover_journal_file(const char *p)
 {
 	int old = 0, new = 0;
 
 	if (get_old_new_jfile(p, &old, &new) < 0)
-		return -1;
+		return;
 
 	/* No journal file found */
 	if (old == 0)
-		return 0;
+		return;
 
 	if (do_recover(old) < 0)
-		return -1;
+		sd_iprintf("recoverying from journal file (old) failed");
 	if (do_recover(new) < 0)
-		return -1;
-
-	return 0;
+		sd_iprintf("recoverying from journal file (new) failed");
 }
 
 int journal_file_init(const char *path, size_t size, bool skip)
 {
 	int fd;
 
-	if (!skip && check_recover_journal_file(path) < 0)
-		return -1;
+	if (!skip)
+		check_recover_journal_file(path);
 
 	jfile_size = (size * 1024 * 1024) / 2;
 
-- 
1.7.5.1




More information about the sheepdog mailing list