]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
xfs: move XFS_LSN_CMP to xfs_log_format.h
authorChristoph Hellwig <hch@lst.de>
Mon, 8 Jun 2026 05:04:51 +0000 (07:04 +0200)
committerCarlos Maiolino <cem@kernel.org>
Fri, 12 Jun 2026 07:54:20 +0000 (09:54 +0200)
Because CYCLE_LSN/BLOCK_LSN are defined in xfs_log_format.h, XFS_LSN_CMP
forces a xfs_log_format.h dependency in xfs_log.h.  Move XFS_LSN_CMP
to xfs_log_format.h and drop the macro/inline indirection to clean up
our header mess a little bit.

This also helps xfsprogs, which doesn't have xfs_log.h, but needs
XFS_LSN_CMP.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
fs/xfs/libxfs/xfs_log_format.h
fs/xfs/libxfs/xfs_parent.c
fs/xfs/xfs_log.h

index 3f5a24dda9070147502fc6206571c6377fcdf22c..a4e1b3eb425cda77866d805a9d5829aafa69dbeb 100644 (file)
@@ -52,6 +52,19 @@ typedef uint32_t xlog_tid_t;
 #define CYCLE_LSN(lsn) ((uint)((lsn)>>32))
 #define BLOCK_LSN(lsn) ((uint)(lsn))
 
+/*
+ * By comparing each component, we don't have to worry about extra endian issues
+ * in treating two 32 bit numbers as one 64 bit number
+ */
+static inline xfs_lsn_t XFS_LSN_CMP(xfs_lsn_t lsn1, xfs_lsn_t lsn2)
+{
+       if (CYCLE_LSN(lsn1) != CYCLE_LSN(lsn2))
+               return CYCLE_LSN(lsn1) < CYCLE_LSN(lsn2) ? -999 : 999;
+       if (BLOCK_LSN(lsn1) != BLOCK_LSN(lsn2))
+               return BLOCK_LSN(lsn1) < BLOCK_LSN(lsn2) ? -999 : 999;
+       return 0;
+}
+
 /* this is used in a spot where we might otherwise double-endian-flip */
 #define CYCLE_LSN_DISK(lsn) (((__be32 *)&(lsn))[0])
 
index 5c7df544b9fccb5c79d3f666b9fbfc5ac3a03e55..8d111c9b6527ee989687e863d292e57847d1e104 100644 (file)
@@ -23,7 +23,6 @@
 #include "xfs_attr_sf.h"
 #include "xfs_bmap.h"
 #include "xfs_defer.h"
-#include "xfs_log.h"
 #include "xfs_xattr.h"
 #include "xfs_parent.h"
 #include "xfs_trans_space.h"
index 0f23812b0b318dd1b0522fba7fbaa2325b20e2a8..ca66429bf6c91a3d4adb8c3d5f80d85c44545aea 100644 (file)
@@ -80,23 +80,6 @@ xlog_format_copy(
        return buf;
 }
 
-/*
- * By comparing each component, we don't have to worry about extra
- * endian issues in treating two 32 bit numbers as one 64 bit number
- */
-static inline xfs_lsn_t        _lsn_cmp(xfs_lsn_t lsn1, xfs_lsn_t lsn2)
-{
-       if (CYCLE_LSN(lsn1) != CYCLE_LSN(lsn2))
-               return (CYCLE_LSN(lsn1)<CYCLE_LSN(lsn2))? -999 : 999;
-
-       if (BLOCK_LSN(lsn1) != BLOCK_LSN(lsn2))
-               return (BLOCK_LSN(lsn1)<BLOCK_LSN(lsn2))? -999 : 999;
-
-       return 0;
-}
-
-#define        XFS_LSN_CMP(x,y) _lsn_cmp(x,y)
-
 /*
  * Flags to xfs_log_force()
  *