aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/libxfs/xfs_btree.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2016-09-15 02:24:53 -0400
committerIngo Molnar <mingo@kernel.org>2016-09-15 02:24:53 -0400
commitd4b80afbba49e968623330f1336da8c724da8aad (patch)
treea9478bd77d8b001a6a7119328d34e9666d7bfe93 /fs/xfs/libxfs/xfs_btree.c
parentfcd709ef20a9d83bdb7524d27cd6719dac8690a0 (diff)
parent4cea8776571b18db7485930cb422faa739580c8c (diff)
Merge branch 'linus' into x86/asm, to pick up recent fixes
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'fs/xfs/libxfs/xfs_btree.c')
-rw-r--r--fs/xfs/libxfs/xfs_btree.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/fs/xfs/libxfs/xfs_btree.c b/fs/xfs/libxfs/xfs_btree.c
index b5c213a051cd..08569792fe20 100644
--- a/fs/xfs/libxfs/xfs_btree.c
+++ b/fs/xfs/libxfs/xfs_btree.c
@@ -1814,6 +1814,10 @@ xfs_btree_lookup(
1814 1814
1815 XFS_BTREE_STATS_INC(cur, lookup); 1815 XFS_BTREE_STATS_INC(cur, lookup);
1816 1816
1817 /* No such thing as a zero-level tree. */
1818 if (cur->bc_nlevels == 0)
1819 return -EFSCORRUPTED;
1820
1817 block = NULL; 1821 block = NULL;
1818 keyno = 0; 1822 keyno = 0;
1819 1823
@@ -4554,15 +4558,22 @@ xfs_btree_simple_query_range(
4554 if (error) 4558 if (error)
4555 goto out; 4559 goto out;
4556 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
4557 while (stat) { 4568 while (stat) {
4558 /* Find the record. */ 4569 /* Find the record. */
4559 error = xfs_btree_get_rec(cur, &recp, &stat); 4570 error = xfs_btree_get_rec(cur, &recp, &stat);
4560 if (error || !stat) 4571 if (error || !stat)
4561 break; 4572 break;
4562 cur->bc_ops->init_high_key_from_rec(&rec_key, recp);
4563 4573
4564 /* Skip if high_key(rec) < low_key. */ 4574 /* Skip if high_key(rec) < low_key. */
4565 if (firstrec) { 4575 if (firstrec) {
4576 cur->bc_ops->init_high_key_from_rec(&rec_key, recp);
4566 firstrec = false; 4577 firstrec = false;
4567 diff = cur->bc_ops->diff_two_keys(cur, low_key, 4578 diff = cur->bc_ops->diff_two_keys(cur, low_key,
4568 &rec_key); 4579 &rec_key);
@@ -4571,6 +4582,7 @@ xfs_btree_simple_query_range(
4571 } 4582 }
4572 4583
4573 /* Stop if high_key < low_key(rec). */ 4584 /* Stop if high_key < low_key(rec). */
4585 cur->bc_ops->init_key_from_rec(&rec_key, recp);
4574 diff = cur->bc_ops->diff_two_keys(cur, &rec_key, high_key); 4586 diff = cur->bc_ops->diff_two_keys(cur, &rec_key, high_key);
4575 if (diff > 0) 4587 if (diff > 0)
4576 break; 4588 break;