]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_repair: seed the max lsn from log state in phase 2
authorBrian Foster <bfoster@redhat.com>
Tue, 13 Oct 2015 23:58:25 +0000 (10:58 +1100)
committerDave Chinner <david@fromorbit.com>
Tue, 13 Oct 2015 23:58:25 +0000 (10:58 +1100)
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>
repair/phase2.c

index fe7ed2b71047150e37af94eb053d46ad775cb997..f9d0e22662cb5503754c0874557a0d07d065846d 100644 (file)
@@ -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;
 }
 
 /*