]> git.karo-electronics.de Git - linux-beck.git/commitdiff
xfs: fix some key handling problems in _btree_simple_query_range
authorDarrick J. Wong <darrick.wong@oracle.com>
Fri, 26 Aug 2016 05:59:50 +0000 (15:59 +1000)
committerDave Chinner <david@fromorbit.com>
Fri, 26 Aug 2016 05:59:50 +0000 (15:59 +1000)
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>
fs/xfs/libxfs/xfs_btree.c

index 33f14067c3202b461c44ae523eeaa991990ace20..b70d9f9181561bce23f1b774640eb832cf7ccdf1 100644 (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;