diff options
author | Darrick J. Wong <darrick.wong@oracle.com> | 2016-08-26 02:00:10 -0400 |
---|---|---|
committer | Dave Chinner <david@fromorbit.com> | 2016-08-26 02:00:10 -0400 |
commit | 5b5c2dbd3c9bcfa89fba9709c12ecc0a445c6e40 (patch) | |
tree | 25a2ac8152c5aba5ffcdeb774c7baee21c2107fd | |
parent | 722278997bc964349e23e7061d541f8df3133a04 (diff) |
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 <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
-rw-r--r-- | fs/xfs/libxfs/xfs_btree.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/xfs/libxfs/xfs_btree.c b/fs/xfs/libxfs/xfs_btree.c index b70d9f918156..08569792fe20 100644 --- a/fs/xfs/libxfs/xfs_btree.c +++ b/fs/xfs/libxfs/xfs_btree.c | |||
@@ -4558,6 +4558,13 @@ xfs_btree_simple_query_range( | |||
4558 | if (error) | 4558 | if (error) |
4559 | goto out; | 4559 | goto out; |
4560 | 4560 | ||
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 | |||
4561 | while (stat) { | 4568 | while (stat) { |
4562 | /* Find the record. */ | 4569 | /* Find the record. */ |
4563 | error = xfs_btree_get_rec(cur, &recp, &stat); | 4570 | error = xfs_btree_get_rec(cur, &recp, &stat); |