summaryrefslogtreecommitdiff
path: root/fs/btrfs/defrag.c
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2023-09-12 01:09:23 +0200
committerDavid Sterba <dsterba@suse.com>2023-10-12 16:44:14 +0200
commit99be1a66e1fe6c62fbd7c1b0c50ea38c33ffdd5a (patch)
tree4d83e0ee8336713d3455a43aac36159cb2d5e74b /fs/btrfs/defrag.c
parent6422b4cd959d4b796146c4b7746c26eb17783579 (diff)
downloadlwn-99be1a66e1fe6c62fbd7c1b0c50ea38c33ffdd5a.tar.gz
lwn-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/defrag.c')
-rw-r--r--fs/btrfs/defrag.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/btrfs/defrag.c b/fs/btrfs/defrag.c
index f4f68438fc69..5244561e2016 100644
--- a/fs/btrfs/defrag.c
+++ b/fs/btrfs/defrag.c
@@ -1035,8 +1035,8 @@ static int defrag_collect_targets(struct btrfs_inode *inode,
* very likely resulting in a larger extent after writeback is
* triggered (except in a case of free space fragmentation).
*/
- if (test_range_bit(&inode->io_tree, cur, cur + range_len - 1,
- EXTENT_DELALLOC, 0, NULL))
+ if (test_range_bit_exists(&inode->io_tree, cur, cur + range_len - 1,
+ EXTENT_DELALLOC))
goto next;
/*