Skip to contentSkip to conversation

reduce libxfs to kernel differences

PATCH In review Christoph Hellwig 3 participants 17 messages Sep 25 – Sep 26

lore
Share & tools
lore
#0 lore raw

Hi all,

this series cleans up libxfs to further reduce the difference to the kernel version, and to reuse xfs_trans.h and the various log item headers that my kernel series moved to libxfs.

Note that in this series, it uses the Linux 7.2 versions of the kernel headers as libxfs hasn't been resynced with 7.3 yet.

#1 lore raw

PATCH 1/13 libxfs: use libxfs.h in xfs_platform.h

xfs_platform.h duplicates a lot of the include chains and some of the definitions in include/libxfs.h. Use that header from xfs_plaform.h and remove the duplication.

---
 libxfs/xfs_platform.h | 37 +------------------------------------
 1 file changed, 1 insertion(+), 36 deletions(-)
libxfs/xfs_platform.h +1 -36
index d09fb0aae00f..9aa898200da8 100644
@@ -37,33 +37,9 @@
 #ifndef _XFS_PLATFORM_H
 #define _XFS_PLATFORM_H
 
-/* CONFIG_XFS_* must be defined to 1 to work with IS_ENABLED() */
-#define CONFIG_XFS_RT 1
-#define CONFIG_XFS_BTREE_IN_MEM 1
-
-#include "libxfs_api_defs.h"
-#include "platform_defs.h"
-#include "xfs.h"
-
-#include "list.h"
-#include "hlist.h"
-#include "cache.h"
-#include "bitops.h"
-#include "kmem.h"
-#include "libfrog/radix-tree.h"
-#include "libfrog/bitmask.h"
-#include "libfrog/div64.h"
-#include "libfrog/util.h"
-#include "atomic.h"
-#include "spinlock.h"
+#include "libxfs.h"
 #include "linux-err.h"
 
-#include "xfs_types.h"
-#include "xfs_arch.h"
-
-#include "xfs_fs.h"
-#include "libfrog/crc32c.h"
-
 #include <sys/xattr.h>
 
 /* Zones used in libxfs allocations that aren't in shared header files */
@@ -77,9 +53,6 @@ extern struct kmem_cache *xfs_trans_cache;
 #define IOMAP_F_SHARED				0x04
 #define xfs_bmbt_to_iomap(a, b, c, d, e, f)	((void) 0)
 
