btrfs: free path sooner at __btrfs_unlink_inode()
authorFilipe Manana <fdmanana@suse.com>
Thu, 29 May 2025 14:47:24 +0000 (15:47 +0100)
committerDavid Sterba <dsterba@suse.com>
Mon, 21 Jul 2025 21:53:29 +0000 (23:53 +0200)
commit0ef4c6120e253f3c7ea2308527a94bc3312f8fa9
treebf924776c7b1e80714a2716bb1a4cb1aeb1c1bbe
parentd94edb0d7e38e520174c0846afa5337319c1ac5f
btrfs: free path sooner at __btrfs_unlink_inode()

After calling btrfs_delete_one_dir_name() there's no need for the path
anymore so we can free it immediately after. After that point we do
some btree operations that take time and in those call chains we end up
allocating paths for these operations, so we're unnecessarily holding on
to the path we allocated early at __btrfs_unlink_inode().

So free the path as soon as we don't need it and add a comment. This
also allows to simplify the error path, removing two exit labels and
returning directly when an error happens.

Reviewed-by: Boris Burkov <boris@bur.io>
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/inode.c