From: Vyacheslav Dubeyko Subject: [PATCH 2/2] nilfs2: debug messages for log validation sequence investigation Add debug messages for log validation sequence investigation Signed-off-by: Vyacheslav Dubeyko --- fs/nilfs2/recovery.c | 52 +++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 45 insertions(+), 7 deletions(-) diff --git a/fs/nilfs2/recovery.c b/fs/nilfs2/recovery.c index 1e8b044..cb9dd62 100644 --- a/fs/nilfs2/recovery.c +++ b/fs/nilfs2/recovery.c @@ -841,19 +841,23 @@ int nilfs_search_super_root(struct the_nilfs *nilfs, for (;;) { - - pr_debug("NILFS: pseg_start %ld, seg_seq %lld\n", pseg_start, seg_seq); + pr_debug("NILFS: pseg_start %ld, seg_seq %lld\n", + pseg_start, seg_seq); pr_debug("NILFS: cno %lld, segnum %lld\n", cno, segnum); pr_debug("NILFS: nextnum %lld\n", nextnum); brelse(bh_sum); ret = NILFS_SEG_FAIL_IO; bh_sum = nilfs_read_log_header(nilfs, pseg_start, &sum); - if (!bh_sum) + if (!bh_sum) { + pr_debug("NILFS: nilfs_read_log_header error\n"); goto failed; + } ret = nilfs_validate_log(nilfs, seg_seq, bh_sum, sum); if (ret) { + pr_debug("NILFS: nilfs_validate_log: err %d\n", + ret); if (ret == NILFS_SEG_FAIL_IO) goto failed; goto strayed; @@ -862,6 +866,9 @@ int nilfs_search_super_root(struct the_nilfs *nilfs, nblocks = le32_to_cpu(sum->ss_nblocks); pseg_end = pseg_start + nblocks - 1; if (unlikely(pseg_end > seg_end)) { + pr_debug("NILFS: failed consistency\n"); + pr_debug("NILFS: pseg_start %lld, nblocks %d\n", + pseg_start, nblocks); ret = NILFS_SEG_FAIL_CONSISTENCY; goto strayed; } @@ -877,6 +884,7 @@ int nilfs_search_super_root(struct the_nilfs *nilfs, flags = le16_to_cpu(sum->ss_flags); if (!(flags & NILFS_SS_SR) && !scan_newer) { + pr_debug("NILFS: !NILFS_SS_SR && !scan_newer\n"); /* This will never happen because a superblock (last_segment) always points to a pseg having a super root. */ @@ -897,10 +905,16 @@ int nilfs_search_super_root(struct the_nilfs *nilfs, } if (flags & NILFS_SS_LOGEND) ri->ri_lsegs_end = pseg_start; + + pr_debug("NILFS: !NILFS_SS_SR\n"); + goto try_next_pseg; } /* A valid super root was found. */ + pr_debug("NILFS: A valid super root was found\n"); + pr_debug("NILFS: cno %lld, pseg_end %lld\n", cno, pseg_end); + ri->ri_cno = cno++; ri->ri_super_root = pseg_end; ri->ri_lsegs_start = ri->ri_lsegs_end = 0; @@ -914,15 +928,28 @@ int nilfs_search_super_root(struct the_nilfs *nilfs, nilfs->ns_ctime = le64_to_cpu(sum->ss_create); nilfs->ns_nextnum = nextnum; - if (scan_newer) + if (scan_newer) { + + pr_debug("NILFS: scan_newer -> need_recovery\n"); + ri->ri_need_recovery = NILFS_RECOVERY_SR_UPDATED; - else { - if (nilfs->ns_mount_state & NILFS_VALID_FS) + } else { + if (nilfs->ns_mount_state & NILFS_VALID_FS) { + + pr_debug("NILFS: NILFS_VALID_FS\n"); + pr_debug("NILFS: super_root_found\n"); + goto super_root_found; + } else { + + pr_debug("NILFS: *not* NILFS_VALID_FS\n"); + + } scan_newer = 1; } try_next_pseg: + pr_debug("NILFS: try_next_pseg\n"); /* Standing on a course, or met an inconsistent state */ pseg_start += nblocks; if (pseg_start < seg_end) @@ -930,6 +957,7 @@ int nilfs_search_super_root(struct the_nilfs *nilfs, goto feed_segment; strayed: + pr_debug("NILFS: strayed: scan_newer %d\n", scan_newer); /* Off the trail */ if (!scan_newer) /* @@ -939,13 +967,16 @@ int nilfs_search_super_root(struct the_nilfs *nilfs, goto failed; feed_segment: + pr_debug("NILFS: feed_segment: empty_seg %d\n", empty_seg); /* Looking to the next full segment */ if (empty_seg++) goto super_root_found; /* found a valid super root */ ret = nilfs_segment_list_add(&segments, segnum); - if (unlikely(ret)) + if (unlikely(ret)) { + pr_debug("NILFS: nilfs_segment_list_add err %d\n", ret); goto failed; + } seg_seq++; segnum = nextnum; @@ -954,15 +985,22 @@ int nilfs_search_super_root(struct the_nilfs *nilfs, } super_root_found: + pr_debug("NILFS: super_root_found\n"); + /* Updating pointers relating to the latest checkpoint */ brelse(bh_sum); list_splice_tail(&segments, &ri->ri_used_segments); nilfs->ns_last_pseg = sr_pseg_start; nilfs->ns_last_seq = nilfs->ns_seg_seq; nilfs->ns_last_cno = ri->ri_cno; + + pr_debug("NILFS: last_pseg %lld, last_seq %lld, last_cno %lld\n", + sr_pseg_start, nilfs->ns_seg_seq, ri->ri_cno); + return 0; failed: + pr_debug("NILFS: nilfs_search_super_root failed\n"); brelse(bh_sum); nilfs_dispose_segment_list(&segments); return (ret < 0) ? ret : nilfs_warn_segment_error(ret); -- 1.7.9.5