Re: [PATCH] Btrfs: remove unnecessary condition in btrfs_clone() to avoid too much nesting

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jul 02, 2019 at 03:23:07PM +0100, fdmanana@xxxxxxxxxx wrote:
> From: Filipe Manana <fdmanana@xxxxxxxx>
> 
> 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@xxxxxxxx>

Added to misc-next, thanks.



[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux