]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: Cleanup and simplify find_newest_super_backup
authorNikolay Borisov <nborisov@suse.com>
Tue, 15 Oct 2019 15:42:17 +0000 (18:42 +0300)
committerDavid Sterba <dsterba@suse.com>
Mon, 18 Nov 2019 16:51:46 +0000 (17:51 +0100)
commit2a9d748dd17ac2138565664dd3b04922d637a5ef
treead87c2ac27d704b03e9c2bb92ae01a1ce798b87d
parentde325081017062ee78d95a7848279a0f696c96ea
btrfs: Cleanup and simplify find_newest_super_backup

Backup roots are always written in a circular manner. By definition we
can only ever have 1 backup root whose generation equals to that of the
superblock. Hence, the 'if' in the for loop will trigger at most once.
This is sufficient to return the newest backup root.

Furthermore the newest_gen parameter is always set to the generation of
the superblock. This value can be obtained from the fs_info.

This patch removes the unnecessary code dealing with the wraparound
case and makes 'newest_gen' a local variable.

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/disk-io.c