]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
xfs: rename key_diff routines
authorFedor Pchelkin <pchelkin@ispras.ru>
Wed, 2 Jul 2025 09:39:29 +0000 (12:39 +0300)
committerCarlos Maiolino <cem@kernel.org>
Thu, 24 Jul 2025 15:30:13 +0000 (17:30 +0200)
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>
fs/xfs/libxfs/xfs_alloc_btree.c
fs/xfs/libxfs/xfs_bmap_btree.c
fs/xfs/libxfs/xfs_btree.c
fs/xfs/libxfs/xfs_btree.h
fs/xfs/libxfs/xfs_ialloc_btree.c
fs/xfs/libxfs/xfs_refcount_btree.c
fs/xfs/libxfs/xfs_rmap_btree.c
fs/xfs/libxfs/xfs_rtrefcount_btree.c
fs/xfs/libxfs/xfs_rtrmap_btree.c
fs/xfs/scrub/rcbag_btree.c

index 42e4b8105e47a539d7a0300b93d28b77d5a8d517..d01807e0c4d4fdcabefda6c188ef13ddbfc4b3bc 100644 (file)
@@ -187,7 +187,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)
 {
@@ -198,7 +198,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)
 {
@@ -438,7 +438,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,
@@ -468,7 +468,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 1cee9c2a3dc806606077bbe1eb381da069123b06..0c5dba21d94a1f2fb882236ea5a12c25b586a055 100644 (file)
@@ -370,7 +370,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)
 {
@@ -647,7 +647,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 c8164c1948412bf867b870b63cddb918d2ab267d..99a63a178f251f0224690c74bb0c9c4d760baa6f 100644 (file)
@@ -2070,7 +2070,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 307734dbb5c7e1a23a0aa6648319718e74ec4a49..0d0c6534259acd2d9e6c745d57530d183e4a2f91 100644 (file)
@@ -266,7 +266,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)
 {
@@ -430,7 +430,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,
@@ -460,7 +460,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 83f7758dc6dc39d77cb2d4a895446da4d5e43f8e..885fc3a0a304e1cff0942fedce2b221907e2041e 100644 (file)
@@ -175,7 +175,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)
 {
@@ -339,7 +339,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 77f586844730a0e3477e001977157b23daf5c446..74288d311b6807f673bc454afe4fd13aa99055ec 100644 (file)
@@ -244,7 +244,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)
 {
@@ -515,7 +515,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,
@@ -632,7 +632,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 3ef29477877e477f08fafc5d488e9e3d77859ed3..864c3aa664d76e2b13c995fa91d6ba0be0e13467 100644 (file)
@@ -157,7 +157,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)
 {
@@ -387,7 +387,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 6325502005c40bd734bcb6049f0ac55e89eaefc2..b48336086ca7e8d6b9d39a3e84979077f29a6905 100644 (file)
@@ -186,7 +186,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)
 {
@@ -511,7 +511,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,
@@ -620,7 +620,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 c3c7025ca3368e8b84cea71e746f526a007cf6de..523ffd0da77a39f1f0289fdd231b5f0c2e4f6756 100644 (file)
@@ -48,7 +48,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)
 {
@@ -201,7 +201,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,