[PATCH 0/6] xfs: cleanup key comparing routines

Fedor Pchelkin posted 6 patches 4 months ago
There is a newer version of this series
fs/xfs/libxfs/xfs_alloc_btree.c      | 52 +++++++++------------
fs/xfs/libxfs/xfs_bmap_btree.c       | 32 +++++--------
fs/xfs/libxfs/xfs_btree.c            | 31 ++++++-------
fs/xfs/libxfs/xfs_btree.h            | 41 +++++++++--------
fs/xfs/libxfs/xfs_ialloc_btree.c     | 24 +++++-----
fs/xfs/libxfs/xfs_refcount_btree.c   | 18 ++++----
fs/xfs/libxfs/xfs_rmap_btree.c       | 67 ++++++++++------------------
fs/xfs/libxfs/xfs_rtrefcount_btree.c | 18 ++++----
fs/xfs/libxfs/xfs_rtrmap_btree.c     | 67 ++++++++++------------------
fs/xfs/scrub/rcbag_btree.c           | 38 +++++-----------
10 files changed, 156 insertions(+), 232 deletions(-)
[PATCH 0/6] xfs: cleanup key comparing routines
Posted by Fedor Pchelkin 4 months ago
Key comparing routines are currently opencoded with extra casts and
subtractions which is error prone and can be replaced with a neat
cmp_int() helper which is now in a generic header file.

Started from:
https://lore.kernel.org/linux-xfs/20250426134232.128864-1-pchelkin@ispras.ru/T/#u

Thanks Darrick for suggestion!

Fedor Pchelkin (6):
  xfs: rename diff_two_keys routines
  xfs: rename key_diff routines
  xfs: refactor cmp_two_keys routines to take advantage of cmp_int()
  xfs: refactor cmp_key_with_cur routines to take advantage of cmp_int()
  xfs: use a proper variable name and type for storing a comparison
    result
  xfs: refactor xfs_btree_diff_two_ptrs() to take advantage of cmp_int()

 fs/xfs/libxfs/xfs_alloc_btree.c      | 52 +++++++++------------
 fs/xfs/libxfs/xfs_bmap_btree.c       | 32 +++++--------
 fs/xfs/libxfs/xfs_btree.c            | 31 ++++++-------
 fs/xfs/libxfs/xfs_btree.h            | 41 +++++++++--------
 fs/xfs/libxfs/xfs_ialloc_btree.c     | 24 +++++-----
 fs/xfs/libxfs/xfs_refcount_btree.c   | 18 ++++----
 fs/xfs/libxfs/xfs_rmap_btree.c       | 67 ++++++++++------------------
 fs/xfs/libxfs/xfs_rtrefcount_btree.c | 18 ++++----
 fs/xfs/libxfs/xfs_rtrmap_btree.c     | 67 ++++++++++------------------
 fs/xfs/scrub/rcbag_btree.c           | 38 +++++-----------
 10 files changed, 156 insertions(+), 232 deletions(-)

-- 
2.49.0
Re: [PATCH 0/6] xfs: cleanup key comparing routines
Posted by Darrick J. Wong 3 months, 1 week ago
On Thu, Jun 12, 2025 at 01:24:44PM +0300, Fedor Pchelkin wrote:
> Key comparing routines are currently opencoded with extra casts and
> subtractions which is error prone and can be replaced with a neat
> cmp_int() helper which is now in a generic header file.
> 
> Started from:
> https://lore.kernel.org/linux-xfs/20250426134232.128864-1-pchelkin@ispras.ru/T/#u
> 
> Thanks Darrick for suggestion!

For patches 1-5,
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>

--D

> 
> Fedor Pchelkin (6):
>   xfs: rename diff_two_keys routines
>   xfs: rename key_diff routines
>   xfs: refactor cmp_two_keys routines to take advantage of cmp_int()
>   xfs: refactor cmp_key_with_cur routines to take advantage of cmp_int()
>   xfs: use a proper variable name and type for storing a comparison
>     result
>   xfs: refactor xfs_btree_diff_two_ptrs() to take advantage of cmp_int()
> 
>  fs/xfs/libxfs/xfs_alloc_btree.c      | 52 +++++++++------------
>  fs/xfs/libxfs/xfs_bmap_btree.c       | 32 +++++--------
>  fs/xfs/libxfs/xfs_btree.c            | 31 ++++++-------
>  fs/xfs/libxfs/xfs_btree.h            | 41 +++++++++--------
>  fs/xfs/libxfs/xfs_ialloc_btree.c     | 24 +++++-----
>  fs/xfs/libxfs/xfs_refcount_btree.c   | 18 ++++----
>  fs/xfs/libxfs/xfs_rmap_btree.c       | 67 ++++++++++------------------
>  fs/xfs/libxfs/xfs_rtrefcount_btree.c | 18 ++++----
>  fs/xfs/libxfs/xfs_rtrmap_btree.c     | 67 ++++++++++------------------
>  fs/xfs/scrub/rcbag_btree.c           | 38 +++++-----------
>  10 files changed, 156 insertions(+), 232 deletions(-)
> 
> -- 
> 2.49.0
> 
>