At Thu, 11 Apr 2013 13:31:39 +0800, Liu Yuan wrote: > > On 04/10/2013 04:25 PM, Hitoshi Mitake wrote: > > From: Hitoshi Mitake <[email protected]> > > > > 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 <[email protected]> > > --- > > > > v2: panic when do_recover() fails > > > > sheep/journal.c | 16 +++++++--------- > > 1 files changed, 7 insertions(+), 9 deletions(-) > > > > diff --git a/sheep/journal.c b/sheep/journal.c > > index 2e1d21f..59608ac 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; > > + panic("recoverying from journal file (old) failed"); > > if (do_recover(new) < 0) > > - return -1; > > - > > - return 0; > > + panic("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; > > > > > > We need to handle empty jfile too (proceed when meeting empty jfile, not > exist as now). Empty jfile could exist when sheep crash just between > ftruncate() and prealloc() in commit_data().
I couldn't assume such a case. I'll do it in v2. Thanks, Hitoshi -- sheepdog mailing list [email protected] http://lists.wpkg.org/mailman/listinfo/sheepdog
