diff mbox series

ceph: move ceph_frag_compare() into include/linux/ceph/ceph_frag.h

Message ID 20250117222958.43129-1-slava@dubeyko.com (mailing list archive)
State New
Headers show
Series ceph: move ceph_frag_compare() into include/linux/ceph/ceph_frag.h | expand

Commit Message

Viacheslav Dubeyko Jan. 17, 2025, 10:29 p.m. UTC
From: Viacheslav Dubeyko <Slava.Dubeyko@ibm.com>

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 into
include/linux/ceph/ceph_frag.h and deletes file
fs/ceph/ceph_frag.c with the goal to keep all
ceph frag related family of methods in one place.

Signed-off-by: Viacheslav Dubeyko <Slava.Dubeyko@ibm.com>
---
 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
diff mbox series

Patch

diff --git a/fs/ceph/Makefile b/fs/ceph/Makefile
index 1f77ca04c426..4333af217557 100644
--- a/fs/ceph/Makefile
+++ b/fs/ceph/Makefile
@@ -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
diff --git a/fs/ceph/ceph_frag.c b/fs/ceph/ceph_frag.c
deleted file mode 100644
index 6f67d5b884a0..000000000000
--- a/fs/ceph/ceph_frag.c
+++ /dev/null
@@ -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;
-}
diff --git a/include/linux/ceph/ceph_frag.h b/include/linux/ceph/ceph_frag.h
index 97bab0adc58a..cb2b7610bf95 100644
--- a/include/linux/ceph/ceph_frag.h
+++ b/include/linux/ceph/ceph_frag.h
@@ -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