From: Filipe Manana Date: Wed, 2 Apr 2025 13:10:53 +0000 (+0100) Subject: btrfs: remove redundant record start offset check at test_range_bit() X-Git-Tag: v6.16-rc1~214^2~168 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c6a43322a3ab01da6c7588c29a0a918b9d797c11;p=thirdparty%2Fkernel%2Fstable.git btrfs: remove redundant record start offset check at test_range_bit() It's pointless to check if the current record's start offset is greater than the end offset, as before we just tested if it was greater than the start offset - and if it's not it means it's less than or equal to the start offset, so it can not be greater than the end offset, as our start offset is always smaller than the end offset. So remove that check and also add an assertion to verify the start offset is smaller then the end offset. Signed-off-by: Filipe Manana Reviewed-by: David Sterba Signed-off-by: David Sterba --- diff --git a/fs/btrfs/extent-io-tree.c b/fs/btrfs/extent-io-tree.c index b321f826d0086..d833ab2d69a13 100644 --- a/fs/btrfs/extent-io-tree.c +++ b/fs/btrfs/extent-io-tree.c @@ -1794,6 +1794,7 @@ bool test_range_bit(struct extent_io_tree *tree, u64 start, u64 end, u32 bit, bool bitset = true; ASSERT(is_power_of_2(bit)); + ASSERT(start < end); spin_lock(&tree->lock); if (cached && extent_state_in_tree(cached) && cached->start <= start && @@ -1807,9 +1808,6 @@ bool test_range_bit(struct extent_io_tree *tree, u64 start, u64 end, u32 bit, break; } - if (state->start > end) - break; - if ((state->state & bit) == 0) { bitset = false; break;