ceph: move ceph_frag_compare() into include/linux/ceph/ceph_frag.h
Subsystems (3)
Viacheslav Dubeyko
maintainerPATCH 1/1 ceph: move ceph_frag_compare() into include/linux/ceph/ceph_frag.h
From: Viacheslav Dubeyko <[email protected]>
The fs/ceph/ceph_frag.c contains only tiny ceph_frag_compare() method. However, ceph frag related family of methods located in include/linux/ceph/ceph_frag.h.
This patch moves ceph_frag_compare() method intoinclude/linux/ceph/ceph_frag.h and deletes filefs/ceph/ceph_frag.c with the goal to keep all
ceph frag related family of methods in one place.
Signed-off-by Viacheslav Dubeyko <[email protected]>
--- fs/ceph/Makefile | 2 +- fs/ceph/ceph_frag.c | 23 ----------------------- include/linux/ceph/ceph_frag.h | 17 ++++++++++++++++- 3 files changed, 17 insertions(+), 25 deletions(-) delete mode 100644 fs/ceph/ceph_frag.c
fs/ceph/Makefile +1 -1
@@ -7,7 +7,7 @@ obj-$(CONFIG_CEPH_FS) += ceph.o ceph-y := super.o inode.o dir.o file.o locks.o addr.o ioctl.o \ export.o caps.o snap.o xattr.o quota.o io.o \ - mds_client.o mdsmap.o strings.o ceph_frag.o \ + mds_client.o mdsmap.o strings.o \ debugfs.o util.o metric.o ceph-$(CONFIG_CEPH_FSCACHE) += cache.o
fs/ceph/ceph_frag.c deleted +0 -23
@@ -1,23 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* -* Ceph 'frag' type -*/ -#include <linux/module.h> -#include <linux/ceph/types.h> - -int ceph_frag_compare (__u32 a,__u32 b) -{ -unsigned va =ceph_frag_value (a); -unsigned vb =ceph_frag_value (b); -if (va < vb) -return -1 ; -if (va > vb) -return 1 ; - va =ceph_frag_bits (a); - vb =ceph_frag_bits (b); -if (va < vb) -return -1 ; -if (va > vb) -return 1 ; -return 0 ; -}
include/linux/ceph/ceph_frag.h +16 -1
@@ -70,6 +70,21 @@ static inline __u32 ceph_frag_next(__u32 f)* comparator to sort frags logically, as when traversing the * number space in ascending order... */ -int ceph_frag_compare (__u32 a,__u32 b); +static inline int ceph_frag_compare (__u32 a,__u32 b) +{ +unsigned va =ceph_frag_value (a); +unsigned vb =ceph_frag_value (b); +if (va < vb) +return -1 ; +if (va > vb) +return 1 ; + va =ceph_frag_bits (a); + vb =ceph_frag_bits (b); +if (va < vb) +return -1 ; +if (va > vb) +return 1 ; +return 0 ; +}#endif
Signature · 1 line
2.48.0