diff options
author | Josef Bacik <josef@toxicpanda.com> | 2022-09-30 23:45:09 +0300 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2022-12-05 20:00:35 +0300 |
commit | 83ae4133ac9410ac6a57136e464d498dc66200cf (patch) | |
tree | bd15d841a61d95ee74c41f6773ea748bbe617951 /fs/btrfs/extent_io.c | |
parent | 76dcd734eca23168cb008912c0f69ff408905235 (diff) | |
download | linux-83ae4133ac9410ac6a57136e464d498dc66200cf.tar.xz |
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>
Diffstat (limited to 'fs/btrfs/extent_io.c')
-rw-r--r-- | fs/btrfs/extent_io.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 4dcf22e051ff..c7e94a0e60d5 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -4959,7 +4959,8 @@ static int read_extent_buffer_subpage(struct extent_buffer *eb, int wait, io_tree = &BTRFS_I(fs_info->btree_inode)->io_tree; if (wait == WAIT_NONE) { - if (!try_lock_extent(io_tree, eb->start, eb->start + eb->len - 1)) + if (!try_lock_extent(io_tree, eb->start, eb->start + eb->len - 1, + NULL)) return -EAGAIN; } else { ret = lock_extent(io_tree, eb->start, eb->start + eb->len - 1, NULL); |