]> 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)
commit6ae319033e717f768cff3fafdf216b380845a6f1
treead87c2ac27d704b03e9c2bb92ae01a1ce798b87d
parentee9fa3c130209388cccf82474ba31f0dd9866626
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