]> git.baikalelectronics.ru Git - kernel.git/commit
Btrfs: remove unnecessary condition in btrfs_clone() to avoid too much nesting
authorFilipe Manana <fdmanana@suse.com>
Tue, 2 Jul 2019 14:23:07 +0000 (15:23 +0100)
committerDavid Sterba <dsterba@suse.com>
Mon, 9 Sep 2019 12:59:02 +0000 (14:59 +0200)
commit4806552f97d04fb0a0f328eb7e3f3f9660eb634c
treec51e6d3267cdf3491cf415dfb279ce538278a0d0
parent4f6f911f2880ea50b5a283a8c68508a9cd9a502c
Btrfs: remove unnecessary condition in btrfs_clone() to avoid too much nesting

The bulk of the work done when cloning extents, at ioctl.c:btrfs_clone(),
is done inside an if statement that checks if the found key has the type
BTRFS_EXTENT_DATA_KEY. That if statement is redundant however, because
btrfs_search_slot() always leaves us in a leaf slot that points to a key
that is always greater then or equals to the search key, and our search
key here has that type, and because we bail out before that if statement
if the key at the given leaf slot is greater then BTRFS_EXTENT_DATA_KEY.

Therefore just remove that if statement, not only because it is useless
but mostly because it increases the nesting/indentation level in this
function which is quite big and makes things a bit awkward whenever I need
to fix something that requires changing btrfs_clone() (and it has been
like that for many years already).

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/ioctl.c