From: Brian Foster Date: Tue, 13 Oct 2015 23:58:25 +0000 (+1100) Subject: xfs_repair: seed the max lsn from log state in phase 2 X-Git-Tag: v4.3.0-rc1~14 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9d2d8bd0f3d38410425f51483ea2fca9e565e0a8;p=thirdparty%2Fxfsprogs-dev.git xfs_repair: seed the max lsn from log state in phase 2 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 Reviewed-by: Dave Chinner Signed-off-by: Dave Chinner --- diff --git a/repair/phase2.c b/repair/phase2.c index fe7ed2b71..f9d0e2266 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; } /*