btrfs: add a cached_state to try_lock_extent
authorJosef Bacik <josef@toxicpanda.com>
Fri, 30 Sep 2022 20:45:09 +0000 (16:45 -0400)
committerDavid Sterba <dsterba@suse.com>
Mon, 5 Dec 2022 17:00:35 +0000 (18:00 +0100)
commit83ae4133ac9410ac6a57136e464d498dc66200cf
treebd15d841a61d95ee74c41f6773ea748bbe617951
parent76dcd734eca23168cb008912c0f69ff408905235
btrfs: add a cached_state to try_lock_extent

With nowait becoming more pervasive throughout our codebase go ahead and
add a cached_state to try_lock_extent().  This allows us to be faster
about clearing the locked area if we have contention, and then gives us
the same optimization for unlock if we are able to lock the range.

Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/extent-io-tree.c
fs/btrfs/extent-io-tree.h
fs/btrfs/extent_io.c
fs/btrfs/file.c
fs/btrfs/inode.c
fs/btrfs/ordered-data.c
fs/btrfs/relocation.c