summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/extent-io-tree.h
diff options
context:
space:
mode:
authorJosef Bacik <josef@toxicpanda.com>2022-09-30 16:45:12 -0400
committerDavid Sterba <dsterba@suse.com>2022-12-05 18:00:36 +0100
commit123a7f008c9e2b25b451c116620f1f6c77bd6b2b (patch)
tree6049c62d83b5b119bda4b499fdca79188584dfe3 /fs/btrfs/extent-io-tree.h
parent9c5c9604631ae5fcdc5124c79d01d75f80b5ffd4 (diff)
downloadlinux-123a7f008c9e2b25b451c116620f1f6c77bd6b2b.tar.gz
linux-123a7f008c9e2b25b451c116620f1f6c77bd6b2b.tar.bz2
linux-123a7f008c9e2b25b451c116620f1f6c77bd6b2b.zip
btrfs: cache the failed state when locking extents
Currently if we fail to lock a range we'll return the start of the range that we failed to lock. We'll then search down to this range and wait on any extent states in this range. However we can avoid this search altogether if we simply cache the extent_state that had the contention. We can pass this into wait_extent_bit() and start from that extent_state without doing the search. In the most optimistic case we can avoid all searches, more likely we'll avoid the initial search and have to perform the search after we wait on the failed state, or worst case we must search both times which is what currently happens. 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-tree.h')
-rw-r--r--fs/btrfs/extent-io-tree.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/btrfs/extent-io-tree.h b/fs/btrfs/extent-io-tree.h
index 786be8f38f0b..c71aa29f719d 100644
--- a/fs/btrfs/extent-io-tree.h
+++ b/fs/btrfs/extent-io-tree.h
@@ -235,6 +235,7 @@ int find_contiguous_extent_bit(struct extent_io_tree *tree, u64 start,
bool btrfs_find_delalloc_range(struct extent_io_tree *tree, u64 *start,
u64 *end, u64 max_bytes,
struct extent_state **cached_state);
-void wait_extent_bit(struct extent_io_tree *tree, u64 start, u64 end, u32 bits);
+void wait_extent_bit(struct extent_io_tree *tree, u64 start, u64 end, u32 bits,
+ struct extent_state **cached_state);
#endif /* BTRFS_EXTENT_IO_TREE_H */