Skip to content

Commit 5b5c2db

Browse files
djwongdchinner
authored andcommitted
xfs: simple btree query range should look right if LE lookup fails
If the initial LOOKUP_LE in the simple query range fails to find anything, we should attempt to increment the btree cursor to see if there actually /are/ records for what we're trying to find. Without this patch, a bnobt range query of (0, $agsize) returns no results because the leftmost record never has a startblock of zero. Signed-off-by: Darrick J. Wong <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Dave Chinner <[email protected]>
1 parent 7222789 commit 5b5c2db

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

fs/xfs/libxfs/xfs_btree.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4558,6 +4558,13 @@ xfs_btree_simple_query_range(
45584558
if (error)
45594559
goto out;
45604560

4561+
/* Nothing? See if there's anything to the right. */
4562+
if (!stat) {
4563+
error = xfs_btree_increment(cur, 0, &stat);
4564+
if (error)
4565+
goto out;
4566+
}
4567+
45614568
while (stat) {
45624569
/* Find the record. */
45634570
error = xfs_btree_get_rec(cur, &recp, &stat);

0 commit comments

Comments
 (0)