]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commit
repair: fix unnecessary secondary scan if only last sb is corrupt
authorBrian Foster <bfoster@redhat.com>
Thu, 5 Feb 2015 23:28:00 +0000 (10:28 +1100)
committerDave Chinner <david@fromorbit.com>
Thu, 5 Feb 2015 23:28:00 +0000 (10:28 +1100)
commit6d23d9a5dad9003d3b4e8e970c393f90a137d10d
tree1d4aca48f6b299808e55df96d7632b69cb0c7fd3
parent7511a9cf1f6e5e49d5c86c6d0f8e1bccfff912a2
repair: fix unnecessary secondary scan if only last sb is corrupt

verify_set_primary_sb() scans the secondary superbocks based on the
geometry specified in the primary and determines the most likely correct
geometry by tracking how many superblocks are consistent across the set.
The most frequent geometry is copied into the primary superblock. The
return value is checked by the caller (phase1()) to determine whether a
brute force secondary scan is necessary.

This generally occurs when not enough secondary sb's are consistent to
declare the geometry correct. If enough secondaries are consistent,
verify_set_primary_sb() returns the status of the last secondary sb that
was scanned. Corruptions to secondary supers other than the last are
thus resolved fine. If the last secondary is corrupt, however, an error
is returned to phase1(). This causes a brute force scan even if enough
supers were found to repair the last secondary.

Move the initialization of retval to after the sb scan to return an
error only if not enough secondary supers were found to declare a
correct geometry.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
repair/sb.c