btrfs: push lock_extent down in cow_file_range()
authorJosef Bacik <josef@toxicpanda.com>
Wed, 3 Apr 2024 19:06:09 +0000 (15:06 -0400)
committerDavid Sterba <dsterba@suse.com>
Tue, 7 May 2024 19:31:10 +0000 (21:31 +0200)
commitd456c25dbb2385fa081e615793c797cbcd412724
treeb299e5f6042b147503bd0f492ac5ab925256824c
parentcd241a8f554c258e92a694f6aa07e90b89ddebe6
btrfs: push lock_extent down in cow_file_range()

Now that we've got the extent lock pushed into cow_file_range() we can
push it further down into the allocation loop.  This allows us to only
hold the extent lock during the dropping of the extent map range and
inserting the ordered extent.

This makes the error case a little trickier as we'll now have to lock
the range before clearing any of the other extent bits for the range,
but this is the error path so is less performance critical.

Reviewed-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/inode.c