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

Fedor Pchelkin posted 6 patches 3 months, 1 week ago
fs/xfs/libxfs/xfs_alloc_btree.c      | 52 +++++++++------------
fs/xfs/libxfs/xfs_bmap_btree.c       | 32 +++++--------
fs/xfs/libxfs/xfs_btree.c            | 33 +++++++-------
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/btree.c                 |  2 +-
fs/xfs/scrub/rcbag_btree.c           | 38 +++++-----------
11 files changed, 158 insertions(+), 234 deletions(-)
[PATCH v2 0/6] xfs: cleanup key comparing routines
Posted by Fedor Pchelkin 3 months, 1 week 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!

v1: https://lore.kernel.org/linux-xfs/20250612102455.63024-1-pchelkin@ispras.ru/T/#u
v2: tune 6/6 patch to rename the "diff_two_ptrs" part

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            | 33 +++++++-------
 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/btree.c                 |  2 +-
 fs/xfs/scrub/rcbag_btree.c           | 38 +++++-----------
 11 files changed, 158 insertions(+), 234 deletions(-)

-- 
2.50.0
Re: [PATCH v2 0/6] xfs: cleanup key comparing routines
Posted by Carlos Maiolino 3 months ago
On Wed, 02 Jul 2025 12:39:27 +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
> 
> [...]

Applied to for-next, thanks!

[1/6] xfs: rename diff_two_keys routines
      commit: c4c6aee6ba87fdfbaeed1966f81298e3f3913f3c
[2/6] xfs: rename key_diff routines
      commit: fb7eff8c9f1b7ac46b8e376f9da19d8996cd0262
[3/6] xfs: refactor cmp_two_keys routines to take advantage of cmp_int()
      commit: ff48e83c9dcd8c4f6b92b7d695ebe599c0a0e57d
[4/6] xfs: refactor cmp_key_with_cur routines to take advantage of cmp_int()
      commit: 786b3b2e16600a642ddf15bcaf94694cfc6b3250
[5/6] xfs: use a proper variable name and type for storing a comparison result
      commit: a0b2b28e1cc1c3c95bd889eec455bf8e68def61d
[6/6] xfs: refactor xfs_btree_diff_two_ptrs() to take advantage of cmp_int()
      commit: 10e4f0aebdadc94930e82ac13ef1e01abb0bda03

Best regards,
-- 
Carlos Maiolino <cem@kernel.org>