]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: rename key_diff routines
authorFedor Pchelkin <pchelkin@ispras.ru>
Mon, 6 Oct 2025 12:40:16 +0000 (14:40 +0200)
committerAndrey Albershteyn <aalbersh@kernel.org>
Mon, 13 Oct 2025 09:53:39 +0000 (11:53 +0200)
Source kernel commit: 82b63ee160016096436aa026a27c8d85d40f3fb1

key_diff routines compare a key value with a cursor value. Make the naming
to be a bit more self-descriptive.

Found by Linux Verification Center (linuxtesting.org).

Signed-off-by: Fedor Pchelkin <pchelkin@ispras.ru>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
libxfs/xfs_alloc_btree.c
libxfs/xfs_bmap_btree.c
libxfs/xfs_btree.c
libxfs/xfs_btree.h
libxfs/xfs_ialloc_btree.c
libxfs/xfs_refcount_btree.c
libxfs/xfs_rmap_btree.c
libxfs/xfs_rtrefcount_btree.c
libxfs/xfs_rtrmap_btree.c
repair/rcbag_btree.c

index 85ce9f728f8d7c5388d391562abc49b05cbaa26d..6e7af0020bfea2d0335bf9257e8d8e97aa7ec08b 100644 (file)
@@ -185,7 +185,7 @@ xfs_allocbt_init_ptr_from_cur(
 }
 
 STATIC int64_t
