Fix off-by-one bug in range tree code #17363
Merged
+1
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Sponsored-by: Klara, Inc.
Sponsored-by: Wasabi Technology, Inc.
Motivation and Context
Without this fix, zfs_range_tree_find_in could return an overlap when the found range starts immediately after the searched range, with no actual overlap. For example, a tree with only a range from 10 to 14 inclusive (start 10, size 5), would return an overlap if you called
zfs_range_tree_find_in(rt, 0, 10, ...)
Description
Fix the bug by changing to
>=
instead of>
.How Has This Been Tested?
Tested in conjunction with a new utility I've been developing that isn't quite ready for release yet.
Types of changes
Checklist:
Signed-off-by
.