xfs: fix some key handling problems in _btree_simple_query_range

We only need the record's high key for the first record that we look
at; for all records, we /definitely/ need the regular record key.
Therefore, fix how the simple range query function gets its keys.

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>
This commit is contained in:
Darrick J. Wong 2016-08-26 15:59:50 +10:00 committed by Dave Chinner
parent da1f039d69
commit 722278997b

View File

@ -4563,10 +4563,10 @@ xfs_btree_simple_query_range(
error = xfs_btree_get_rec(cur, &recp, &stat);
if (error || !stat)
break;
cur->bc_ops->init_high_key_from_rec(&rec_key, recp);
/* Skip if high_key(rec) < low_key. */
if (firstrec) {
cur->bc_ops->init_high_key_from_rec(&rec_key, recp);
firstrec = false;
diff = cur->bc_ops->diff_two_keys(cur, low_key,
&rec_key);
@ -4575,6 +4575,7 @@ xfs_btree_simple_query_range(
}
/* Stop if high_key < low_key(rec). */
cur->bc_ops->init_key_from_rec(&rec_key, recp);
diff = cur->bc_ops->diff_two_keys(cur, &rec_key, high_key);
if (diff > 0)
break;