-xfs_bnobt_key_diff(
+xfs_bnobt_cmp_key_with_cur(
        struct xfs_btree_cur            *cur,
        const union xfs_btree_key       *key)
 {
@@ -196,7 +196,7 @@ xfs_bnobt_key_diff(
 }
 
 STATIC int64_t
-xfs_cntbt_key_diff(
+xfs_cntbt_cmp_key_with_cur(
        struct xfs_btree_cur            *cur,
        const union xfs_btree_key       *key)
 {
@@ -436,7 +436,7 @@ const struct xfs_btree_ops xfs_bnobt_ops = {
        .init_high_key_from_rec = xfs_bnobt_init_high_key_from_rec,
        .init_rec_from_cur      = xfs_allocbt_init_rec_from_cur,
        .init_ptr_from_cur      = xfs_allocbt_init_ptr_from_cur,
-       .key_diff               = xfs_bnobt_key_diff,
+       .cmp_key_with_cur       = xfs_bnobt_cmp_key_with_cur,
        .buf_ops                = &xfs_bnobt_buf_ops,
        .cmp_two_keys           = xfs_bnobt_cmp_two_keys,
        .keys_inorder           = xfs_bnobt_keys_inorder,
@@ -466,7 +466,7 @@ const struct xfs_btree_ops xfs_cntbt_ops = {
        .init_high_key_from_rec = xfs_cntbt_init_high_key_from_rec,
        .init_rec_from_cur      = xfs_allocbt_init_rec_from_cur,
        .init_ptr_from_cur      = xfs_allocbt_init_ptr_from_cur,
-       .key_diff               = xfs_cntbt_key_diff,
+       .cmp_key_with_cur       = xfs_cntbt_cmp_key_with_cur,
        .buf_ops                = &xfs_cntbt_buf_ops,
        .cmp_two_keys           = xfs_cntbt_cmp_two_keys,
        .keys_inorder           = xfs_cntbt_keys_inorder,
index eb3e5d70de6a1225e14db025b6ec37febfeabeb4..3fc23444f3f2491547c193610db013442ea76163 100644 (file)
@@ -369,7 +369,7 @@ xfs_bmbt_init_rec_from_cur(
 }
 
 STATIC int64_t
-xfs_bmbt_key_diff(
+xfs_bmbt_cmp_key_with_cur(
        struct xfs_btree_cur            *cur,
        const union xfs_btree_key       *key)
 {
@@ -646,7 +646,7 @@ const struct xfs_btree_ops xfs_bmbt_ops = {
        .init_key_from_rec      = xfs_bmbt_init_key_from_rec,
        .init_high_key_from_rec = xfs_bmbt_init_high_key_from_rec,
        .init_rec_from_cur      = xfs_bmbt_init_rec_from_cur,
-       .key_diff               = xfs_bmbt_key_diff,
+       .cmp_key_with_cur       = xfs_bmbt_cmp_key_with_cur,
        .cmp_two_keys           = xfs_bmbt_cmp_two_keys,
        .buf_ops                = &xfs_bmbt_buf_ops,
        .keys_inorder           = xfs_bmbt_keys_inorder,
index 78cc31f61e1523a17bee5bdcfb81b425125e857f..15846f0ff694dbf8b7408a16d88b803935b9dc28 100644 (file)
@@ -2067,7 +2067,7 @@ xfs_btree_lookup(
                                 *  - greater than, move left
                                 *  - equal, we're done
                                 */
-                               diff = cur->bc_ops->key_diff(cur, kp);
+                               diff = cur->bc_ops->cmp_key_with_cur(cur, kp);
                                if (diff < 0)
                                        low = keyno + 1;
                                else if (diff > 0)
index 1046bbf3839aa6e6d605af4621fb31cc71ba35c2..e72a10ba7ee6da169507fd95e411fea13021687b 100644 (file)
@@ -171,9 +171,12 @@ struct xfs_btree_ops {
        void    (*init_high_key_from_rec)(union xfs_btree_key *key,
                                          const union xfs_btree_rec *rec);
 
-       /* difference between key value and cursor value */
-       int64_t (*key_diff)(struct xfs_btree_cur *cur,
-                           const union xfs_btree_key *key);
+       /*
+        * Compare key value and cursor value -- positive if key > cur,
+        * negative if key < cur, and zero if equal.
+        */
+       int64_t (*cmp_key_with_cur)(struct xfs_btree_cur *cur,
+                                   const union xfs_btree_key *key);
 
        /*
         * Compare key1 and key2 -- positive if key1 > key2, negative if
index d5f55f7466dbf850165b53b22a01f581cc527cd7..d56876c5be0e45d628ef654820181d7f44549994 100644 (file)
@@ -265,7 +265,7 @@ xfs_finobt_init_ptr_from_cur(
 }
 
 STATIC int64_t
-xfs_inobt_key_diff(
+xfs_inobt_cmp_key_with_cur(
        struct xfs_btree_cur            *cur,
        const union xfs_btree_key       *key)
 {
@@ -429,7 +429,7 @@ const struct xfs_btree_ops xfs_inobt_ops = {
        .init_high_key_from_rec = xfs_inobt_init_high_key_from_rec,
        .init_rec_from_cur      = xfs_inobt_init_rec_from_cur,
        .init_ptr_from_cur      = xfs_inobt_init_ptr_from_cur,
-       .key_diff               = xfs_inobt_key_diff,
+       .cmp_key_with_cur       = xfs_inobt_cmp_key_with_cur,
        .buf_ops                = &xfs_inobt_buf_ops,
        .cmp_two_keys           = xfs_inobt_cmp_two_keys,
        .keys_inorder           = xfs_inobt_keys_inorder,
@@ -459,7 +459,7 @@ const struct xfs_btree_ops xfs_finobt_ops = {
        .init_high_key_from_rec = xfs_inobt_init_high_key_from_rec,
        .init_rec_from_cur      = xfs_inobt_init_rec_from_cur,
        .init_ptr_from_cur      = xfs_finobt_init_ptr_from_cur,
-       .key_diff               = xfs_inobt_key_diff,
+       .cmp_key_with_cur       = xfs_inobt_cmp_key_with_cur,
        .buf_ops                = &xfs_finobt_buf_ops,
        .cmp_two_keys           = xfs_inobt_cmp_two_keys,
        .keys_inorder           = xfs_inobt_keys_inorder,
index 63417b873cdfbc376b99cd096be199002c89f938..0924ab7eb7dd39e5e4d4b3dd7114ea456d1a19d9 100644 (file)
@@ -174,7 +174,7 @@ xfs_refcountbt_init_ptr_from_cur(
 }
 
 STATIC int64_t
-xfs_refcountbt_key_diff(
+xfs_refcountbt_cmp_key_with_cur(
        struct xfs_btree_cur            *cur,
        const union xfs_btree_key       *key)
 {
@@ -338,7 +338,7 @@ const struct xfs_btree_ops xfs_refcountbt_ops = {
        .init_high_key_from_rec = xfs_refcountbt_init_high_key_from_rec,
        .init_rec_from_cur      = xfs_refcountbt_init_rec_from_cur,
        .init_ptr_from_cur      = xfs_refcountbt_init_ptr_from_cur,
-       .key_diff               = xfs_refcountbt_key_diff,
+       .cmp_key_with_cur       = xfs_refcountbt_cmp_key_with_cur,
        .buf_ops                = &xfs_refcountbt_buf_ops,
        .cmp_two_keys           = xfs_refcountbt_cmp_two_keys,
        .keys_inorder           = xfs_refcountbt_keys_inorder,
index 0481850e46c81ef21888707664ac272b048f1e78..ea946616bfb5553ce5f47a3ce78196cc0e1a1ae1 100644 (file)
@@ -243,7 +243,7 @@ static inline uint64_t offset_keymask(uint64_t offset)
 }
 
 STATIC int64_t
-xfs_rmapbt_key_diff(
+xfs_rmapbt_cmp_key_with_cur(
        struct xfs_btree_cur            *cur,
        const union xfs_btree_key       *key)
 {
@@ -514,7 +514,7 @@ const struct xfs_btree_ops xfs_rmapbt_ops = {
        .init_high_key_from_rec = xfs_rmapbt_init_high_key_from_rec,
        .init_rec_from_cur      = xfs_rmapbt_init_rec_from_cur,
        .init_ptr_from_cur      = xfs_rmapbt_init_ptr_from_cur,
-       .key_diff               = xfs_rmapbt_key_diff,
+       .cmp_key_with_cur       = xfs_rmapbt_cmp_key_with_cur,
        .buf_ops                = &xfs_rmapbt_buf_ops,
        .cmp_two_keys           = xfs_rmapbt_cmp_two_keys,
        .keys_inorder           = xfs_rmapbt_keys_inorder,
@@ -631,7 +631,7 @@ const struct xfs_btree_ops xfs_rmapbt_mem_ops = {
        .init_high_key_from_rec = xfs_rmapbt_init_high_key_from_rec,
        .init_rec_from_cur      = xfs_rmapbt_init_rec_from_cur,
        .init_ptr_from_cur      = xfbtree_init_ptr_from_cur,
-       .key_diff               = xfs_rmapbt_key_diff,
+       .cmp_key_with_cur       = xfs_rmapbt_cmp_key_with_cur,
        .buf_ops                = &xfs_rmapbt_mem_buf_ops,
        .cmp_two_keys           = xfs_rmapbt_cmp_two_keys,
        .keys_inorder           = xfs_rmapbt_keys_inorder,
index 1f563a724c2245b14e896cd10856452b8f5d07a9..7a4eec49ca869348d79ee53db046c0b5cab2ca0f 100644 (file)
@@ -155,7 +155,7 @@ xfs_rtrefcountbt_init_ptr_from_cur(
 }
 
 STATIC int64_t
-xfs_rtrefcountbt_key_diff(
+xfs_rtrefcountbt_cmp_key_with_cur(
        struct xfs_btree_cur            *cur,
        const union xfs_btree_key       *key)
 {
@@ -385,7 +385,7 @@ const struct xfs_btree_ops xfs_rtrefcountbt_ops = {
        .init_high_key_from_rec = xfs_rtrefcountbt_init_high_key_from_rec,
        .init_rec_from_cur      = xfs_rtrefcountbt_init_rec_from_cur,
        .init_ptr_from_cur      = xfs_rtrefcountbt_init_ptr_from_cur,
-       .key_diff               = xfs_rtrefcountbt_key_diff,
+       .cmp_key_with_cur       = xfs_rtrefcountbt_cmp_key_with_cur,
        .buf_ops                = &xfs_rtrefcountbt_buf_ops,
        .cmp_two_keys           = xfs_rtrefcountbt_cmp_two_keys,
        .keys_inorder           = xfs_rtrefcountbt_keys_inorder,
index 5b3836fccc252eb318005a7d90ab8fa29e7a214b..59a99bb42c2c9b8894d7f366751542dc30ac9017 100644 (file)
@@ -185,7 +185,7 @@ static inline uint64_t offset_keymask(uint64_t offset)
 }
 
 STATIC int64_t
-xfs_rtrmapbt_key_diff(
+xfs_rtrmapbt_cmp_key_with_cur(
        struct xfs_btree_cur            *cur,
        const union xfs_btree_key       *key)
 {
@@ -510,7 +510,7 @@ const struct xfs_btree_ops xfs_rtrmapbt_ops = {
        .init_high_key_from_rec = xfs_rtrmapbt_init_high_key_from_rec,
        .init_rec_from_cur      = xfs_rtrmapbt_init_rec_from_cur,
        .init_ptr_from_cur      = xfs_rtrmapbt_init_ptr_from_cur,
-       .key_diff               = xfs_rtrmapbt_key_diff,
+       .cmp_key_with_cur       = xfs_rtrmapbt_cmp_key_with_cur,
        .buf_ops                = &xfs_rtrmapbt_buf_ops,
        .cmp_two_keys           = xfs_rtrmapbt_cmp_two_keys,
        .keys_inorder           = xfs_rtrmapbt_keys_inorder,
@@ -619,7 +619,7 @@ const struct xfs_btree_ops xfs_rtrmapbt_mem_ops = {
        .init_high_key_from_rec = xfs_rtrmapbt_init_high_key_from_rec,
        .init_rec_from_cur      = xfs_rtrmapbt_init_rec_from_cur,
        .init_ptr_from_cur      = xfbtree_init_ptr_from_cur,
-       .key_diff               = xfs_rtrmapbt_key_diff,
+       .cmp_key_with_cur       = xfs_rtrmapbt_cmp_key_with_cur,
        .buf_ops                = &xfs_rtrmapbt_mem_buf_ops,
        .cmp_two_keys           = xfs_rtrmapbt_cmp_two_keys,
        .keys_inorder           = xfs_rtrmapbt_keys_inorder,
index 404b509f64d7874fc7c566a395afa394ff960829..704e66e9fbcd93fd7142757c50f16f0200871687 100644 (file)
@@ -47,7 +47,7 @@ rcbagbt_init_rec_from_cur(
 }
 
 STATIC int64_t
-rcbagbt_key_diff(
+rcbagbt_cmp_key_with_cur(
        struct xfs_btree_cur            *cur,
        const union xfs_btree_key       *key)
 {
@@ -220,7 +220,7 @@ static const struct xfs_btree_ops rcbagbt_mem_ops = {
        .init_key_from_rec      = rcbagbt_init_key_from_rec,
        .init_rec_from_cur      = rcbagbt_init_rec_from_cur,
        .init_ptr_from_cur      = xfbtree_init_ptr_from_cur,
-       .key_diff               = rcbagbt_key_diff,
+       .cmp_key_with_cur       = rcbagbt_cmp_key_with_cur,
        .buf_ops                = &rcbagbt_mem_buf_ops,
        .cmp_two_keys           = rcbagbt_cmp_two_keys,
        .keys_inorder           = rcbagbt_keys_inorder,