[f2fs_reader] Properly handle checkpoints.

This change addresses a bug where the f2fs reader could fail if it
selected a checkpoint that appeared valid but was associated with a
corrupt or unreadable summary block.

Previously, the reader would select the newest checkpoint based on its
version number alone, without fully validating the data it pointed to.
(In particular, the problem I noticed we failed to identify was an
invalid compact summary block).

This change makes the reader more robust by treating the checkpoint and
its summary block as a single unit for validation. It now attempts to
initialize the filesystem from each available checkpoint, from newest to
oldest, and uses the first one that is fully and correctly loaded. This
ensures that a bad checkpoint pack does not prevent the reader from
starting if a good one is available.

Change-Id: Ibffbd3f9d34a2e745742b113a3037d8723c0cb99
Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/1455529
Fuchsia-Auto-Submit: Aaron Drew <ripper@google.com>
Reviewed-by: Rui Qi Sim <rqsim@google.com>
Commit-Queue: Aaron Drew <ripper@google.com>
2 files changed