-/* CRC stuff, buffer API dependent on it */
-#define crc32c(c,p,l)	crc32c_le((c),(unsigned char const *)(p),(l))
-
 /* fake up kernel's iomap, (not) used in xfs_bmap.[ch] */
 struct iomap {
 	unsigned long long	offset;	/* do not use */
@@ -88,14 +61,6 @@ struct iomap {
 
 #define cancel_delayed_work_sync(work) do { } while(0)
 
-#include "xfs_cksum.h"
-
-/*
- * This mirrors the kernel include for xfs_buf.h - it's implicitly included in
- * every files via a similar include in the kernel xfs_linux.h.
- */
-#include "libxfs_io.h"
-
 /* for all the support code that uses progname in error messages */
 extern char    *progname;
 
Signature · 1 line
2.53.0
#2 lore raw

PATCH 2/13 libxfs: provide memalloc_nofs_{save,restore} stubs

In reply to Christoph Hellwig
---
 include/libxfs.h | 3 +++
 1 file changed, 3 insertions(+)
include/libxfs.h +3 -0
index 7f0c22ef4991..549176cf0b2c 100644
@@ -54,6 +54,9 @@ struct iomap;
 #define unlikely(x) (x)
 #define likely(x) (x)
 
+#define memalloc_nofs_save()		(0)
+#define memalloc_nofs_restore(flags)	do { } while (0)
+
 /*
  * This mirrors the kernel include for xfs_buf.h - it's implicitly included in
  * every files via a similar include in the kernel xfs_linux.h.
Signature · 1 line
2.53.0
#3 lore raw

PATCH 3/13 libxfs: remove a spurious xfs_rtbitmap.h include in xfs_sb.c

In reply to Christoph Hellwig

This fully resyncs with the kernel version.

---
 libxfs/xfs_sb.c | 1 -
 1 file changed, 1 deletion(-)
libxfs/xfs_sb.c +0 -1
index ea99f8b5eee5..cccbcd153316 100644
@@ -27,7 +27,6 @@
 #include "xfs_rtgroup.h"
 #include "xfs_rtrmap_btree.h"
 #include "xfs_rtrefcount_btree.h"
-#include "xfs_rtbitmap.h"
 
 /*
  * Physical superblock buffer manipulations. Shared with libxfs in userspace.
Signature · 1 line
2.53.0
#4 lore raw

PATCH 4/13 libxfs: move the xfs_rtbitmap.h include in xfs_bmap.c

In reply to Christoph Hellwig

To better align with the kernel version.

---
 libxfs/xfs_bmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
libxfs/xfs_bmap.c +1 -1
index cec59446711b..cfce4358e2bf 100644
@@ -20,6 +20,7 @@
 #include "xfs_alloc.h"
 #include "xfs_bmap.h"
 #include "xfs_bmap_btree.h"
+#include "xfs_rtbitmap.h"
 #include "xfs_errortag.h"
 #include "xfs_error.h"
 #include "xfs_quota.h"
@@ -30,7 +31,6 @@
 #include "xfs_ag.h"
 #include "xfs_ag_resv.h"
 #include "xfs_refcount.h"
-#include "xfs_rtbitmap.h"
 #include "xfs_health.h"
 #include "defer_item.h"
 #include "xfs_symlink_remote.h"
Signature · 1 line
2.53.0
#5 lore raw

PATCH 5/13 libxfs: remove the unused xfs_log_item.li_mountp field

In reply to Christoph Hellwig

To prepare for reusing the kernel version of the struct.

---
 libxfs/stubs/xfs_trans.h | 1 -
 libxfs/trans.c           | 1 -
 libxfs/util.c            | 1 -
 3 files changed, 3 deletions(-)
libxfs/stubs/xfs_trans.h +0 -1
index 9102bc6f5b27..9b6a47988147 100644
@@ -24,7 +24,6 @@ struct xfs_item_ops {
 typedef struct xfs_log_item {
 	struct list_head		li_trans;	/* transaction list */
 	xfs_lsn_t			li_lsn;		/* last on-disk lsn */
-	struct xfs_mount		*li_mountp;	/* ptr to fs mount */
 	uint				li_type;	/* item type */
 	unsigned long			li_flags;	/* misc flags */
 	struct xfs_buf			*li_buf;	/* real buffer pointer */
libxfs/trans.c +0 -1
index c89b035ffeaf..9dd2e244a812 100644
@@ -52,7 +52,6 @@ libxfs_trans_add_item(
 	struct xfs_trans	*tp,
 	struct xfs_log_item	*lip)
 {
-	ASSERT(lip->li_mountp == tp->t_mountp);
 	ASSERT(lip->li_ailp == tp->t_mountp->m_ail);
 	ASSERT(list_empty(&lip->li_trans));
 	ASSERT(!test_bit(XFS_LI_DIRTY, &lip->li_flags));
libxfs/util.c +0 -1
index 6cbbe9056eba..2d8f57abd585 100644
@@ -408,7 +408,6 @@ xfs_log_item_init(
 	int			type,
 	const struct xfs_item_ops *ops)
 {
-	item->li_mountp = mp; 
 	item->li_type = type;
 	item->li_ops = ops;
 
Signature · 1 line
2.53.0
#6 lore raw

PATCH 6/13 libxfs: remove the unused xfs_inode_log_item.ili_fsync_fields field

In reply to Christoph Hellwig

To prepare for reusing the kernel version of the struct.

---
 libxfs/logitem.c         | 1 -
 libxfs/stubs/xfs_trans.h | 1 -
 2 files changed, 2 deletions(-)
libxfs/logitem.c +0 -1
index 6e56e476d1ea..d09ff75e9ce2 100644
@@ -231,7 +231,6 @@ xfs_inode_item_precommit(
 	 * (ili_fields) correctly tracks that the version has changed.
 	 */
 	spin_lock(&iip->ili_lock);
-	iip->ili_fsync_fields |= (flags & ~XFS_ILOG_IVERSION);
 	if (flags & XFS_ILOG_IVERSION)
 		flags = ((flags & ~XFS_ILOG_IVERSION) | XFS_ILOG_CORE);
 
libxfs/stubs/xfs_trans.h +0 -1
index 9b6a47988147..fcd58930cc85 100644
@@ -40,7 +40,6 @@ struct xfs_inode_log_item {
 	unsigned int		ili_dirty_flags;	/* dirty in current tx */
 	unsigned int		ili_last_fields;	/* fields when flushed*/
 	unsigned int		ili_fields;		/* fields to be logged */
-	unsigned int		ili_fsync_fields;	/* ignored by userspace */
 	spinlock_t		ili_lock;
 };
 
Signature · 1 line
2.53.0
#7 lore raw

PATCH 7/13 libxfs: remove the xfs_log_item_t and xfs_buf_log_item_t typedefs

In reply to Christoph Hellwig

These are long gone from the kernel, so catch up.

---
 libxfs/logitem.c         |  8 ++++----
 libxfs/stubs/xfs_trans.h | 12 ++++++------
 libxfs/trans.c           |  8 ++++----
 3 files changed, 14 insertions(+), 14 deletions(-)
libxfs/logitem.c +4 -4
index d09ff75e9ce2..0bb9088db351 100644
@@ -74,10 +74,10 @@ static const struct xfs_item_ops xfs_buf_item_ops = {
 void
 xfs_buf_item_init(
 	struct xfs_buf		*bp,
-	xfs_mount_t		*mp)
+	struct xfs_mount	*mp)
 {
-	xfs_log_item_t		*lip;
-	xfs_buf_log_item_t	*bip;
+	struct xfs_log_item	*lip;
+	struct xfs_buf_log_item	*bip;
 
 #ifdef LI_DEBUG
 	fprintf(stderr, "buf_item_init for buffer %p\n", bp);
@@ -121,7 +121,7 @@ xfs_buf_item_init(
  */
 void
 xfs_buf_item_log(
-	xfs_buf_log_item_t	*bip,
+	struct xfs_buf_log_item	*bip,
 	uint			first,
 	uint			last)
 {
libxfs/stubs/xfs_trans.h +6 -6
index fcd58930cc85..1117aad80c2f 100644
@@ -21,7 +21,7 @@ struct xfs_item_ops {
 	int (*iop_precommit)(struct xfs_trans *tp, struct xfs_log_item *lip);
 };
 
-typedef struct xfs_log_item {
+struct xfs_log_item {
 	struct list_head		li_trans;	/* transaction list */
 	xfs_lsn_t			li_lsn;		/* last on-disk lsn */
 	uint				li_type;	/* item type */
@@ -29,12 +29,12 @@ typedef struct xfs_log_item {
 	struct xfs_buf			*li_buf;	/* real buffer pointer */
 	struct list_head		li_bio_list;	/* buffer item list */
 	const struct xfs_item_ops	*li_ops;	/* function list */
-} xfs_log_item_t;
+};
 
 #define XFS_LI_DIRTY	3	/* log item dirty in transaction */
 
 struct xfs_inode_log_item {
-	xfs_log_item_t		ili_item;		/* common portion */
+	struct xfs_log_item	ili_item;		/* common portion */
 	struct xfs_inode	*ili_inode;		/* inode pointer */
 	unsigned short		ili_lock_flags;		/* lock flags */
 	unsigned int		ili_dirty_flags;	/* dirty in current tx */
@@ -43,13 +43,13 @@ struct xfs_inode_log_item {
 	spinlock_t		ili_lock;
 };
 
-typedef struct xfs_buf_log_item {
-	xfs_log_item_t		bli_item;	/* common item structure */
+ struct xfs_buf_log_item {
+	struct xfs_log_item	bli_item;	/* common item structure */
 	struct xfs_buf		*bli_buf;	/* real buffer pointer */
 	unsigned int		bli_flags;	/* misc flags */
 	unsigned int		bli_recur;	/* recursion count */
 	struct xfs_buf_log_format	__bli_format;	/* in-log header */
-} xfs_buf_log_item_t;
+};
 
 #define XFS_BLI_DIRTY			(1<<0)
 #define XFS_BLI_HOLD			(1<<1)
libxfs/trans.c +4 -4
index 9dd2e244a812..aa303288a81c 100644
@@ -941,7 +941,7 @@ free_item:
 
 static void
 buf_item_done(
-	xfs_buf_log_item_t	*bip)
+	struct xfs_buf_log_item	*bip)
 {
 	struct xfs_buf		*bp;
 	int			hold;
@@ -972,7 +972,7 @@ trans_committed(
 		xfs_trans_del_item(lip);
 
 		if (lip->li_type == XFS_LI_BUF)
-			buf_item_done((xfs_buf_log_item_t *)lip);
+			buf_item_done((struct xfs_buf_log_item *)lip);
 		else if (lip->li_type == XFS_LI_INODE)
 			inode_item_done((struct xfs_inode_log_item *)lip);
 		else {
@@ -985,7 +985,7 @@ trans_committed(
 
 static void
 buf_item_unlock(
-	xfs_buf_log_item_t	*bip)
+	struct xfs_buf_log_item	*bip)
 {
 	struct xfs_buf		*bp = bip->bli_buf;
 	uint			hold;
@@ -1017,7 +1017,7 @@ xfs_trans_free_items(
 	list_for_each_entry_safe(lip, next, &tp->t_items, li_trans) {
 		xfs_trans_del_item(lip);
 		if (lip->li_type == XFS_LI_BUF)
-			buf_item_unlock((xfs_buf_log_item_t *)lip);
+			buf_item_unlock((struct xfs_buf_log_item *)lip);
 		else if (lip->li_type == XFS_LI_INODE)
 			inode_item_unlock((struct xfs_inode_log_item *)lip);
 		else {
Signature · 1 line
2.53.0
#8 lore raw

PATCH 8/13 libxfs: remove libxfs_trans_alloc_rollable

In reply to Christoph Hellwig

There is no real value in this userland-only wrapper. Remove it and open code the calls, and switch to clearly better fitting transaction reservations where applicable.

---
 libxfs/stubs/xfs_trans.h |  2 --
 libxfs/trans.c           | 15 ---------------
 mkfs/proto.c             |  8 +++++---
 mkfs/xfs_mkfs.c          |  3 ++-
 repair/phase5.c          |  3 ++-
 repair/phase6.c          |  3 ++-
 repair/rmap.c            |  5 +++--
 7 files changed, 14 insertions(+), 25 deletions(-)
libxfs/stubs/xfs_trans.h +0 -2
index 1117aad80c2f..9e8737f09d8e 100644
@@ -88,8 +88,6 @@ int	libxfs_trans_alloc_inode(struct xfs_inode *ip, struct xfs_trans_res *resv,
 int	libxfs_trans_alloc_dir(struct xfs_inode *dp, struct xfs_trans_res *resv,
 			struct xfs_inode *ip, unsigned int *dblocks,
 			struct xfs_trans **tpp, int *nospace_error);
-int	libxfs_trans_alloc_rollable(struct xfs_mount *mp, uint blocks,
-				    struct xfs_trans **tpp);
 struct xfs_trans *libxfs_trans_alloc_empty(struct xfs_mount *mp);
 int	libxfs_trans_commit(struct xfs_trans *);
 void	libxfs_trans_cancel(struct xfs_trans *);
libxfs/trans.c +0 -15
index aa303288a81c..f36c54b9c806 100644
@@ -306,21 +306,6 @@ libxfs_trans_alloc_empty(
 	return __libxfs_trans_alloc(mp, XFS_TRANS_NO_WRITECOUNT);
 }
 
-/*
- * Allocate a transaction that can be rolled.  Since userspace doesn't have
- * a need for log reservations, we really only tr_itruncate to get the
- * permanent log reservation flag to avoid blowing asserts.
- */
-int
-libxfs_trans_alloc_rollable(
-	struct xfs_mount	*mp,
-	unsigned int		blocks,
-	struct xfs_trans	**tpp)
-{
-	return libxfs_trans_alloc(mp, &M_RES(mp)->tr_itruncate, blocks,
-			0, 0, tpp);
-}
-
 void
 libxfs_trans_cancel(
 	struct xfs_trans	*tp)
mkfs/proto.c +5 -3
index bdd0fadda517..f17ed3b88112 100644
@@ -161,7 +161,8 @@ getres(
 	uint		r;
 
 	for (i = 0, r = MKFS_BLOCKRES(blocks); r >= blocks; r--) {
-		i = -libxfs_trans_alloc_rollable(mp, r, &tp);
+		i = -libxfs_trans_alloc(mp, &M_RES(mp)->tr_itruncate, r, 0, 0,
+			&tp);
 		if (i == 0)
 			return tp;
 	}
@@ -251,7 +252,7 @@ rsvfile(
 	/*
 	 * update the inode timestamp, mode, and prealloc flag bits
 	 */
-	error = -libxfs_trans_alloc_rollable(mp, 0, &tp);
+	error = -libxfs_trans_alloc(mp, &M_RES(mp)->tr_fsyncts, 0, 0, 0, &tp);
 	if (error)
 		fail(_("allocating transaction for a file"), error);
 	libxfs_trans_ijoin(tp, ip, 0);
@@ -1037,7 +1038,8 @@ create_sb_metadata_file(
 	xfs_ino_t		ino;
 	int			error;
 
-	error = -libxfs_trans_alloc_rollable(mp, MKFS_BLOCKRES_INODE, &tp);
+	error = -libxfs_trans_alloc(mp, &M_RES(mp)->tr_create,
+			MKFS_BLOCKRES_INODE, 0, 0, &tp);
 	if (error)
 		res_failed(error);
 
mkfs/xfs_mkfs.c +2 -1
index 334367b81555..107e12206d67 100644
@@ -5688,7 +5688,8 @@ initialise_ag_freespace(
 	struct xfs_trans	*tp;
 	int			c;
 
-	c = -libxfs_trans_alloc_rollable(mp, worst_freelist, &tp);
+	c = -libxfs_trans_alloc(mp, &M_RES(mp)->tr_itruncate, worst_freelist,
+			0, 0, &tp);
 	if (c)
 		res_failed(c);
 
repair/phase5.c +2 -1
index e44c26885717..4c67d049702b 100644
@@ -610,7 +610,8 @@ inject_lost_extent(
 	xfs_agblock_t		agbno;
 	int			error;
 
-	error = -libxfs_trans_alloc_rollable(mp, 16, &tp);
+	error = -libxfs_trans_alloc(mp, &M_RES(mp)->tr_itruncate, 16, 0, 0,
+			&tp);
 	if (error)
 		return error;
 
repair/phase6.c +2 -1
index f3951a3d0709..f6f985a92541 100644
@@ -507,7 +507,8 @@ mk_rtino(
 		libxfs_rtginode_metafile_type(type);
 	int			error;
 
-	error = -libxfs_trans_alloc_rollable(mp, 10, &tp);
+	error = -libxfs_trans_alloc(mp, &M_RES(mp)->tr_itruncate, 10, 0, 0,
+			&tp);
 	if (error)
 		res_failed(error);
 
repair/rmap.c +3 -2
index 55c2b0928c52..9f824f848edc 100644
@@ -714,7 +714,8 @@ rmap_commit_agbtree_mappings(
 		struct xfs_owner_info	oinfo = {};
 		struct xfs_perag	*pag;
 
-		error = -libxfs_trans_alloc_rollable(mp, 16, &tp);
+		error = -libxfs_trans_alloc(mp, &M_RES(mp)->tr_itruncate, 16, 0,
+				0, &tp);
 		if (error)
 			goto err_slab;
 
@@ -1952,7 +1953,7 @@ fix_freelist(
 	args.agno = agno;
 	args.alignment = 1;
 	args.pag = libxfs_perag_get(mp, agno);
-	error = -libxfs_trans_alloc_rollable(mp, 0, &tp);
+	error = -libxfs_trans_alloc(mp, &M_RES(mp)->tr_itruncate, 0, 0, 0, &tp);
 	if (error)
 		do_error(_("failed to fix AGFL on AG %d, error %d\n"),
 				agno, error);
Signature · 1 line
2.53.0
#9 lore raw

PATCH 9/13 libxfs: return int from xfs_buf_item_init

In reply to Christoph Hellwig

Match the kernel version.

---
 libxfs/logitem.c      | 6 +++---
 libxfs/xfs_platform.h | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)
libxfs/logitem.c +3 -3
index 0bb9088db351..2e050ad92a1e 100644
@@ -71,7 +71,7 @@ static const struct xfs_item_ops xfs_buf_item_ops = {
  * buffer (see xfs_buf_attach_iodone() below), then put the
  * buf log item at the front.
  */
-void
+int
 xfs_buf_item_init(
 	struct xfs_buf		*bp,
 	struct xfs_mount	*mp)
@@ -97,7 +97,7 @@ xfs_buf_item_init(
 				"reused buf item %p for pre-logged buffer %p\n",
 				lip, bp);
 #endif
-			return;
+			return 0;
 		}
 	}
 
@@ -112,9 +112,9 @@ xfs_buf_item_init(
 	bip->__bli_format.blf_blkno = (int64_t)xfs_buf_daddr(bp);
 	bip->__bli_format.blf_len = (unsigned short)bp->b_length;
 	bp->b_log_item = bip;
+	return 0;
 }
 
-
 /*
  * Mark bytes first through last inclusive as dirty in the buf
  * item's bitmap.
libxfs/xfs_platform.h +1 -1
index 9aa898200da8..2e3d323505c5 100644
@@ -408,7 +408,7 @@ void xfs_trans_del_item(struct xfs_log_item *);
 void xfs_inode_item_init(struct xfs_inode *, struct xfs_mount *);
 
 /* xfs_buf_item.c */
-void xfs_buf_item_init(struct xfs_buf *, struct xfs_mount *);
+int xfs_buf_item_init(struct xfs_buf *, struct xfs_mount *);
 void xfs_buf_item_log(struct xfs_buf_log_item *, uint, uint);
 
 /* xfs_trans_buf.c */
Signature · 1 line
2.53.0
#10 lore raw

PATCH 10/13 libxfs: use xfs_buf_item.h and xfs_inode_item.h from the kernel source

In reply to Christoph Hellwig

Replace the partial copy and paste in xfs_trans.h with full copies of the kernel versions.

---
 libxfs/buf_mem.c            |  1 +
 libxfs/init.c               |  2 ++
 libxfs/inode.c              |  1 +
 libxfs/logitem.c            |  4 ++-
 libxfs/stubs/xfs_trans.h    | 24 -------------
 libxfs/trans.c              |  6 ++--
 libxfs/xfs_alloc.c          |  1 +
 libxfs/xfs_attr_leaf.c      |  1 +
 libxfs/xfs_bmap.c           |  1 +
 libxfs/xfs_btree.c          |  1 +
 libxfs/xfs_btree_mem.c      |  1 +
 libxfs/xfs_buf_item.h       | 71 +++++++++++++++++++++++++++++++++++++
 libxfs/xfs_da_btree.c       |  1 +
 libxfs/xfs_defer.c          |  2 ++
 libxfs/xfs_dir2_block.c     |  1 +
 libxfs/xfs_dir2_data.c      |  1 +
 libxfs/xfs_dir2_leaf.c      |  1 +
 libxfs/xfs_dir2_node.c      |  1 +
 libxfs/xfs_ialloc.c         |  1 +
 libxfs/xfs_inode_fork.c     |  1 +
 libxfs/xfs_inode_item.h     | 62 ++++++++++++++++++++++++++++++++
 libxfs/xfs_inode_util.c     |  1 +
 libxfs/xfs_rtbitmap.c       |  1 +
 libxfs/xfs_rtgroup.c        |  1 +
 libxfs/xfs_sb.c             |  1 +
 libxfs/xfs_symlink_remote.c |  1 +
 libxfs/xfs_trans_inode.c    |  2 +-
 27 files changed, 164 insertions(+), 28 deletions(-)
 create mode 100644 libxfs/xfs_buf_item.h
 create mode 100644 libxfs/xfs_inode_item.h
libxfs/buf_mem.c +1 -0
index 3c8452de9689..cb7e55129d18 100644
@@ -6,6 +6,7 @@
 #include "xfs_platform.h"
 #include "libxfs.h"
 #include "xfs_buf_mem.h"
+#include "xfs_buf_item.h"
 #include <sys/mman.h>
 #include <sys/types.h>
 #include <sys/wait.h>
libxfs/init.c +2 -0
index b89c9fe360d4..5f0b7dd6a9f2 100644
@@ -19,6 +19,8 @@
 #include "xfs_inode_fork.h"
 #include "xfs_inode.h"
 #include "xfs_trans.h"
+#include "xfs_inode_item.h"
+#include "xfs_buf_item.h"
 #include "xfs_rmap_btree.h"
 #include "xfs_refcount_btree.h"
 #include "xfs_metafile.h"
libxfs/inode.c +1 -0
index b6838d3d4bd3..482b2d4b55bb 100644
@@ -19,6 +19,7 @@
 #include "xfs_inode_fork.h"
 #include "xfs_inode.h"
 #include "xfs_trans.h"
+#include "xfs_inode_item.h"
 #include "xfs_bmap.h"
 #include "xfs_bmap_btree.h"
 #include "xfs_trans_space.h"
libxfs/logitem.c +3 -1
index 2e050ad92a1e..432dccbe5649 100644
@@ -11,10 +11,12 @@
 #include "xfs_log_format.h"
 #include "xfs_trans_resv.h"
 #include "xfs_mount.h"
+#include "xfs_trans.h"
 #include "xfs_inode_buf.h"
 #include "xfs_inode_fork.h"
 #include "xfs_inode.h"
-#include "xfs_trans.h"
+#include "xfs_inode_item.h"
+#include "xfs_buf_item.h"
 #include "xfs_rtbitmap.h"
 #include "xfs_ag.h"
 
libxfs/stubs/xfs_trans.h +0 -24
index 9e8737f09d8e..aa4de91b43a9 100644
@@ -33,30 +33,6 @@ struct xfs_log_item {
 
 #define XFS_LI_DIRTY	3	/* log item dirty in transaction */
 
-struct xfs_inode_log_item {
-	struct xfs_log_item	ili_item;		/* common portion */
-	struct xfs_inode	*ili_inode;		/* inode pointer */
-	unsigned short		ili_lock_flags;		/* lock flags */
-	unsigned int		ili_dirty_flags;	/* dirty in current tx */
-	unsigned int		ili_last_fields;	/* fields when flushed*/
-	unsigned int		ili_fields;		/* fields to be logged */
-	spinlock_t		ili_lock;
-};
-
- struct xfs_buf_log_item {
-	struct xfs_log_item	bli_item;	/* common item structure */
-	struct xfs_buf		*bli_buf;	/* real buffer pointer */
-	unsigned int		bli_flags;	/* misc flags */
-	unsigned int		bli_recur;	/* recursion count */
-	struct xfs_buf_log_format	__bli_format;	/* in-log header */
-};
-
-#define XFS_BLI_DIRTY			(1<<0)
-#define XFS_BLI_HOLD			(1<<1)
-#define XFS_BLI_STALE			(1<<2)
-#define XFS_BLI_INODE_ALLOC_BUF		(1<<3)
-#define XFS_BLI_ORDERED			(1<<4)
-
 typedef struct xfs_trans {
 	unsigned int		t_log_res;	/* amt of log space resvd */
 	unsigned int		t_log_count;	/* count for perm log res */
libxfs/trans.c +4 -2
index f36c54b9c806..de7019e9051a 100644
@@ -12,14 +12,16 @@
 #include "xfs_log_format.h"
 #include "xfs_trans_resv.h"
 #include "xfs_mount.h"
+#include "xfs_trans.h"
 #include "xfs_inode_buf.h"
 #include "xfs_inode_fork.h"
 #include "xfs_inode.h"
-#include "xfs_trans.h"
+#include "xfs_inode_item.h"
 #include "xfs_sb.h"
 #include "xfs_defer.h"
 #include "xfs_trace.h"
 #include "xfs_rtbitmap.h"
+#include "xfs_buf_item.h"
 
 static void xfs_trans_free_items(struct xfs_trans *tp);
 STATIC struct xfs_trans *xfs_trans_dup(struct xfs_trans *tp);
@@ -339,7 +341,7 @@ libxfs_trans_cancel(
 	xfs_trans_free(tp);
 }
 
-static void
+void
 xfs_buf_item_put(
 	struct xfs_buf_log_item	*bip)
 {
libxfs/xfs_alloc.c +1 -0
index 4cad09d8be61..13ec03c3b45a 100644
@@ -21,6 +21,7 @@
 #include "xfs_error.h"
 #include "xfs_trace.h"
 #include "xfs_trans.h"
+#include "xfs_buf_item.h"
 #include "xfs_ag.h"
 #include "xfs_ag_resv.h"
 #include "xfs_bmap.h"
libxfs/xfs_attr_leaf.c +1 -0
index 0ac2ae28efa6..240864676aec 100644
@@ -24,6 +24,7 @@
 #include "xfs_attr_leaf.h"
 #include "xfs_error.h"
 #include "xfs_trace.h"
+#include "xfs_buf_item.h"
 #include "xfs_dir2.h"
 #include "xfs_ag.h"
 #include "xfs_errortag.h"
libxfs/xfs_bmap.c +1 -0
index cfce4358e2bf..18308d65f92d 100644
@@ -25,6 +25,7 @@
 #include "xfs_error.h"
 #include "xfs_quota.h"
 #include "xfs_trans_space.h"
+#include "xfs_buf_item.h"
 #include "xfs_trace.h"
 #include "xfs_attr_leaf.h"
 #include "xfs_rmap.h"
libxfs/xfs_btree.c +1 -0
index 425fbefc31ad..9fcb6c349523 100644
@@ -13,6 +13,7 @@
 #include "xfs_mount.h"
 #include "xfs_inode.h"
 #include "xfs_trans.h"
+#include "xfs_buf_item.h"
 #include "xfs_btree.h"
 #include "xfs_errortag.h"
 #include "xfs_error.h"
libxfs/xfs_btree_mem.c +1 -0
index c2fa836a2ae2..37136a70e56d 100644
@@ -16,6 +16,7 @@
 #include "xfs_buf_mem.h"
 #include "xfs_btree_mem.h"
 #include "xfs_ag.h"
+#include "xfs_buf_item.h"
 #include "xfs_trace.h"
 #include "xfs_rtgroup.h"
 
libxfs/xfs_buf_item.h new file +71 -0

71 lines not on this page · raw message

libxfs/xfs_da_btree.c +1 -0
index 9f25f1658b07..a3a3a1aa4c57 100644
@@ -20,6 +20,7 @@
 #include "xfs_attr_leaf.h"
 #include "xfs_error.h"
 #include "xfs_trace.h"
+#include "xfs_buf_item.h"
 #include "xfs_errortag.h"
 #include "xfs_health.h"
 
libxfs/xfs_defer.c +2 -0
index eae2397fbff8..28e8dcf14475 100644
@@ -12,7 +12,9 @@
 #include "xfs_mount.h"
 #include "xfs_defer.h"
 #include "xfs_trans.h"
+#include "xfs_buf_item.h"
 #include "xfs_inode.h"
+#include "xfs_inode_item.h"
 #include "xfs_trace.h"
 #include "xfs_rmap.h"
 #include "xfs_refcount.h"
libxfs/xfs_dir2_block.c +1 -0
index 0e9dd19eafae..54cb8b645c9c 100644
@@ -14,6 +14,7 @@
 #include "xfs_inode.h"
 #include "xfs_trans.h"
 #include "xfs_bmap.h"
+#include "xfs_buf_item.h"
 #include "xfs_dir2.h"
 #include "xfs_dir2_priv.h"
 #include "xfs_error.h"
libxfs/xfs_dir2_data.c +1 -0
index 0fafe7826ec9..23625d647da4 100644
@@ -16,6 +16,7 @@
 #include "xfs_dir2_priv.h"
 #include "xfs_error.h"
 #include "xfs_trans.h"
+#include "xfs_buf_item.h"
 #include "xfs_health.h"
 
 static xfs_failaddr_t xfs_dir2_data_freefind_verify(
libxfs/xfs_dir2_leaf.c +1 -0
index ea8ab6d46c6c..bc909543eb74 100644
@@ -18,6 +18,7 @@
 #include "xfs_error.h"
 #include "xfs_trace.h"
 #include "xfs_trans.h"
+#include "xfs_buf_item.h"
 #include "xfs_health.h"
 
 /*
libxfs/xfs_dir2_node.c +1 -0
index a0aaa21b12cf..7641cbdb8e10 100644
@@ -18,6 +18,7 @@
 #include "xfs_error.h"
 #include "xfs_trace.h"
 #include "xfs_trans.h"
+#include "xfs_buf_item.h"
 #include "xfs_health.h"
 
 /*
libxfs/xfs_ialloc.c +1 -0
index aa895c0decbc..07f6c0094281 100644
@@ -20,6 +20,7 @@
 #include "xfs_error.h"
 #include "xfs_bmap.h"
 #include "xfs_trans.h"
+#include "xfs_buf_item.h"
 #include "xfs_trace.h"
 #include "xfs_rmap.h"
 #include "xfs_ag.h"
libxfs/xfs_inode_fork.c +1 -0
index df89ae420617..606a36526ce2 100644
@@ -13,6 +13,7 @@
 #include "xfs_mount.h"
 #include "xfs_inode.h"
 #include "xfs_trans.h"
+#include "xfs_inode_item.h"
 #include "xfs_btree.h"
 #include "xfs_bmap_btree.h"
 #include "xfs_bmap.h"
libxfs/xfs_inode_item.h new file +62 -0

62 lines not on this page · raw message

libxfs/xfs_inode_util.c +1 -0
index 9de455088568..6e45cc515847 100644
@@ -21,6 +21,7 @@
 #include "xfs_trace.h"
 #include "xfs_ag.h"
 #include "iunlink.h"
+#include "xfs_inode_item.h"
 
 uint16_t
 xfs_flags2diflags(
libxfs/xfs_rtbitmap.c +1 -0
index 6a0fc1032753..d4b90548718c 100644
@@ -21,6 +21,7 @@
 #include "xfs_health.h"
 #include "xfs_sb.h"
 #include "xfs_errortag.h"
+#include "xfs_buf_item.h"
 #include "xfs_extent_busy.h"
 
 /*
libxfs/xfs_rtgroup.c +1 -0
index c1f8d2cb186a..2bbe651b773a 100644
@@ -27,6 +27,7 @@
 #include "xfs_trans.h"
 #include "xfs_trace.h"
 #include "xfs_inode.h"
+#include "xfs_buf_item.h"
 #include "xfs_rtgroup.h"
 #include "xfs_rtbitmap.h"
 #include "xfs_metafile.h"
libxfs/xfs_sb.c +1 -0
index cccbcd153316..696bafd2cc3e 100644
@@ -16,6 +16,7 @@
 #include "xfs_alloc.h"
 #include "xfs_error.h"
 #include "xfs_trans.h"
+#include "xfs_buf_item.h"
 #include "xfs_bmap_btree.h"
 #include "xfs_alloc_btree.h"
 #include "xfs_rmap_btree.h"
libxfs/xfs_symlink_remote.c +1 -0
index de487b1caa4b..008953d402f6 100644
@@ -14,6 +14,7 @@
 #include "xfs_inode.h"
 #include "xfs_error.h"
 #include "xfs_trans.h"
+#include "xfs_buf_item.h"
 #include "xfs_symlink_remote.h"
 #include "xfs_bit.h"
 #include "xfs_bmap.h"
libxfs/xfs_trans_inode.c +1 -1
index ef404e7f0f6e..697671007561 100644
@@ -12,7 +12,7 @@
 #include "xfs_mount.h"
 #include "xfs_inode.h"
 #include "xfs_trans.h"
-
+#include "xfs_inode_item.h"
 
 /*
  * Add a locked inode to the transaction.
Signature · 1 line
2.53.0
#11 lore raw

PATCH 11/13 libxfs: cleanup xfs_trans.h

In reply to Christoph Hellwig

Add new xfs_trans_priv.h and xfs_log.h stubs for definitions that aren't in xfs_trans.h in the kernel. This prepares for pulling in the kernel version of xfs_trans.h.

---
 libxfs/stubs/xfs_log.h        |  7 +++++++
 libxfs/stubs/xfs_trans.h      |  7 -------
 libxfs/stubs/xfs_trans_priv.h | 16 ++++++++++++++++
 libxfs/xfs_defer.c            |  2 ++
 repair/phase2.c               |  1 +
 5 files changed, 26 insertions(+), 7 deletions(-)
 create mode 100644 libxfs/stubs/xfs_log.h
 create mode 100644 libxfs/stubs/xfs_trans_priv.h
libxfs/stubs/xfs_log.h new file +7 -0
new file mode 100644
index 000000000000..98251ee06688
@@ -0,0 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0
+#ifndef __XFS_LOG_H__
+#define __XFS_LOG_H__
+
+#define xfs_log_item_in_current_chkpt(lip)	(false)
+
+#endif /* __XFS_LOG_H__ */
libxfs/stubs/xfs_trans.h +0 -7
index aa4de91b43a9..2619347df923 100644
@@ -52,7 +52,6 @@ typedef struct xfs_trans {
 	struct list_head	t_dfops;	/* deferred operations */
 } xfs_trans_t;
 
-void	xfs_trans_init(struct xfs_mount *);
 int	xfs_trans_roll(struct xfs_trans **);
 
 int	libxfs_trans_alloc(struct xfs_mount *mp, struct xfs_trans_res *resp,
@@ -130,10 +129,4 @@ libxfs_trans_read_buf(
 	return libxfs_trans_read_buf_map(mp, tp, btp, &map, 1, flags, bpp, ops);
 }
 
-#define xfs_log_item_in_current_chkpt(lip)	(false)
-
-/* Contorted mess to make gcc shut up about unused vars. */
-#define xfs_ail_get_push_target(ail)    \
-		((log) == (log) ? NULLCOMMITLSN : NULLCOMMITLSN)
-
 #endif	/* __XFS_TRANS_H__ */
libxfs/stubs/xfs_trans_priv.h new file +16 -0
new file mode 100644
index 000000000000..bab4e6c2b6c2
@@ -0,0 +1,16 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2000-2005 Silicon Graphics, Inc.
+ * All Rights Reserved.
+ */
+
+#ifndef __XFS_TRANS_PRIV_H__
+#define __XFS_TRANS_PRIV_H__
+
+void	xfs_trans_init(struct xfs_mount *);
+
+/* Contorted mess to make gcc shut up about unused vars. */
+#define xfs_ail_get_push_target(ail)    \
+	((log) == (log) ? NULLCOMMITLSN : NULLCOMMITLSN)
+
+#endif /* __XFS_TRANS_PRIV_H__ */
libxfs/xfs_defer.c +2 -0
index 28e8dcf14475..ab1f81d8bcd2 100644
@@ -12,10 +12,12 @@
 #include "xfs_mount.h"
 #include "xfs_defer.h"
 #include "xfs_trans.h"
+#include "xfs_trans_priv.h"
 #include "xfs_buf_item.h"
 #include "xfs_inode.h"
 #include "xfs_inode_item.h"
 #include "xfs_trace.h"
+#include "xfs_log.h"
 #include "xfs_rmap.h"
 #include "xfs_refcount.h"
 #include "xfs_bmap.h"
repair/phase2.c +1 -0
index fc96f9c4223c..ee166e62a002 100644
@@ -16,6 +16,7 @@
 #include "scan.h"
 #include "rt.h"
 #include "quotacheck.h"
+#include "xfs_trans_priv.h"
 
 /* workaround craziness in the xlog routines */
 int xlog_recover_do_trans(struct xlog *log, struct xlog_recover *t, int p)
Signature · 1 line
2.53.0
#12 lore raw

PATCH 12/13 libxfs: use xfs_trans.h from the kernel source

In reply to Christoph Hellwig

Replace the the existing xfs_trans.h with a copy of the kernel versions.

---
 libxfs/Makefile             |   8 +-
 libxfs/init.c               |   1 +
 libxfs/inode.c              |   1 +
 libxfs/libxfs_api_defs.h    |   1 +
 libxfs/logitem.c            |   1 +
 libxfs/trans.c              |  23 +++
 libxfs/xfs_alloc.c          |   1 +
 libxfs/xfs_attr_leaf.c      |   1 +
 libxfs/xfs_btree.c          |   1 +
 libxfs/xfs_da_btree.c       |   1 +
 libxfs/xfs_dir2_block.c     |   1 +
 libxfs/xfs_dir2_data.c      |   1 +
 libxfs/xfs_dir2_node.c      |   1 +
 libxfs/xfs_ialloc.c         |   1 +
 libxfs/xfs_inode_util.c     |   1 +
 libxfs/xfs_platform.h       |  19 ---
 libxfs/xfs_rtbitmap.c       |   1 +
 libxfs/xfs_sb.c             |   1 +
 libxfs/xfs_symlink_remote.c |   1 +
 libxfs/xfs_trans.h          | 283 ++++++++++++++++++++++++++++++++++++
 libxfs/xfs_trans_inode.c    |   1 +
 libxfs/xfs_trans_resv.c     |   1 +
 22 files changed, 329 insertions(+), 22 deletions(-)
 create mode 100644 libxfs/xfs_trans.h
libxfs/Makefile +5 -3
index 9795982b0e83..c655d092d79e 100644
@@ -37,6 +37,7 @@ HFILES = \
 	xfs_attr_leaf.h \
 	xfs_attr_sf.h \
 	xfs_bit.h \
+	xfs_buf_item.h \
 	xfs_bmap.h \
 	xfs_bmap_btree.h \
 	xfs_btree.h \
@@ -46,6 +47,7 @@ HFILES = \
 	xfs_cksum.h \
 	xfs_da_btree.h \
 	xfs_dir2.h \
+	xfs_dir2_priv.h \
 	xfs_errortag.h \
 	xfs_exchmaps.h \
 	xfs_group.h \
@@ -53,6 +55,7 @@ HFILES = \
 	xfs_ialloc_btree.h \
 	xfs_inode_buf.h \
 	xfs_inode_fork.h \
+	xfs_inode_item.h \
 	xfs_inode_util.h \
 	xfs_log_recover.h \
 	xfs_metadir.h \
@@ -71,7 +74,7 @@ HFILES = \
 	xfs_shared.h \
 	xfs_trans_resv.h \
 	xfs_trans_space.h \
-	xfs_dir2_priv.h \
+	xfs_trans.h \
 	xfs_zones.h \
 	stubs/xfs_buf_mem.h \
 	stubs/xfs_error.h \
@@ -79,8 +82,7 @@ HFILES = \
 	stubs/xfs_inode.h \
 	stubs/xfs_mount.h \
 	stubs/xfs_quota.h \
-	stubs/xfs_trace.h \
-	stubs/xfs_trans.h
+	stubs/xfs_trace.h
 
 CFILES = buf_mem.c \
 	cache.c \
libxfs/init.c +1 -0
index 5f0b7dd6a9f2..9b2157dd2237 100644
@@ -15,6 +15,7 @@
 #include "xfs_trans_resv.h"
 #include "xfs_mount.h"
 #include "xfs_defer.h"
+#include "xfs_trans.h"
 #include "xfs_inode_buf.h"
 #include "xfs_inode_fork.h"
 #include "xfs_inode.h"
libxfs/inode.c +1 -0
index 482b2d4b55bb..cf6830aed49a 100644
@@ -15,6 +15,7 @@
 #include "xfs_trans_resv.h"
 #include "xfs_mount.h"
 #include "xfs_defer.h"
+#include "xfs_trans.h"
 #include "xfs_inode_buf.h"
 #include "xfs_inode_fork.h"
 #include "xfs_inode.h"
libxfs/libxfs_api_defs.h +1 -0
index 4f542ae7267e..300135fcac8b 100644
@@ -391,6 +391,7 @@
 #define xfs_trans_ordered_buf		libxfs_trans_ordered_buf
 #define xfs_trans_read_buf		libxfs_trans_read_buf
 #define xfs_trans_read_buf_map		libxfs_trans_read_buf_map
+#define xfs_trans_reserve_more		libxfs_trans_reserve_more
 #define xfs_trans_resv_calc		libxfs_trans_resv_calc
 #define xfs_trans_roll_inode		libxfs_trans_roll_inode
 #define xfs_trans_roll			libxfs_trans_roll
libxfs/logitem.c +1 -0
index 432dccbe5649..8e81c338e0ab 100644
@@ -14,6 +14,7 @@
 #include "xfs_trans.h"
 #include "xfs_inode_buf.h"
 #include "xfs_inode_fork.h"
+#include "xfs_trans.h"
 #include "xfs_inode.h"
 #include "xfs_inode_item.h"
 #include "xfs_buf_item.h"
libxfs/trans.c +23 -0
index de7019e9051a..8db8ba9ac670 100644
@@ -17,6 +17,7 @@
 #include "xfs_inode_fork.h"
 #include "xfs_inode.h"
 #include "xfs_inode_item.h"
+#include "xfs_buf_item.h"
 #include "xfs_sb.h"
 #include "xfs_defer.h"
 #include "xfs_trace.h"
@@ -353,6 +354,21 @@ xfs_buf_item_put(
 
 /* from xfs_trans_buf.c */
 
+void
+xfs_trans_buf_set_type(
+	struct xfs_trans	*tp,
+	struct xfs_buf		*bp,
+	enum xfs_blft		type)
+{
+}
+
+void
+xfs_trans_buf_copy_type(
+	struct xfs_buf		*dst_bp,
+	struct xfs_buf		*src_bp)
+{
+}
+
 /*
  * Add the locked buffer to the transaction.
  *
@@ -765,6 +781,13 @@ libxfs_trans_binval(
 	tp->t_flags |= XFS_TRANS_DIRTY;
 }
 
+void
+xfs_trans_inode_buf(
+	struct xfs_trans	*tp,
+	struct xfs_buf		*bp)
+{
+}
+
 /*
  * Mark the buffer as being one which contains newly allocated
  * inodes.  We need to make sure that even if this buffer is
libxfs/xfs_alloc.c +1 -0
index 13ec03c3b45a..8feaa0edace1 100644
@@ -22,6 +22,7 @@
 #include "xfs_trace.h"
 #include "xfs_trans.h"
 #include "xfs_buf_item.h"
+#include "xfs_log.h"
 #include "xfs_ag.h"
 #include "xfs_ag_resv.h"
 #include "xfs_bmap.h"
libxfs/xfs_attr_leaf.c +1 -0
index 240864676aec..86c5c09a5db4 100644
@@ -26,6 +26,7 @@
 #include "xfs_trace.h"
 #include "xfs_buf_item.h"
 #include "xfs_dir2.h"
+#include "xfs_log.h"
 #include "xfs_ag.h"
 #include "xfs_errortag.h"
 #include "xfs_health.h"
libxfs/xfs_btree.c +1 -0
index 9fcb6c349523..60ef7f08b1d3 100644
@@ -19,6 +19,7 @@
 #include "xfs_error.h"
 #include "xfs_trace.h"
 #include "xfs_alloc.h"
+#include "xfs_log.h"
 #include "xfs_btree_staging.h"
 #include "xfs_ag.h"
 #include "xfs_alloc_btree.h"
libxfs/xfs_da_btree.c +1 -0
index a3a3a1aa4c57..9debb95d86fa 100644
@@ -21,6 +21,7 @@
 #include "xfs_error.h"
 #include "xfs_trace.h"
 #include "xfs_buf_item.h"
+#include "xfs_log.h"
 #include "xfs_errortag.h"
 #include "xfs_health.h"
 
libxfs/xfs_dir2_block.c +1 -0
index 54cb8b645c9c..6d70e6b429e7 100644
@@ -19,6 +19,7 @@
 #include "xfs_dir2_priv.h"
 #include "xfs_error.h"
 #include "xfs_trace.h"
+#include "xfs_log.h"
 #include "xfs_health.h"
 
 /*
libxfs/xfs_dir2_data.c +1 -0
index 23625d647da4..aecbab61014c 100644
@@ -17,6 +17,7 @@
 #include "xfs_error.h"
 #include "xfs_trans.h"
 #include "xfs_buf_item.h"
+#include "xfs_log.h"
 #include "xfs_health.h"
 
 static xfs_failaddr_t xfs_dir2_data_freefind_verify(
libxfs/xfs_dir2_node.c +1 -0
index 7641cbdb8e10..19cb536e53ef 100644
@@ -19,6 +19,7 @@
 #include "xfs_trace.h"
 #include "xfs_trans.h"
 #include "xfs_buf_item.h"
+#include "xfs_log.h"
 #include "xfs_health.h"
 
 /*
libxfs/xfs_ialloc.c +1 -0
index 07f6c0094281..91f4cdf2e4f3 100644
@@ -22,6 +22,7 @@
 #include "xfs_trans.h"
 #include "xfs_buf_item.h"
 #include "xfs_trace.h"
+#include "xfs_log.h"
 #include "xfs_rmap.h"
 #include "xfs_ag.h"
 #include "xfs_health.h"
libxfs/xfs_inode_util.c +1 -0
index 6e45cc515847..b4f556df64ed 100644
@@ -20,6 +20,7 @@
 #include "xfs_error.h"
 #include "xfs_trace.h"
 #include "xfs_ag.h"
+#include "xfs_inode_item.h"
 #include "iunlink.h"
 #include "xfs_inode_item.h"
 
libxfs/xfs_platform.h +0 -19
index 2e3d323505c5..4b0069fd70d7 100644
@@ -314,16 +314,6 @@ xfs_buf_incore(
 void __xfs_buf_mark_corrupt(struct xfs_buf *bp, xfs_failaddr_t fa);
 #define xfs_buf_mark_corrupt(bp) __xfs_buf_mark_corrupt((bp), __this_address)
 
-/* mount stuff */
-#define xfs_trans_set_sync(tp)		((void) 0)
-#define xfs_trans_buf_set_type(tp, bp, t)	({	\
-	int __t = (t);					\
-	__t = __t; /* no set-but-unused warning */	\
-	tp = tp;  /* no set-but-unused warning */	\
-})
-
-#define xfs_trans_buf_copy_type(dbp, sbp)
-
 static inline void
 xfs_buf_readahead(
 	struct xfs_buftarg	*target,
@@ -357,8 +347,6 @@ xfs_buf_readahead(
 #define xfs_filestream_new_ag(ip,ag)		(0)
 #define xfs_filestream_select_ag(...)		(-ENOSYS)
 
-#define xfs_trans_inode_buf(tp, bp)		((void) 0)
-
 #define uuid_copy(s,d)		platform_uuid_copy((s),(d))
 #define uuid_equal(s,d)		(platform_uuid_compare((s),(d)) == 0)
 
@@ -404,13 +392,6 @@ int xfs_trans_roll(struct xfs_trans **);
 void xfs_trans_add_item(struct xfs_trans *, struct xfs_log_item *);
 void xfs_trans_del_item(struct xfs_log_item *);
 
-/* xfs_inode_item.c */
-void xfs_inode_item_init(struct xfs_inode *, struct xfs_mount *);
-
-/* xfs_buf_item.c */
-int xfs_buf_item_init(struct xfs_buf *, struct xfs_mount *);
-void xfs_buf_item_log(struct xfs_buf_log_item *, uint, uint);
-
 /* xfs_trans_buf.c */
 struct xfs_buf *xfs_trans_buf_item_match(struct xfs_trans *,
 			struct xfs_buftarg *, struct xfs_buf_map *, int);
libxfs/xfs_rtbitmap.c +1 -0
index d4b90548718c..590e0641ff0d 100644
@@ -21,6 +21,7 @@
 #include "xfs_health.h"
 #include "xfs_sb.h"
 #include "xfs_errortag.h"
+#include "xfs_log.h"
 #include "xfs_buf_item.h"
 #include "xfs_extent_busy.h"
 
libxfs/xfs_sb.c +1 -0
index 696bafd2cc3e..aae63ccdb6b5 100644
@@ -19,6 +19,7 @@
 #include "xfs_buf_item.h"
 #include "xfs_bmap_btree.h"
 #include "xfs_alloc_btree.h"
+#include "xfs_log.h"
 #include "xfs_rmap_btree.h"
 #include "xfs_refcount_btree.h"
 #include "xfs_da_format.h"
libxfs/xfs_symlink_remote.c +1 -0
index 008953d402f6..b0dc3888bf1b 100644
@@ -15,6 +15,7 @@
 #include "xfs_error.h"
 #include "xfs_trans.h"
 #include "xfs_buf_item.h"
+#include "xfs_log.h"
 #include "xfs_symlink_remote.h"
 #include "xfs_bit.h"
 #include "xfs_bmap.h"
libxfs/xfs_trans.h new file +283 -0

283 lines not on this page · raw message

libxfs/xfs_trans_inode.c +1 -0
index 697671007561..e3dca0652d26 100644
@@ -12,6 +12,7 @@
 #include "xfs_mount.h"
 #include "xfs_inode.h"
 #include "xfs_trans.h"
+#include "xfs_trans_priv.h"
 #include "xfs_inode_item.h"
 
 /*
libxfs/xfs_trans_resv.c +1 -0
index 5b7660b1cd8a..d15ca0427584 100644
@@ -19,6 +19,7 @@
 #include "xfs_trans.h"
 #include "xfs_trans_space.h"
 #include "xfs_rtbitmap.h"
+#include "xfs_log.h"
 #include "xfs_trace.h"
 #include "defer_item.h"
 
Signature · 1 line
2.53.0
#13 lore raw

Re: [PATCH 12/13] libxfs: use xfs_trans.h from the kernel source

Quoted 1 line · Christoph Hellwig

Replace the the existing xfs_trans.h with a copy of the kernel versions.

after this, inode.c, init.c, and logitem.c all #include "xfs_trans.h" twice?

and trans.c includes xfs_buf_item.h twice.

(perhaps the existing #includes just needed to be moved up?)

Also after this I think we have both libxfs/xfs_trans.h and libxfs/stubs/xfs_trans.h with the same guard, did you mean to remove the one in stubs/ ?

(ugh, why do I sound like Sashiko LOL)

-Eric

#14 lore raw

Re: [PATCH 12/13] libxfs: use xfs_trans.h from the kernel source

Quoted 8 lines · Eric Sandeen
Quoted 1 line · Christoph Hellwig

Replace the the existing xfs_trans.h with a copy of the kernel versions.

after this, inode.c, init.c, and logitem.c all #include "xfs_trans.h" twice?

and trans.c includes xfs_buf_item.h twice.

(perhaps the existing #includes just needed to be moved up?)

Some need to be moved up, some are just duplicate. I made a bit of a mess splitting up my original bigger patch which resulted in this.

Quoted 2 lines

Also after this I think we have both libxfs/xfs_trans.h and libxfs/stubs/xfs_trans.h with the same guard, did you mean to remove the one in stubs/ ?

The same mess as above left the old xfs_trans.h around in the patch as I only removed it locally after fixing up the split..

Quoted 2 lines

(ugh, why do I sound like Sashiko LOL)

You sound way more human!

#15 lore raw

PATCH 13/13 libxfs: use all log item headers from the kernel

In reply to Christoph Hellwig

Wire up all the xfs_*_item.h headers from the kernel instead of duplicating the definitions.

---
 db/logformat.c                           |   4 +
 include/atomic.h                         |   1 +
 include/libxfs.h                         |   1 -
 libxfs/Makefile                          |  10 ++-
 libxfs/defer_item.c                      |   3 +-
 libxfs/defer_item.h                      |  56 -------------
 libxfs/iunlink.c                         |  10 +--
 libxfs/stubs/xfs_inode.h                 |   8 ++
 libxfs/trans.c                           |  12 +++
 libxfs/xfs_alloc.c                       |   2 +-
 libxfs/xfs_attr.c                        |   2 +-
 libxfs/xfs_attr_item.h                   |  64 +++++++++++++++
 libxfs/xfs_bmap.c                        |   2 +-
 libxfs/xfs_bmap_item.h                   |  78 ++++++++++++++++++
 libxfs/xfs_exchmaps.c                    |   2 +-
 libxfs/xfs_exchmaps_item.h               |  64 +++++++++++++++
 libxfs/xfs_extfree_item.h                | 100 +++++++++++++++++++++++
 libxfs/xfs_ialloc.c                      |   1 +
 libxfs/xfs_icreate_item.h                |  22 +++++
 libxfs/xfs_inode_util.c                  |   3 +-
 libxfs/{iunlink.h => xfs_iunlink_item.h} |  17 ++--
 libxfs/xfs_parent.c                      |   2 +-
 libxfs/xfs_platform.h                    |   1 -
 libxfs/xfs_refcount.c                    |   2 +-
 libxfs/xfs_refcount_item.h               |  82 +++++++++++++++++++
 libxfs/xfs_rmap.c                        |   2 +-
 libxfs/xfs_rmap_item.h                   |  81 ++++++++++++++++++
 libxfs/xfs_trans_resv.c                  |   7 +-
 28 files changed, 551 insertions(+), 88 deletions(-)
 delete mode 100644 libxfs/defer_item.h
 create mode 100644 libxfs/xfs_attr_item.h
 create mode 100644 libxfs/xfs_bmap_item.h
 create mode 100644 libxfs/xfs_exchmaps_item.h
 create mode 100644 libxfs/xfs_extfree_item.h
 create mode 100644 libxfs/xfs_icreate_item.h
 rename libxfs/{iunlink.h => xfs_iunlink_item.h} (61%)
 create mode 100644 libxfs/xfs_refcount_item.h
 create mode 100644 libxfs/xfs_rmap_item.h
db/logformat.c +4 -0
index aba5b0b1b050..5d3d818d5575 100644
@@ -10,6 +10,10 @@
 #include "output.h"
 #include "libxlog.h"
 #include "logformat.h"
+#include "xfs_extfree_item.h"
+#include "xfs_bmap_item.h"
+#include "xfs_rmap_item.h"
+#include "xfs_refcount_item.h"
 
 #define MAX_LSUNIT	256 * 1024	/* max log buf. size */
 
include/atomic.h +1 -0
index 3b7eabd0faa7..ee2161fdf9cc 100644
@@ -18,6 +18,7 @@
 #include <urcu/uatomic.h>
 #include "spinlock.h"
 
+typedef	int32_t	refcount_t;
 typedef	int32_t	atomic_t;
 typedef	int64_t	atomic64_t;
 
include/libxfs.h +0 -1
index 549176cf0b2c..e28b79d80143 100644
@@ -105,7 +105,6 @@ struct iomap;
 #include "xfs_rtbitmap.h"
 #include "xfs_rtrmap_btree.h"
 #include "xfs_ag_resv.h"
-#include "defer_item.h"
 
 #ifndef ARRAY_SIZE
 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
libxfs/Makefile +8 -2
index c655d092d79e..c0d8d03878f5 100644
@@ -20,12 +20,10 @@ PKGHFILES = xfs_fs.h \
 	xfs_log_format.h
 
 HFILES = \
-	defer_item.h \
 	libxfs_io.h \
 	libxfs_api_defs.h \
 	listxattr.h \
 	init.h \
-	iunlink.h \
 	xfs_platform.h \
 	linux-err.h \
 	topology.h \
@@ -35,10 +33,12 @@ HFILES = \
 	xfs_alloc.h \
 	xfs_alloc_btree.h \
 	xfs_attr_leaf.h \
+	xfs_attr_item.h \
 	xfs_attr_sf.h \
 	xfs_bit.h \
 	xfs_buf_item.h \
 	xfs_bmap.h \
+	xfs_bmap_item.h \
 	xfs_bmap_btree.h \
 	xfs_btree.h \
 	xfs_btree_mem.h \
@@ -50,13 +50,17 @@ HFILES = \
 	xfs_dir2_priv.h \
 	xfs_errortag.h \
 	xfs_exchmaps.h \
+	xfs_exchmaps_item.h \
+	xfs_extfree_item.h \
 	xfs_group.h \
 	xfs_ialloc.h \
 	xfs_ialloc_btree.h \
+	xfs_icreate_item.h \
 	xfs_inode_buf.h \
 	xfs_inode_fork.h \
 	xfs_inode_item.h \
 	xfs_inode_util.h \
+	xfs_iunlink_item.h \
 	xfs_log_recover.h \
 	xfs_metadir.h \
 	xfs_metafile.h \
@@ -64,9 +68,11 @@ HFILES = \
 	xfs_quota_defs.h \
 	xfs_refcount.h \
 	xfs_refcount_btree.h \
+	xfs_refcount_item.h \
 	xfs_rtrefcount_btree.h \
 	xfs_rmap.h \
 	xfs_rmap_btree.h \
+	xfs_rmap_item.h \
 	xfs_rtbitmap.h \
 	xfs_rtgroup.h \
 	xfs_rtrmap_btree.h \
libxfs/defer_item.c +1 -2
index fada5b6db2a6..72d79b10d820 100644
@@ -25,12 +25,11 @@
 #include "xfs_da_btree.h"
 #include "xfs_attr.h"
 #include "libxfs.h"
-#include "defer_item.h"
 #include "xfs_ag.h"
 #include "xfs_exchmaps.h"
-#include "defer_item.h"
 #include "xfs_group.h"
 #include "xfs_rtgroup.h"
+#include "xfs_attr_item.h"
 
 /* Dummy defer item ops, since we don't do logging. */
 
libxfs/defer_item.h deleted +0 -56

56 lines not on this page · raw message

libxfs/iunlink.c +1 -9
index 875e0caae988..8008c24a87a5 100644
@@ -17,17 +17,9 @@
 #include "xfs_inode.h"
 #include "xfs_trans.h"
 #include "xfs_ag.h"
-#include "iunlink.h"
+#include "xfs_iunlink_item.h"
 #include "xfs_trace.h"
 
-/* in memory log item structure */
-struct xfs_iunlink_item {
-	struct xfs_inode	*ip;
-	struct xfs_perag	*pag;
-	xfs_agino_t		next_agino;
-	xfs_agino_t		old_agino;
-};
-
 /*
  * Look up the inode cluster buffer and log the on-disk unlinked inode change
  * we need to make.
libxfs/stubs/xfs_inode.h +8 -0
index 0292beecf903..e6cfdd22c323 100644
@@ -442,4 +442,12 @@ extern void	libxfs_irele(struct xfs_inode *ip);
 #define xfs_inherit_nosymlinks		(false)
 #define xfs_inherit_nodefrag		(false)
 
+static inline struct xfs_inode *
+xfs_iunlink_lookup(struct xfs_perag *pag, xfs_agino_t agino)
+{
+	return NULL;
+}
+int xfs_iunlink_reload_next(struct xfs_trans *tp, struct xfs_buf *agibp,
+		xfs_agino_t prev_agino, xfs_agino_t next_agino);
+
 #endif /* __XFS_INODE_H__ */
libxfs/trans.c +12 -0
index 8db8ba9ac670..f64a7ea11742 100644
@@ -1316,3 +1316,15 @@ out_blocks:
 
 	return error;
 }
+
+void
+xfs_icreate_log(
+	struct xfs_trans	*tp,
+	xfs_agnumber_t		agno,
+	xfs_agblock_t		agbno,
+	unsigned int		count,
+	unsigned int		inode_size,
+	xfs_agblock_t		length,
+	unsigned int		generation)
+{
+}
libxfs/xfs_alloc.c +1 -1
index 8feaa0edace1..d99602bcc16f 100644
@@ -27,7 +27,7 @@
 #include "xfs_ag_resv.h"
 #include "xfs_bmap.h"
 #include "xfs_health.h"
-#include "defer_item.h"
+#include "xfs_extfree_item.h"
 
 struct kmem_cache	*xfs_extfree_item_cache;
 
libxfs/xfs_attr.c +1 -1
index 57a0a175c286..aaf1f9f83c20 100644
@@ -24,7 +24,7 @@
 #include "xfs_quota.h"
 #include "xfs_trans_space.h"
 #include "xfs_trace.h"
-#include "defer_item.h"
+#include "xfs_attr_item.h"
 #include "xfs_parent.h"
 
 struct kmem_cache		*xfs_attr_intent_cache;
libxfs/xfs_attr_item.h new file +64 -0

64 lines not on this page · raw message

libxfs/xfs_bmap.c +1 -1
index 18308d65f92d..148d036bab67 100644
@@ -33,7 +33,7 @@
 #include "xfs_ag_resv.h"
 #include "xfs_refcount.h"
 #include "xfs_health.h"
-#include "defer_item.h"
+#include "xfs_bmap_item.h"
 #include "xfs_symlink_remote.h"
 #include "xfs_inode_util.h"
 #include "xfs_rtgroup.h"
libxfs/xfs_bmap_item.h new file +78 -0

78 lines not on this page · raw message

libxfs/xfs_exchmaps.c +1 -1
index 7d6f949aa1f3..114463c101d6 100644
@@ -22,7 +22,7 @@
 #include "xfs_error.h"
 #include "xfs_errortag.h"
 #include "xfs_health.h"
-#include "defer_item.h"
+#include "xfs_exchmaps_item.h"
 #include "xfs_da_format.h"
 #include "xfs_da_btree.h"
 #include "xfs_attr_leaf.h"
libxfs/xfs_exchmaps_item.h new file +64 -0

64 lines not on this page · raw message

libxfs/xfs_extfree_item.h new file +100 -0

100 lines not on this page · raw message

libxfs/xfs_ialloc.c +1 -0
index 91f4cdf2e4f3..a064289e1634 100644
@@ -20,6 +20,7 @@
 #include "xfs_error.h"
 #include "xfs_bmap.h"
 #include "xfs_trans.h"
+#include "xfs_icreate_item.h"
 #include "xfs_buf_item.h"
 #include "xfs_trace.h"
 #include "xfs_log.h"
libxfs/xfs_icreate_item.h new file +22 -0
new file mode 100644
index 000000000000..64992823108a
@@ -0,0 +1,22 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2008-2010, Dave Chinner
+ * All Rights Reserved.
+ */
+#ifndef XFS_ICREATE_ITEM_H
+#define XFS_ICREATE_ITEM_H	1
+
+/* in memory log item structure */
+struct xfs_icreate_item {
+	struct xfs_log_item	ic_item;
+	struct xfs_icreate_log	ic_format;
+};
+
+extern struct kmem_cache *xfs_icreate_cache;	/* inode create item */
+
+void xfs_icreate_log(struct xfs_trans *tp, xfs_agnumber_t agno,
+			xfs_agblock_t agbno, unsigned int count,
+			unsigned int inode_size, xfs_agblock_t length,
+			unsigned int generation);
+
+#endif	/* XFS_ICREATE_ITEM_H */
libxfs/xfs_inode_util.c +1 -2
index b4f556df64ed..16c4c2ccdbb8 100644
@@ -20,8 +20,7 @@
 #include "xfs_error.h"
 #include "xfs_trace.h"
 #include "xfs_ag.h"
-#include "xfs_inode_item.h"
-#include "iunlink.h"
+#include "xfs_iunlink_item.h"
 #include "xfs_inode_item.h"
 
 uint16_t
libxfs/xfs_iunlink_item.h renamed from libxfs/iunlink.h +10 -7
similarity index 61%
rename from libxfs/iunlink.h
rename to libxfs/xfs_iunlink_item.h
index 8d8032cf9326..c793cdcaccde 100644
@@ -10,15 +10,18 @@ struct xfs_trans;
 struct xfs_inode;
 struct xfs_perag;
 
-static inline struct xfs_inode *
-xfs_iunlink_lookup(struct xfs_perag *pag, xfs_agino_t agino)
-{
-	return NULL;
-}
+/* in memory log item structure */
+struct xfs_iunlink_item {
+	struct xfs_log_item	item;
+	struct xfs_inode	*ip;
+	struct xfs_perag	*pag;
+	xfs_agino_t		next_agino;
+	xfs_agino_t		old_agino;
+};
+
+extern struct kmem_cache *xfs_iunlink_cache;
 
 int xfs_iunlink_log_inode(struct xfs_trans *tp, struct xfs_inode *ip,
 			struct xfs_perag *pag, xfs_agino_t next_agino);
-int xfs_iunlink_reload_next(struct xfs_trans *tp, struct xfs_buf *agibp,
-		xfs_agino_t prev_agino, xfs_agino_t next_agino);
 
 #endif	/* XFS_IUNLINK_ITEM_H */
libxfs/xfs_parent.c +1 -1
index 9420d8089e8c..992263f810f8 100644
@@ -25,7 +25,7 @@
 #include "xfs_defer.h"
 #include "xfs_parent.h"
 #include "xfs_trans_space.h"
-#include "defer_item.h"
+#include "xfs_attr_item.h"
 #include "xfs_health.h"
 #include "xfs_attr_leaf.h"
 
libxfs/xfs_platform.h +0 -1
index 4b0069fd70d7..4f4990a20dad 100644
@@ -350,7 +350,6 @@ xfs_buf_readahead(
 #define uuid_copy(s,d)		platform_uuid_copy((s),(d))
 #define uuid_equal(s,d)		(platform_uuid_compare((s),(d)) == 0)
 
-#define xfs_icreate_log(tp, agno, agbno, cnt, isize, len, gen) ((void) 0)
 #define xfs_sb_validate_fsb_count(sbp, nblks)		(0)
 #define xlog_calc_iovec_len(len)		roundup(len, sizeof(uint32_t))
 
libxfs/xfs_refcount.c +1 -1
index 3615f747f82a..6b67308fa594 100644
@@ -24,7 +24,7 @@
 #include "xfs_rmap.h"
 #include "xfs_ag.h"
 #include "xfs_health.h"
-#include "defer_item.h"
+#include "xfs_refcount_item.h"
 #include "xfs_rtgroup.h"
 #include "xfs_rtrefcount_btree.h"
 
libxfs/xfs_refcount_item.h new file +82 -0

82 lines not on this page · raw message

libxfs/xfs_rmap.c +1 -1
index 74600c99172d..34d218de21a9 100644
@@ -24,7 +24,7 @@
 #include "xfs_inode.h"
 #include "xfs_ag.h"
 #include "xfs_health.h"
-#include "defer_item.h"
+#include "xfs_rmap_item.h"
 #include "xfs_rtgroup.h"
 #include "xfs_rtrmap_btree.h"
 
libxfs/xfs_rmap_item.h new file +81 -0

81 lines not on this page · raw message

libxfs/xfs_trans_resv.c +6 -1
index d15ca0427584..3a87ab154bb5 100644
@@ -19,9 +19,14 @@
 #include "xfs_trans.h"
 #include "xfs_trans_space.h"
 #include "xfs_rtbitmap.h"
+#include "xfs_attr_item.h"
 #include "xfs_log.h"
+#include "xfs_defer.h"
+#include "xfs_bmap_item.h"
+#include "xfs_extfree_item.h"
+#include "xfs_rmap_item.h"
+#include "xfs_refcount_item.h"
 #include "xfs_trace.h"
-#include "defer_item.h"
 
 #define _ALLOC	true
 #define _FREE	false
Signature · 1 line
2.53.0
Reviewed-by
#16 lore raw
In reply to Christoph Hellwig
Quoted 5 lines · Christoph Hellwig

Hi all,

this series cleans up libxfs to further reduce the difference to the kernel version, and to reuse xfs_trans.h and the various log item headers that my kernel series moved to libxfs.

This looks fine to me, though same as the previous patchset I'll let Carlos and Andrey figure out which libxfsification they want to merge.

Quoted 2 lines

Note that in this series, it uses the Linux 7.2 versions of the kernel headers as libxfs hasn't been resynced with 7.3 yet.

https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfsprogs-dev.git/log/?h=libxfs-7.3-sync_2026-09-20

--D