At this point, the log state is always available once repair has progressed through phase 2 and the log is only ever zeroed when absolutely necessary. This means that in the common case, repair runs with the log in a non-initialized state. The libxfs max metadata LSN tracking initializes the max LSN to zero, however, which will require updates throughout the repair process even if all metadata LSNs are behind the current LSN. Since all metadata LSNs that are behind the current LSN are valid, seed the libxfs maximum seen LSN value with the log state from phase 2. This is a minor optimization to minimize global variable updates in the common case where all (or most) metadata LSNs are valid. Signed-off-by: Brian Foster <bfoster@xxxxxxxxxx> --- repair/phase2.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/repair/phase2.c b/repair/phase2.c index fe7ed2b..f9d0e22 100644 --- a/repair/phase2.c +++ b/repair/phase2.c @@ -126,6 +126,13 @@ zero_log( if (error || head_blk != tail_blk) do_error(_("failed to clear log")); } + + /* + * Finally, seed the max LSN from the current state of the log if this + * is a v5 filesystem. + */ + if (xfs_sb_version_hascrc(&mp->m_sb)) + libxfs_max_lsn = log->l_last_sync_lsn; } /* -- 2.1.0 _______________________________________________ xfs mailing list xfs@xxxxxxxxxxx http://oss.sgi.com/mailman/listinfo/xfs