]> git.ipfire.org Git - thirdparty/linux.git/commit
btrfs: simplify error detection flow during log replay
authorFilipe Manana <fdmanana@suse.com>
Wed, 21 May 2025 17:18:09 +0000 (18:18 +0100)
committerDavid Sterba <dsterba@suse.com>
Mon, 21 Jul 2025 21:50:34 +0000 (23:50 +0200)
commit81bfd9d54767d0ec85853102b9a1a02123458314
tree8bd7d26a10a5b9571885619f2d9fed0a7ba1df1e
parent6466084df6b083b6f0778aa9adcb83cb8880597e
btrfs: simplify error detection flow during log replay

We have this fuzzy logic at btrfs_recover_log_trees() where we don't
abort the transaction and exit immediately after each function call that
returned an error, and instead have if-then-else logic or check if the
previous function call returned success before calling the next function.

Make the flow more straightforward by immediately aborting the transaction
and exiting after each function call failure. This also allows to avoid
two consecutive if statements that test the same conditions:

   if (!ret && wc.stage == LOG_WALK_REPLAY_ALL) {
        (...)
   }

Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/tree-log.c