aboutsummaryrefslogtreecommitdiff
path: root/fs/btrfs/extent_io.c
diff options
context:
space:
mode:
authorGravatar David Sterba <dsterba@suse.com> 2023-09-12 01:09:23 +0200
committerGravatar David Sterba <dsterba@suse.com> 2023-10-12 16:44:14 +0200
commit99be1a66e1fe6c62fbd7c1b0c50ea38c33ffdd5a (patch)
tree4d83e0ee8336713d3455a43aac36159cb2d5e74b /fs/btrfs/extent_io.c
parentbtrfs: move btrfs_realloc_node() from ctree.c into defrag.c (diff)
downloadlinux-99be1a66e1fe6c62fbd7c1b0c50ea38c33ffdd5a.tar.gz
linux-99be1a66e1fe6c62fbd7c1b0c50ea38c33ffdd5a.tar.bz2
linux-99be1a66e1fe6c62fbd7c1b0c50ea38c33ffdd5a.zip
btrfs: add specific helper for range bit test exists
The existing helper test_range_bit works in two ways, checks if the whole range contains all the bits, or stop on the first occurrence. By adding a specific helper for the latter case, the inner loop can be simplified and contains fewer conditionals, making it a bit faster. There's no caller that uses the cached state pointer so this reduces the argument count further. Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/extent_io.c')
-rw-r--r--fs/btrfs/extent_io.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 5e5852a4ffb5..ffd0be61ef77 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -2293,7 +2293,7 @@ static int try_release_extent_state(struct extent_io_tree *tree,
u64 end = start + PAGE_SIZE - 1;
int ret = 1;
- if (test_range_bit(tree, start, end, EXTENT_LOCKED, 0, NULL)) {
+ if (test_range_bit_exists(tree, start, end, EXTENT_LOCKED)) {
ret = 0;
} else {
u32 clear_bits = ~(EXTENT_LOCKED | EXTENT_NODATASUM |
@@ -2352,9 +2352,9 @@ int try_release_extent_mapping(struct page *page, gfp_t mask)
free_extent_map(em);
break;
}
- if (test_range_bit(tree, em->start,
- extent_map_end(em) - 1,
- EXTENT_LOCKED, 0, NULL))
+ if (test_range_bit_exists(tree, em->start,
+ extent_map_end(em) - 1,
+ EXTENT_LOCKED))
goto next;
/*
* If it's not in the list of modified extents, used