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@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
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;
}
/*