* [PATCH 1/8] include: fix LIBHFILES in Makefile
2026-09-10 13:28 reduce libxfs divergence from the kernel Christoph Hellwig
@ 2026-09-10 13:28 ` Christoph Hellwig
2026-09-10 13:28 ` [PATCH 2/8] libxfs: remove a spurious xfs.h include in xfs_zones.c Christoph Hellwig
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Christoph Hellwig @ 2026-09-10 13:28 UTC (permalink / raw)
To: Andrey Albershteyn; +Cc: linux-xfs
Remove a whole bunch of files that moves to libxfs/. Al but one are
already handled there, but add the missing xfs_log_recover.h.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
include/Makefile | 4 ----
libxfs/Makefile | 1 +
2 files changed, 1 insertion(+), 4 deletions(-)
diff --git a/include/Makefile b/include/Makefile
index f7c40a5ce1a1..a4f0c365db12 100644
--- a/include/Makefile
+++ b/include/Makefile
@@ -18,12 +18,8 @@ LIBHFILES = libxfs.h \
parent.h \
spinlock.h \
xfs_inode.h \
- xfs_log_recover.h \
xfs_metadump.h \
xfs_mount.h \
- xfs_quota_defs.h \
- xfs_sb.h \
- xfs_shared.h \
xfs_trace.h \
xfs_trans.h \
command.h \
diff --git a/libxfs/Makefile b/libxfs/Makefile
index 83c8592e5fe5..bd6b8f54d2ae 100644
--- a/libxfs/Makefile
+++ b/libxfs/Makefile
@@ -55,6 +55,7 @@ HFILES = \
xfs_inode_buf.h \
xfs_inode_fork.h \
xfs_inode_util.h \
+ xfs_log_recover.h \
xfs_metadir.h \
xfs_metafile.h \
xfs_parent.h \
--
2.53.0
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH 2/8] libxfs: remove a spurious xfs.h include in xfs_zones.c
2026-09-10 13:28 reduce libxfs divergence from the kernel Christoph Hellwig
2026-09-10 13:28 ` [PATCH 1/8] include: fix LIBHFILES in Makefile Christoph Hellwig
@ 2026-09-10 13:28 ` Christoph Hellwig
2026-09-10 13:28 ` [PATCH 3/8] libxfs: move a few xfs_health.h includes Christoph Hellwig
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Christoph Hellwig @ 2026-09-10 13:28 UTC (permalink / raw)
To: Andrey Albershteyn; +Cc: linux-xfs
This fully resyncs with the kernel version.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
libxfs/xfs_zones.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/libxfs/xfs_zones.c b/libxfs/xfs_zones.c
index 4f9820dc5419..24e350c31933 100644
--- a/libxfs/xfs_zones.c
+++ b/libxfs/xfs_zones.c
@@ -4,7 +4,6 @@
* Copyright (c) 2024-2025, Western Digital Corporation or its affiliates.
*/
#include "xfs_platform.h"
-#include "xfs.h"
#include "xfs_fs.h"
#include "xfs_shared.h"
#include "xfs_format.h"
--
2.53.0
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH 3/8] libxfs: move a few xfs_health.h includes
2026-09-10 13:28 reduce libxfs divergence from the kernel Christoph Hellwig
2026-09-10 13:28 ` [PATCH 1/8] include: fix LIBHFILES in Makefile Christoph Hellwig
2026-09-10 13:28 ` [PATCH 2/8] libxfs: remove a spurious xfs.h include in xfs_zones.c Christoph Hellwig
@ 2026-09-10 13:28 ` Christoph Hellwig
2026-09-10 13:28 ` [PATCH 4/8] libxfs: find a better location for stub headers Christoph Hellwig
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Christoph Hellwig @ 2026-09-10 13:28 UTC (permalink / raw)
To: Andrey Albershteyn; +Cc: linux-xfs
Reduction of spurious differences to the kernel version of these files.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
libxfs/xfs_alloc_btree.c | 2 +-
libxfs/xfs_ialloc_btree.c | 2 +-
libxfs/xfs_refcount_btree.c | 2 +-
libxfs/xfs_rmap_btree.c | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/libxfs/xfs_alloc_btree.c b/libxfs/xfs_alloc_btree.c
index 54f0ff75a238..f62565bb55a1 100644
--- a/libxfs/xfs_alloc_btree.c
+++ b/libxfs/xfs_alloc_btree.c
@@ -14,10 +14,10 @@
#include "xfs_btree_staging.h"
#include "xfs_alloc_btree.h"
#include "xfs_alloc.h"
+#include "xfs_health.h"
#include "xfs_trace.h"
#include "xfs_trans.h"
#include "xfs_ag.h"
-#include "xfs_health.h"
static struct kmem_cache *xfs_allocbt_cur_cache;
diff --git a/libxfs/xfs_ialloc_btree.c b/libxfs/xfs_ialloc_btree.c
index e0d886f324d8..85b24b8449c7 100644
--- a/libxfs/xfs_ialloc_btree.c
+++ b/libxfs/xfs_ialloc_btree.c
@@ -16,11 +16,11 @@
#include "xfs_ialloc.h"
#include "xfs_ialloc_btree.h"
#include "xfs_alloc.h"
+#include "xfs_health.h"
#include "xfs_trace.h"
#include "xfs_trans.h"
#include "xfs_rmap.h"
#include "xfs_ag.h"
-#include "xfs_health.h"
static struct kmem_cache *xfs_inobt_cur_cache;
diff --git a/libxfs/xfs_refcount_btree.c b/libxfs/xfs_refcount_btree.c
index 5a39dbbc635c..6738a68ffa49 100644
--- a/libxfs/xfs_refcount_btree.c
+++ b/libxfs/xfs_refcount_btree.c
@@ -15,12 +15,12 @@
#include "xfs_refcount_btree.h"
#include "xfs_refcount.h"
#include "xfs_alloc.h"
+#include "xfs_health.h"
#include "xfs_trace.h"
#include "xfs_trans.h"
#include "xfs_bit.h"
#include "xfs_rmap.h"
#include "xfs_ag.h"
-#include "xfs_health.h"
static struct kmem_cache *xfs_refcountbt_cur_cache;
diff --git a/libxfs/xfs_rmap_btree.c b/libxfs/xfs_rmap_btree.c
index c39faa4aac6c..f63d2df45070 100644
--- a/libxfs/xfs_rmap_btree.c
+++ b/libxfs/xfs_rmap_btree.c
@@ -16,10 +16,10 @@
#include "xfs_btree_staging.h"
#include "xfs_rmap.h"
#include "xfs_rmap_btree.h"
+#include "xfs_health.h"
#include "xfs_trace.h"
#include "xfs_ag.h"
#include "xfs_ag_resv.h"
-#include "xfs_health.h"
#include "xfile.h"
#include "buf_mem.h"
#include "xfs_btree_mem.h"
--
2.53.0
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH 4/8] libxfs: find a better location for stub headers
2026-09-10 13:28 reduce libxfs divergence from the kernel Christoph Hellwig
` (2 preceding siblings ...)
2026-09-10 13:28 ` [PATCH 3/8] libxfs: move a few xfs_health.h includes Christoph Hellwig
@ 2026-09-10 13:28 ` Christoph Hellwig
2026-09-10 13:28 ` [PATCH 5/8] libxfs: rename buf_mem.h to xfs_buf_mem.h Christoph Hellwig
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Christoph Hellwig @ 2026-09-10 13:28 UTC (permalink / raw)
To: Andrey Albershteyn; +Cc: linux-xfs
include/ currently has a few headers that files from fs/xfs/ in the kernel
with the same name. We'll add a lot more of them, so move them to a
place not easily confused with public headers and clearly in the libxfs
realm by adding a libxfs/stubs/ directory.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
include/Makefile | 4 ----
include/builddefs.in | 3 ++-
libxfs/Makefile | 6 +++++-
{include => libxfs/stubs}/xfs_inode.h | 0
{include => libxfs/stubs}/xfs_mount.h | 0
{include => libxfs/stubs}/xfs_trace.h | 0
{include => libxfs/stubs}/xfs_trans.h | 0
7 files changed, 7 insertions(+), 6 deletions(-)
rename {include => libxfs/stubs}/xfs_inode.h (100%)
rename {include => libxfs/stubs}/xfs_mount.h (100%)
rename {include => libxfs/stubs}/xfs_trace.h (100%)
rename {include => libxfs/stubs}/xfs_trans.h (100%)
diff --git a/include/Makefile b/include/Makefile
index a4f0c365db12..90614554b7bb 100644
--- a/include/Makefile
+++ b/include/Makefile
@@ -17,11 +17,7 @@ LIBHFILES = libxfs.h \
list.h \
parent.h \
spinlock.h \
- xfs_inode.h \
xfs_metadump.h \
- xfs_mount.h \
- xfs_trace.h \
- xfs_trans.h \
command.h \
input.h \
platform_defs.h
diff --git a/include/builddefs.in b/include/builddefs.in
index 3b52d1afd703..c8e0e0ae69e8 100644
--- a/include/builddefs.in
+++ b/include/builddefs.in
@@ -179,7 +179,8 @@ endif
GCFLAGS = $(DEBUG) \
-DVERSION=\"$(PKG_VERSION)\" -DLOCALEDIR=\"$(PKG_LOCALE_DIR)\" \
- -DPACKAGE=\"$(PKG_NAME)\" -I$(TOPDIR)/include -I$(TOPDIR)/libxfs \
+ -DPACKAGE=\"$(PKG_NAME)\" -I$(TOPDIR)/include \
+ -I$(TOPDIR)/libxfs/stubs -I$(TOPDIR)/libxfs \
-I$(TOPDIR)
ifeq ($(ENABLE_GETTEXT),yes)
diff --git a/libxfs/Makefile b/libxfs/Makefile
index bd6b8f54d2ae..24ff07e961aa 100644
--- a/libxfs/Makefile
+++ b/libxfs/Makefile
@@ -73,7 +73,11 @@ HFILES = \
xfs_trans_resv.h \
xfs_trans_space.h \
xfs_dir2_priv.h \
- xfs_zones.h
+ xfs_zones.h \
+ stubs/xfs_inode.h \
+ stubs/xfs_mount.h \
+ stubs/xfs_trace.h \
+ stubs/xfs_trans.h
CFILES = buf_mem.c \
cache.c \
diff --git a/include/xfs_inode.h b/libxfs/stubs/xfs_inode.h
similarity index 100%
rename from include/xfs_inode.h
rename to libxfs/stubs/xfs_inode.h
diff --git a/include/xfs_mount.h b/libxfs/stubs/xfs_mount.h
similarity index 100%
rename from include/xfs_mount.h
rename to libxfs/stubs/xfs_mount.h
diff --git a/include/xfs_trace.h b/libxfs/stubs/xfs_trace.h
similarity index 100%
rename from include/xfs_trace.h
rename to libxfs/stubs/xfs_trace.h
diff --git a/include/xfs_trans.h b/libxfs/stubs/xfs_trans.h
similarity index 100%
rename from include/xfs_trans.h
rename to libxfs/stubs/xfs_trans.h
--
2.53.0
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH 5/8] libxfs: rename buf_mem.h to xfs_buf_mem.h
2026-09-10 13:28 reduce libxfs divergence from the kernel Christoph Hellwig
` (3 preceding siblings ...)
2026-09-10 13:28 ` [PATCH 4/8] libxfs: find a better location for stub headers Christoph Hellwig
@ 2026-09-10 13:28 ` Christoph Hellwig
2026-09-10 13:28 ` [PATCH 6/8] libxfs: provide xfs_error.h Christoph Hellwig
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Christoph Hellwig @ 2026-09-10 13:28 UTC (permalink / raw)
To: Andrey Albershteyn; +Cc: linux-xfs
Give the file the same name as in the kernel to avoid spurious include
differences. Also include xfile.h as in the kernel to avoid further
spurious differences.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
include/libxfs.h | 3 +--
libxfs/Makefile | 2 +-
libxfs/buf_mem.c | 3 +--
libxfs/init.c | 3 +--
libxfs/rdwr.c | 3 +--
libxfs/{buf_mem.h => stubs/xfs_buf_mem.h} | 2 ++
libxfs/xfs_btree.c | 3 +--
libxfs/xfs_btree_mem.c | 3 +--
libxfs/xfs_rmap_btree.c | 3 +--
libxfs/xfs_rtrmap_btree.c | 3 +--
10 files changed, 11 insertions(+), 17 deletions(-)
rename libxfs/{buf_mem.h => stubs/xfs_buf_mem.h} (97%)
diff --git a/include/libxfs.h b/include/libxfs.h
index 68d1f351f700..7f0c22ef4991 100644
--- a/include/libxfs.h
+++ b/include/libxfs.h
@@ -92,8 +92,7 @@ struct iomap;
#include "xfs_btree_staging.h"
#include "xfs_rtbitmap.h"
#include "xfs_symlink_remote.h"
-#include "libxfs/xfile.h"
-#include "libxfs/buf_mem.h"
+#include "xfs_buf_mem.h"
#include "xfs_btree_mem.h"
#include "xfs_parent.h"
#include "xfs_ag_resv.h"
diff --git a/libxfs/Makefile b/libxfs/Makefile
index 24ff07e961aa..7af5db81b0c3 100644
--- a/libxfs/Makefile
+++ b/libxfs/Makefile
@@ -29,7 +29,6 @@ HFILES = \
xfs_platform.h \
linux-err.h \
topology.h \
- buf_mem.h \
xfblob.h \
xfile.h \
xfs_ag_resv.h \
@@ -74,6 +73,7 @@ HFILES = \
xfs_trans_space.h \
xfs_dir2_priv.h \
xfs_zones.h \
+ stubs/xfs_buf_mem.h \
stubs/xfs_inode.h \
stubs/xfs_mount.h \
stubs/xfs_trace.h \
diff --git a/libxfs/buf_mem.c b/libxfs/buf_mem.c
index 15c61966db43..3c8452de9689 100644
--- a/libxfs/buf_mem.c
+++ b/libxfs/buf_mem.c
@@ -5,8 +5,7 @@
*/
#include "xfs_platform.h"
#include "libxfs.h"
-#include "libxfs/xfile.h"
-#include "libxfs/buf_mem.h"
+#include "xfs_buf_mem.h"
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/wait.h>
diff --git a/libxfs/init.c b/libxfs/init.c
index 5d8b4a153e28..b89c9fe360d4 100644
--- a/libxfs/init.c
+++ b/libxfs/init.c
@@ -22,10 +22,9 @@
#include "xfs_rmap_btree.h"
#include "xfs_refcount_btree.h"
#include "xfs_metafile.h"
+#include "xfs_buf_mem.h"
#include "libfrog/platform.h"
#include "libfrog/util.h"
-#include "libxfs/xfile.h"
-#include "libxfs/buf_mem.h"
#include "xfs_format.h"
#include "xfs_da_format.h"
diff --git a/libxfs/rdwr.c b/libxfs/rdwr.c
index 6c57bedef548..90f2d56687ca 100644
--- a/libxfs/rdwr.c
+++ b/libxfs/rdwr.c
@@ -17,9 +17,8 @@
#include "xfs_inode_fork.h"
#include "xfs_inode.h"
#include "xfs_trans.h"
+#include "xfs_buf_mem.h"
#include "libfrog/platform.h"
-#include "libxfs/xfile.h"
-#include "libxfs/buf_mem.h"
#include "libxfs.h"
static void libxfs_brelse(struct cache_node *node);
diff --git a/libxfs/buf_mem.h b/libxfs/stubs/xfs_buf_mem.h
similarity index 97%
rename from libxfs/buf_mem.h
rename to libxfs/stubs/xfs_buf_mem.h
index 6e4b2d3503b8..98564e67d5bd 100644
--- a/libxfs/buf_mem.h
+++ b/libxfs/stubs/xfs_buf_mem.h
@@ -6,6 +6,8 @@
#ifndef __XFS_BUF_MEM_H__
#define __XFS_BUF_MEM_H__
+#include "xfile.h"
+
extern unsigned int XMBUF_BLOCKSIZE;
extern unsigned int XMBUF_BLOCKSHIFT;
diff --git a/libxfs/xfs_btree.c b/libxfs/xfs_btree.c
index ec77f325aab6..fe565b84903c 100644
--- a/libxfs/xfs_btree.c
+++ b/libxfs/xfs_btree.c
@@ -25,8 +25,7 @@
#include "xfs_rmap_btree.h"
#include "xfs_refcount_btree.h"
#include "xfs_health.h"
-#include "xfile.h"
-#include "buf_mem.h"
+#include "xfs_buf_mem.h"
#include "xfs_btree_mem.h"
#include "xfs_rtrmap_btree.h"
#include "xfs_bmap.h"
diff --git a/libxfs/xfs_btree_mem.c b/libxfs/xfs_btree_mem.c
index 5fa4a9787c99..d65be63df88c 100644
--- a/libxfs/xfs_btree_mem.c
+++ b/libxfs/xfs_btree_mem.c
@@ -12,8 +12,7 @@
#include "xfs_mount.h"
#include "xfs_trans.h"
#include "xfs_btree.h"
-#include "xfile.h"
-#include "buf_mem.h"
+#include "xfs_buf_mem.h"
#include "xfs_btree_mem.h"
#include "xfs_ag.h"
#include "xfs_trace.h"
diff --git a/libxfs/xfs_rmap_btree.c b/libxfs/xfs_rmap_btree.c
index f63d2df45070..98b16dc83f84 100644
--- a/libxfs/xfs_rmap_btree.c
+++ b/libxfs/xfs_rmap_btree.c
@@ -20,8 +20,7 @@
#include "xfs_trace.h"
#include "xfs_ag.h"
#include "xfs_ag_resv.h"
-#include "xfile.h"
-#include "buf_mem.h"
+#include "xfs_buf_mem.h"
#include "xfs_btree_mem.h"
static struct kmem_cache *xfs_rmapbt_cur_cache;
diff --git a/libxfs/xfs_rtrmap_btree.c b/libxfs/xfs_rtrmap_btree.c
index 7fbe6c19c454..091221743b8a 100644
--- a/libxfs/xfs_rtrmap_btree.c
+++ b/libxfs/xfs_rtrmap_btree.c
@@ -26,8 +26,7 @@
#include "xfs_rtgroup.h"
#include "xfs_bmap.h"
#include "xfs_health.h"
-#include "xfile.h"
-#include "buf_mem.h"
+#include "xfs_buf_mem.h"
#include "xfs_btree_mem.h"
static struct kmem_cache *xfs_rtrmapbt_cur_cache;
--
2.53.0
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH 6/8] libxfs: provide xfs_error.h
2026-09-10 13:28 reduce libxfs divergence from the kernel Christoph Hellwig
` (4 preceding siblings ...)
2026-09-10 13:28 ` [PATCH 5/8] libxfs: rename buf_mem.h to xfs_buf_mem.h Christoph Hellwig
@ 2026-09-10 13:28 ` Christoph Hellwig
2026-09-10 13:28 ` [PATCH 7/8] libxfs: provide xfs_extent_busy.h Christoph Hellwig
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Christoph Hellwig @ 2026-09-10 13:28 UTC (permalink / raw)
To: Andrey Albershteyn; +Cc: linux-xfs
This removes a lot of divergence in the include statements compared to the
kernel version.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
libxfs/Makefile | 1 +
libxfs/defer_item.c | 1 +
libxfs/stubs/xfs_error.h | 34 ++++++++++++++++++++++++++++++++++
libxfs/xfs_ag.c | 1 +
libxfs/xfs_ag_resv.c | 1 +
libxfs/xfs_alloc.c | 1 +
libxfs/xfs_alloc_btree.c | 1 +
libxfs/xfs_attr_leaf.c | 1 +
libxfs/xfs_attr_remote.c | 1 +
libxfs/xfs_bmap.c | 1 +
libxfs/xfs_bmap_btree.c | 1 +
libxfs/xfs_btree.c | 1 +
libxfs/xfs_btree_mem.c | 1 +
libxfs/xfs_da_btree.c | 2 ++
libxfs/xfs_dir2.c | 1 +
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_dquot_buf.c | 1 +
libxfs/xfs_exchmaps.c | 1 +
libxfs/xfs_group.c | 1 +
libxfs/xfs_ialloc.c | 1 +
libxfs/xfs_ialloc_btree.c | 1 +
libxfs/xfs_inode_buf.c | 1 +
libxfs/xfs_inode_fork.c | 1 +
libxfs/xfs_inode_util.c | 1 +
libxfs/xfs_metadir.c | 1 +
libxfs/xfs_metafile.c | 1 +
libxfs/xfs_parent.c | 1 +
libxfs/xfs_platform.h | 27 ---------------------------
libxfs/xfs_refcount.c | 1 +
libxfs/xfs_refcount_btree.c | 1 +
libxfs/xfs_rmap.c | 1 +
libxfs/xfs_rmap_btree.c | 1 +
libxfs/xfs_rtbitmap.c | 1 +
libxfs/xfs_rtgroup.c | 1 +
libxfs/xfs_rtrefcount_btree.c | 1 +
libxfs/xfs_rtrmap_btree.c | 1 +
libxfs/xfs_sb.c | 2 +-
libxfs/xfs_symlink_remote.c | 1 +
41 files changed, 74 insertions(+), 28 deletions(-)
create mode 100644 libxfs/stubs/xfs_error.h
diff --git a/libxfs/Makefile b/libxfs/Makefile
index 7af5db81b0c3..d173a2c4b13b 100644
--- a/libxfs/Makefile
+++ b/libxfs/Makefile
@@ -74,6 +74,7 @@ HFILES = \
xfs_dir2_priv.h \
xfs_zones.h \
stubs/xfs_buf_mem.h \
+ stubs/xfs_error.h \
stubs/xfs_inode.h \
stubs/xfs_mount.h \
stubs/xfs_trace.h \
diff --git a/libxfs/defer_item.c b/libxfs/defer_item.c
index 14ee41525517..fada5b6db2a6 100644
--- a/libxfs/defer_item.c
+++ b/libxfs/defer_item.c
@@ -21,6 +21,7 @@
#include "xfs_refcount.h"
#include "xfs_bmap.h"
#include "xfs_inode.h"
+#include "xfs_error.h"
#include "xfs_da_btree.h"
#include "xfs_attr.h"
#include "libxfs.h"
diff --git a/libxfs/stubs/xfs_error.h b/libxfs/stubs/xfs_error.h
new file mode 100644
index 000000000000..94d597fced71
--- /dev/null
+++ b/libxfs/stubs/xfs_error.h
@@ -0,0 +1,34 @@
+// SPDX-License-Identifier: GPL-2.0
+#ifndef __XFS_ERROR_H__
+#define __XFS_ERROR_H__
+
+#define XFS_ERRLEVEL_LOW 1
+
+/* stop unused var warnings by assigning mp to itself */
+
+#define xfs_corruption_error(e,l,mp,b,sz,fi,ln,fa) do { \
+ (mp) = (mp); \
+ cmn_err(CE_ALERT, "%s: XFS_CORRUPTION_ERROR", (e)); \
+} while (0)
+
+#define XFS_CORRUPTION_ERROR(e, lvl, mp, buf, bufsize) do { \
+ (mp) = (mp); \
+ cmn_err(CE_ALERT, "%s: XFS_CORRUPTION_ERROR", (e)); \
+} while (0)
+
+#define XFS_ERROR_REPORT(e,l,mp) do { \
+ (mp) = (mp); \
+ cmn_err(CE_ALERT, "%s: XFS_ERROR_REPORT", (e)); \
+} while (0)
+
+#define XFS_WARN_CORRUPT(mp, expr) \
+ ( xfs_is_reporting_corruption(mp) ? \
+ (printf("%s: XFS_WARN_CORRUPT at %s:%d", #expr, \
+ __func__, __LINE__), true) : true)
+
+#define XFS_IS_CORRUPT(mp, expr) \
+ (unlikely(expr) ? XFS_WARN_CORRUPT((mp), (expr)) : false)
+
+#define XFS_TEST_ERROR(mp, expr) (false)
+
+#endif /* __XFS_ERROR_H__ */
diff --git a/libxfs/xfs_ag.c b/libxfs/xfs_ag.c
index 2f47a02cc6fd..7eeb1f24b24a 100644
--- a/libxfs/xfs_ag.c
+++ b/libxfs/xfs_ag.c
@@ -22,6 +22,7 @@
#include "xfs_ag.h"
#include "xfs_ag_resv.h"
#include "xfs_health.h"
+#include "xfs_error.h"
#include "xfs_bmap.h"
#include "xfs_defer.h"
#include "xfs_log_format.h"
diff --git a/libxfs/xfs_ag_resv.c b/libxfs/xfs_ag_resv.c
index 052d18733046..c4cdcc570d61 100644
--- a/libxfs/xfs_ag_resv.c
+++ b/libxfs/xfs_ag_resv.c
@@ -12,6 +12,7 @@
#include "xfs_mount.h"
#include "xfs_alloc.h"
#include "xfs_errortag.h"
+#include "xfs_error.h"
#include "xfs_trace.h"
#include "xfs_trans.h"
#include "xfs_rmap_btree.h"
diff --git a/libxfs/xfs_alloc.c b/libxfs/xfs_alloc.c
index 695ed830d139..cf517d4a938a 100644
--- a/libxfs/xfs_alloc.c
+++ b/libxfs/xfs_alloc.c
@@ -17,6 +17,7 @@
#include "xfs_alloc_btree.h"
#include "xfs_alloc.h"
#include "xfs_errortag.h"
+#include "xfs_error.h"
#include "xfs_trace.h"
#include "xfs_trans.h"
#include "xfs_ag.h"
diff --git a/libxfs/xfs_alloc_btree.c b/libxfs/xfs_alloc_btree.c
index f62565bb55a1..04e028194e8c 100644
--- a/libxfs/xfs_alloc_btree.c
+++ b/libxfs/xfs_alloc_btree.c
@@ -14,6 +14,7 @@
#include "xfs_btree_staging.h"
#include "xfs_alloc_btree.h"
#include "xfs_alloc.h"
+#include "xfs_error.h"
#include "xfs_health.h"
#include "xfs_trace.h"
#include "xfs_trans.h"
diff --git a/libxfs/xfs_attr_leaf.c b/libxfs/xfs_attr_leaf.c
index c621ccedaa48..0ac2ae28efa6 100644
--- a/libxfs/xfs_attr_leaf.c
+++ b/libxfs/xfs_attr_leaf.c
@@ -22,6 +22,7 @@
#include "xfs_attr.h"
#include "xfs_attr_remote.h"
#include "xfs_attr_leaf.h"
+#include "xfs_error.h"
#include "xfs_trace.h"
#include "xfs_dir2.h"
#include "xfs_ag.h"
diff --git a/libxfs/xfs_attr_remote.c b/libxfs/xfs_attr_remote.c
index 89d01aa7b051..e6c8dd1a997a 100644
--- a/libxfs/xfs_attr_remote.c
+++ b/libxfs/xfs_attr_remote.c
@@ -21,6 +21,7 @@
#include "xfs_attr.h"
#include "xfs_attr_remote.h"
#include "xfs_trace.h"
+#include "xfs_error.h"
#include "xfs_health.h"
#define ATTR_RMTVALUE_MAPSIZE 1 /* # of map entries at once */
diff --git a/libxfs/xfs_bmap.c b/libxfs/xfs_bmap.c
index 330325004106..1d3460da84ca 100644
--- a/libxfs/xfs_bmap.c
+++ b/libxfs/xfs_bmap.c
@@ -21,6 +21,7 @@
#include "xfs_bmap.h"
#include "xfs_bmap_btree.h"
#include "xfs_errortag.h"
+#include "xfs_error.h"
#include "xfs_trans_space.h"
#include "xfs_trace.h"
#include "xfs_attr_leaf.h"
diff --git a/libxfs/xfs_bmap_btree.c b/libxfs/xfs_bmap_btree.c
index a12ba6918c7b..5b82e732d3ad 100644
--- a/libxfs/xfs_bmap_btree.c
+++ b/libxfs/xfs_bmap_btree.c
@@ -18,6 +18,7 @@
#include "xfs_btree_staging.h"
#include "xfs_bmap_btree.h"
#include "xfs_bmap.h"
+#include "xfs_error.h"
#include "xfs_trace.h"
#include "xfs_rmap.h"
#include "xfs_ag.h"
diff --git a/libxfs/xfs_btree.c b/libxfs/xfs_btree.c
index fe565b84903c..3f820e7999a6 100644
--- a/libxfs/xfs_btree.c
+++ b/libxfs/xfs_btree.c
@@ -15,6 +15,7 @@
#include "xfs_trans.h"
#include "xfs_btree.h"
#include "xfs_errortag.h"
+#include "xfs_error.h"
#include "xfs_trace.h"
#include "xfs_alloc.h"
#include "xfs_btree_staging.h"
diff --git a/libxfs/xfs_btree_mem.c b/libxfs/xfs_btree_mem.c
index d65be63df88c..c2fa836a2ae2 100644
--- a/libxfs/xfs_btree_mem.c
+++ b/libxfs/xfs_btree_mem.c
@@ -12,6 +12,7 @@
#include "xfs_mount.h"
#include "xfs_trans.h"
#include "xfs_btree.h"
+#include "xfs_error.h"
#include "xfs_buf_mem.h"
#include "xfs_btree_mem.h"
#include "xfs_ag.h"
diff --git a/libxfs/xfs_da_btree.c b/libxfs/xfs_da_btree.c
index b51b10f916ab..9f25f1658b07 100644
--- a/libxfs/xfs_da_btree.c
+++ b/libxfs/xfs_da_btree.c
@@ -18,7 +18,9 @@
#include "xfs_trans.h"
#include "xfs_bmap.h"
#include "xfs_attr_leaf.h"
+#include "xfs_error.h"
#include "xfs_trace.h"
+#include "xfs_errortag.h"
#include "xfs_health.h"
/*
diff --git a/libxfs/xfs_dir2.c b/libxfs/xfs_dir2.c
index fce2d847c760..0c0402a29b6b 100644
--- a/libxfs/xfs_dir2.c
+++ b/libxfs/xfs_dir2.c
@@ -16,6 +16,7 @@
#include "xfs_dir2.h"
#include "xfs_dir2_priv.h"
#include "xfs_errortag.h"
+#include "xfs_error.h"
#include "xfs_trace.h"
#include "xfs_health.h"
#include "xfs_bmap_btree.h"
diff --git a/libxfs/xfs_dir2_block.c b/libxfs/xfs_dir2_block.c
index 29b5b158c80d..0e9dd19eafae 100644
--- a/libxfs/xfs_dir2_block.c
+++ b/libxfs/xfs_dir2_block.c
@@ -16,6 +16,7 @@
#include "xfs_bmap.h"
#include "xfs_dir2.h"
#include "xfs_dir2_priv.h"
+#include "xfs_error.h"
#include "xfs_trace.h"
#include "xfs_health.h"
diff --git a/libxfs/xfs_dir2_data.c b/libxfs/xfs_dir2_data.c
index 93540a7549ed..0fafe7826ec9 100644
--- a/libxfs/xfs_dir2_data.c
+++ b/libxfs/xfs_dir2_data.c
@@ -14,6 +14,7 @@
#include "xfs_inode.h"
#include "xfs_dir2.h"
#include "xfs_dir2_priv.h"
+#include "xfs_error.h"
#include "xfs_trans.h"
#include "xfs_health.h"
diff --git a/libxfs/xfs_dir2_leaf.c b/libxfs/xfs_dir2_leaf.c
index b89350b03b87..ea8ab6d46c6c 100644
--- a/libxfs/xfs_dir2_leaf.c
+++ b/libxfs/xfs_dir2_leaf.c
@@ -15,6 +15,7 @@
#include "xfs_bmap.h"
#include "xfs_dir2.h"
#include "xfs_dir2_priv.h"
+#include "xfs_error.h"
#include "xfs_trace.h"
#include "xfs_trans.h"
#include "xfs_health.h"
diff --git a/libxfs/xfs_dir2_node.c b/libxfs/xfs_dir2_node.c
index 97b8860be942..a0aaa21b12cf 100644
--- a/libxfs/xfs_dir2_node.c
+++ b/libxfs/xfs_dir2_node.c
@@ -15,6 +15,7 @@
#include "xfs_bmap.h"
#include "xfs_dir2.h"
#include "xfs_dir2_priv.h"
+#include "xfs_error.h"
#include "xfs_trace.h"
#include "xfs_trans.h"
#include "xfs_health.h"
diff --git a/libxfs/xfs_dquot_buf.c b/libxfs/xfs_dquot_buf.c
index 5022073e0c4a..b0cb2a2b1cc4 100644
--- a/libxfs/xfs_dquot_buf.c
+++ b/libxfs/xfs_dquot_buf.c
@@ -14,6 +14,7 @@
#include "xfs_quota_defs.h"
#include "xfs_inode.h"
#include "xfs_trans.h"
+#include "xfs_error.h"
#include "xfs_health.h"
#include "xfs_metadir.h"
#include "xfs_metafile.h"
diff --git a/libxfs/xfs_exchmaps.c b/libxfs/xfs_exchmaps.c
index 78bd421b26d5..7b9bba1d971c 100644
--- a/libxfs/xfs_exchmaps.c
+++ b/libxfs/xfs_exchmaps.c
@@ -18,6 +18,7 @@
#include "xfs_trace.h"
#include "xfs_bmap_btree.h"
#include "xfs_trans_space.h"
+#include "xfs_error.h"
#include "xfs_errortag.h"
#include "xfs_health.h"
#include "defer_item.h"
diff --git a/libxfs/xfs_group.c b/libxfs/xfs_group.c
index cb8415147509..12ce312d1e50 100644
--- a/libxfs/xfs_group.c
+++ b/libxfs/xfs_group.c
@@ -8,6 +8,7 @@
#include "xfs_format.h"
#include "xfs_trans_resv.h"
#include "xfs_mount.h"
+#include "xfs_error.h"
#include "xfs_trace.h"
#include "xfs_group.h"
diff --git a/libxfs/xfs_ialloc.c b/libxfs/xfs_ialloc.c
index f2669dc4907e..aa895c0decbc 100644
--- a/libxfs/xfs_ialloc.c
+++ b/libxfs/xfs_ialloc.c
@@ -17,6 +17,7 @@
#include "xfs_ialloc_btree.h"
#include "xfs_alloc.h"
#include "xfs_errortag.h"
+#include "xfs_error.h"
#include "xfs_bmap.h"
#include "xfs_trans.h"
#include "xfs_trace.h"
diff --git a/libxfs/xfs_ialloc_btree.c b/libxfs/xfs_ialloc_btree.c
index 85b24b8449c7..1376e8630449 100644
--- a/libxfs/xfs_ialloc_btree.c
+++ b/libxfs/xfs_ialloc_btree.c
@@ -16,6 +16,7 @@
#include "xfs_ialloc.h"
#include "xfs_ialloc_btree.h"
#include "xfs_alloc.h"
+#include "xfs_error.h"
#include "xfs_health.h"
#include "xfs_trace.h"
#include "xfs_trans.h"
diff --git a/libxfs/xfs_inode_buf.c b/libxfs/xfs_inode_buf.c
index 9990aaeef5fd..8ea12f82ad81 100644
--- a/libxfs/xfs_inode_buf.c
+++ b/libxfs/xfs_inode_buf.c
@@ -13,6 +13,7 @@
#include "xfs_ag.h"
#include "xfs_inode.h"
#include "xfs_errortag.h"
+#include "xfs_error.h"
#include "xfs_trans.h"
#include "xfs_ialloc.h"
#include "xfs_dir2.h"
diff --git a/libxfs/xfs_inode_fork.c b/libxfs/xfs_inode_fork.c
index 46699896da24..df89ae420617 100644
--- a/libxfs/xfs_inode_fork.c
+++ b/libxfs/xfs_inode_fork.c
@@ -16,6 +16,7 @@
#include "xfs_btree.h"
#include "xfs_bmap_btree.h"
#include "xfs_bmap.h"
+#include "xfs_error.h"
#include "xfs_trace.h"
#include "xfs_da_format.h"
#include "xfs_da_btree.h"
diff --git a/libxfs/xfs_inode_util.c b/libxfs/xfs_inode_util.c
index cef34004dbe7..9de455088568 100644
--- a/libxfs/xfs_inode_util.c
+++ b/libxfs/xfs_inode_util.c
@@ -17,6 +17,7 @@
#include "xfs_ialloc.h"
#include "xfs_health.h"
#include "xfs_bmap.h"
+#include "xfs_error.h"
#include "xfs_trace.h"
#include "xfs_ag.h"
#include "iunlink.h"
diff --git a/libxfs/xfs_metadir.c b/libxfs/xfs_metadir.c
index bfb261e3f72d..aecffb11a310 100644
--- a/libxfs/xfs_metadir.c
+++ b/libxfs/xfs_metadir.c
@@ -29,6 +29,7 @@
#include "xfs_parent.h"
#include "xfs_health.h"
#include "xfs_errortag.h"
+#include "xfs_error.h"
#include "xfs_btree.h"
#include "xfs_alloc.h"
diff --git a/libxfs/xfs_metafile.c b/libxfs/xfs_metafile.c
index bab5d7e29ae9..7973feb3b411 100644
--- a/libxfs/xfs_metafile.c
+++ b/libxfs/xfs_metafile.c
@@ -18,6 +18,7 @@
#include "xfs_trace.h"
#include "xfs_inode.h"
#include "xfs_errortag.h"
+#include "xfs_error.h"
#include "xfs_alloc.h"
#include "xfs_rtgroup.h"
#include "xfs_rtrmap_btree.h"
diff --git a/libxfs/xfs_parent.c b/libxfs/xfs_parent.c
index ef4061035171..9420d8089e8c 100644
--- a/libxfs/xfs_parent.c
+++ b/libxfs/xfs_parent.c
@@ -13,6 +13,7 @@
#include "xfs_mount.h"
#include "xfs_bmap_btree.h"
#include "xfs_inode.h"
+#include "xfs_error.h"
#include "xfs_trace.h"
#include "xfs_trans.h"
#include "xfs_da_btree.h"
diff --git a/libxfs/xfs_platform.h b/libxfs/xfs_platform.h
index 5cddfbb82cc8..7c62a40af458 100644
--- a/libxfs/xfs_platform.h
+++ b/libxfs/xfs_platform.h
@@ -147,39 +147,12 @@ extern char *progname;
#define xfs_mod_delalloc(a,b,c) ((void) 0)
#define xfs_mod_sb_delalloc(sb, d) ((void) 0)
-/* stop unused var warnings by assigning mp to itself */
-
-#define xfs_corruption_error(e,l,mp,b,sz,fi,ln,fa) do { \
- (mp) = (mp); \
- cmn_err(CE_ALERT, "%s: XFS_CORRUPTION_ERROR", (e)); \
-} while (0)
-
-#define XFS_CORRUPTION_ERROR(e, lvl, mp, buf, bufsize) do { \
- (mp) = (mp); \
- cmn_err(CE_ALERT, "%s: XFS_CORRUPTION_ERROR", (e)); \
-} while (0)
-
-#define XFS_ERROR_REPORT(e,l,mp) do { \
- (mp) = (mp); \
- cmn_err(CE_ALERT, "%s: XFS_ERROR_REPORT", (e)); \
-} while (0)
-
-#define XFS_WARN_CORRUPT(mp, expr) \
- ( xfs_is_reporting_corruption(mp) ? \
- (printf("%s: XFS_WARN_CORRUPT at %s:%d", #expr, \
- __func__, __LINE__), true) : true)
-
-#define XFS_IS_CORRUPT(mp, expr) \
- (unlikely(expr) ? XFS_WARN_CORRUPT((mp), (expr)) : false)
-
-#define XFS_ERRLEVEL_LOW 1
#define XFS_ILOCK_EXCL 0
#define XFS_ILOCK_SHARED 0
#define XFS_IOLOCK_EXCL 0
#define XFS_STATS_INC(mp, count) do { (mp) = (mp); } while (0)
#define XFS_STATS_DEC(mp, count) do { (mp) = (mp); } while (0)
#define XFS_STATS_ADD(mp, count, x) do { (mp) = (mp); } while (0)
-#define XFS_TEST_ERROR(a,b) (false)
#define __section(section) __attribute__((__section__(section)))
diff --git a/libxfs/xfs_refcount.c b/libxfs/xfs_refcount.c
index 1d45160789f0..3615f747f82a 100644
--- a/libxfs/xfs_refcount.c
+++ b/libxfs/xfs_refcount.c
@@ -16,6 +16,7 @@
#include "xfs_refcount_btree.h"
#include "xfs_alloc.h"
#include "xfs_errortag.h"
+#include "xfs_error.h"
#include "xfs_trace.h"
#include "xfs_trans.h"
#include "xfs_bit.h"
diff --git a/libxfs/xfs_refcount_btree.c b/libxfs/xfs_refcount_btree.c
index 6738a68ffa49..7e5f92c1ac56 100644
--- a/libxfs/xfs_refcount_btree.c
+++ b/libxfs/xfs_refcount_btree.c
@@ -15,6 +15,7 @@
#include "xfs_refcount_btree.h"
#include "xfs_refcount.h"
#include "xfs_alloc.h"
+#include "xfs_error.h"
#include "xfs_health.h"
#include "xfs_trace.h"
#include "xfs_trans.h"
diff --git a/libxfs/xfs_rmap.c b/libxfs/xfs_rmap.c
index e65f4d7808be..74600c99172d 100644
--- a/libxfs/xfs_rmap.c
+++ b/libxfs/xfs_rmap.c
@@ -20,6 +20,7 @@
#include "xfs_rmap_btree.h"
#include "xfs_trace.h"
#include "xfs_errortag.h"
+#include "xfs_error.h"
#include "xfs_inode.h"
#include "xfs_ag.h"
#include "xfs_health.h"
diff --git a/libxfs/xfs_rmap_btree.c b/libxfs/xfs_rmap_btree.c
index 98b16dc83f84..6e2a32d8382c 100644
--- a/libxfs/xfs_rmap_btree.c
+++ b/libxfs/xfs_rmap_btree.c
@@ -18,6 +18,7 @@
#include "xfs_rmap_btree.h"
#include "xfs_health.h"
#include "xfs_trace.h"
+#include "xfs_error.h"
#include "xfs_ag.h"
#include "xfs_ag_resv.h"
#include "xfs_buf_mem.h"
diff --git a/libxfs/xfs_rtbitmap.c b/libxfs/xfs_rtbitmap.c
index 1681e4a91d7a..d46a1617d076 100644
--- a/libxfs/xfs_rtbitmap.c
+++ b/libxfs/xfs_rtbitmap.c
@@ -16,6 +16,7 @@
#include "xfs_bmap_btree.h"
#include "xfs_trans_space.h"
#include "xfs_trans.h"
+#include "xfs_error.h"
#include "xfs_rtbitmap.h"
#include "xfs_health.h"
#include "xfs_sb.h"
diff --git a/libxfs/xfs_rtgroup.c b/libxfs/xfs_rtgroup.c
index d127ac0d6110..c1f8d2cb186a 100644
--- a/libxfs/xfs_rtgroup.c
+++ b/libxfs/xfs_rtgroup.c
@@ -20,6 +20,7 @@
#include "xfs_ag.h"
#include "xfs_ag_resv.h"
#include "xfs_health.h"
+#include "xfs_error.h"
#include "xfs_bmap.h"
#include "xfs_defer.h"
#include "xfs_log_format.h"
diff --git a/libxfs/xfs_rtrefcount_btree.c b/libxfs/xfs_rtrefcount_btree.c
index 02230c8ef0f0..6a6e85c413e0 100644
--- a/libxfs/xfs_rtrefcount_btree.c
+++ b/libxfs/xfs_rtrefcount_btree.c
@@ -22,6 +22,7 @@
#include "xfs_refcount.h"
#include "xfs_trace.h"
#include "xfs_cksum.h"
+#include "xfs_error.h"
#include "xfs_rtgroup.h"
#include "xfs_rtbitmap.h"
#include "xfs_metafile.h"
diff --git a/libxfs/xfs_rtrmap_btree.c b/libxfs/xfs_rtrmap_btree.c
index 091221743b8a..81d517b94e46 100644
--- a/libxfs/xfs_rtrmap_btree.c
+++ b/libxfs/xfs_rtrmap_btree.c
@@ -23,6 +23,7 @@
#include "xfs_rtrmap_btree.h"
#include "xfs_trace.h"
#include "xfs_cksum.h"
+#include "xfs_error.h"
#include "xfs_rtgroup.h"
#include "xfs_bmap.h"
#include "xfs_health.h"
diff --git a/libxfs/xfs_sb.c b/libxfs/xfs_sb.c
index 7097bb61d48d..ea99f8b5eee5 100644
--- a/libxfs/xfs_sb.c
+++ b/libxfs/xfs_sb.c
@@ -14,7 +14,7 @@
#include "xfs_mount.h"
#include "xfs_ialloc.h"
#include "xfs_alloc.h"
-#include "xfs_trace.h"
+#include "xfs_error.h"
#include "xfs_trans.h"
#include "xfs_bmap_btree.h"
#include "xfs_alloc_btree.h"
diff --git a/libxfs/xfs_symlink_remote.c b/libxfs/xfs_symlink_remote.c
index 7b62dba485a5..de487b1caa4b 100644
--- a/libxfs/xfs_symlink_remote.c
+++ b/libxfs/xfs_symlink_remote.c
@@ -12,6 +12,7 @@
#include "xfs_trans_resv.h"
#include "xfs_mount.h"
#include "xfs_inode.h"
+#include "xfs_error.h"
#include "xfs_trans.h"
#include "xfs_symlink_remote.h"
#include "xfs_bit.h"
--
2.53.0
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH 7/8] libxfs: provide xfs_extent_busy.h
2026-09-10 13:28 reduce libxfs divergence from the kernel Christoph Hellwig
` (5 preceding siblings ...)
2026-09-10 13:28 ` [PATCH 6/8] libxfs: provide xfs_error.h Christoph Hellwig
@ 2026-09-10 13:28 ` Christoph Hellwig
2026-09-10 13:28 ` [PATCH 8/8] libxfs: provide xfs_quota.h Christoph Hellwig
2026-09-10 15:39 ` reduce libxfs divergence from the kernel Andrey Albershteyn
8 siblings, 0 replies; 10+ messages in thread
From: Christoph Hellwig @ 2026-09-10 13:28 UTC (permalink / raw)
To: Andrey Albershteyn; +Cc: linux-xfs
Reduces various spurious differences with the kernel.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
libxfs/Makefile | 1 +
libxfs/stubs/xfs_extent_busy.h | 20 ++++++++++++++++++++
libxfs/xfs_alloc.c | 1 +
libxfs/xfs_alloc_btree.c | 1 +
libxfs/xfs_group.c | 1 +
libxfs/xfs_platform.h | 15 ---------------
libxfs/xfs_rmap_btree.c | 1 +
libxfs/xfs_rtbitmap.c | 1 +
libxfs/xfs_rtrefcount_btree.c | 1 +
libxfs/xfs_rtrmap_btree.c | 1 +
10 files changed, 28 insertions(+), 15 deletions(-)
create mode 100644 libxfs/stubs/xfs_extent_busy.h
diff --git a/libxfs/Makefile b/libxfs/Makefile
index d173a2c4b13b..bf681435969c 100644
--- a/libxfs/Makefile
+++ b/libxfs/Makefile
@@ -75,6 +75,7 @@ HFILES = \
xfs_zones.h \
stubs/xfs_buf_mem.h \
stubs/xfs_error.h \
+ stubs/xfs_extent_busy.h \
stubs/xfs_inode.h \
stubs/xfs_mount.h \
stubs/xfs_trace.h \
diff --git a/libxfs/stubs/xfs_extent_busy.h b/libxfs/stubs/xfs_extent_busy.h
new file mode 100644
index 000000000000..4fbebabca124
--- /dev/null
+++ b/libxfs/stubs/xfs_extent_busy.h
@@ -0,0 +1,20 @@
+#ifndef __XFS_EXTENT_BUSY_H__
+#define __XFS_EXTENT_BUSY_H__
+
+#define XFS_EXTENT_BUSY_DISCARDED 0x01 /* undergoing a discard op. */
+#define XFS_EXTENT_BUSY_SKIP_DISCARD 0x02 /* do not discard */
+
+#define xfs_extent_busy_reuse(...) ((void) 0)
+/* avoid unused variable warning */
+#define xfs_extent_busy_insert(tp,xg,bno,len,flags)({ \
+ struct xfs_group *__foo = xg; \
+ __foo = __foo; /* no set-but-unused warning */ \
+})
+#define xfs_extent_busy_trim(group,minlen,maxlen,bno,len,busy_gen) ({ \
+ unsigned __foo = *(busy_gen); \
+ *(busy_gen) = __foo; \
+ false; \
+})
+#define xfs_extent_busy_flush(tp,pag,busy_gen,alloc_flags) ((int)(0))
+
+#endif /* __XFS_EXTENT_BUSY_H__ */
diff --git a/libxfs/xfs_alloc.c b/libxfs/xfs_alloc.c
index cf517d4a938a..4cad09d8be61 100644
--- a/libxfs/xfs_alloc.c
+++ b/libxfs/xfs_alloc.c
@@ -16,6 +16,7 @@
#include "xfs_rmap.h"
#include "xfs_alloc_btree.h"
#include "xfs_alloc.h"
+#include "xfs_extent_busy.h"
#include "xfs_errortag.h"
#include "xfs_error.h"
#include "xfs_trace.h"
diff --git a/libxfs/xfs_alloc_btree.c b/libxfs/xfs_alloc_btree.c
index 04e028194e8c..29f6ec1c3f6f 100644
--- a/libxfs/xfs_alloc_btree.c
+++ b/libxfs/xfs_alloc_btree.c
@@ -14,6 +14,7 @@
#include "xfs_btree_staging.h"
#include "xfs_alloc_btree.h"
#include "xfs_alloc.h"
+#include "xfs_extent_busy.h"
#include "xfs_error.h"
#include "xfs_health.h"
#include "xfs_trace.h"
diff --git a/libxfs/xfs_group.c b/libxfs/xfs_group.c
index 12ce312d1e50..2ff9d1e56b47 100644
--- a/libxfs/xfs_group.c
+++ b/libxfs/xfs_group.c
@@ -10,6 +10,7 @@
#include "xfs_mount.h"
#include "xfs_error.h"
#include "xfs_trace.h"
+#include "xfs_extent_busy.h"
#include "xfs_group.h"
/*
diff --git a/libxfs/xfs_platform.h b/libxfs/xfs_platform.h
index 7c62a40af458..542e633f0ffe 100644
--- a/libxfs/xfs_platform.h
+++ b/libxfs/xfs_platform.h
@@ -384,21 +384,6 @@ xfs_buf_readahead(
#define xfs_sort_inodes(i_tab, nr) ((void) 0)
/* space allocation */
-#define XFS_EXTENT_BUSY_DISCARDED 0x01 /* undergoing a discard op. */
-#define XFS_EXTENT_BUSY_SKIP_DISCARD 0x02 /* do not discard */
-
-#define xfs_extent_busy_reuse(...) ((void) 0)
-/* avoid unused variable warning */
-#define xfs_extent_busy_insert(tp,xg,bno,len,flags)({ \
- struct xfs_group *__foo = xg; \
- __foo = __foo; /* no set-but-unused warning */ \
-})
-#define xfs_extent_busy_trim(group,minlen,maxlen,bno,len,busy_gen) ({ \
- unsigned __foo = *(busy_gen); \
- *(busy_gen) = __foo; \
- false; \
-})
-#define xfs_extent_busy_flush(tp,pag,busy_gen,alloc_flags) ((int)(0))
#define xfs_rotorstep 1
#define xfs_bmap_rtalloc(a) (-ENOSYS)
diff --git a/libxfs/xfs_rmap_btree.c b/libxfs/xfs_rmap_btree.c
index 6e2a32d8382c..10b3272238eb 100644
--- a/libxfs/xfs_rmap_btree.c
+++ b/libxfs/xfs_rmap_btree.c
@@ -19,6 +19,7 @@
#include "xfs_health.h"
#include "xfs_trace.h"
#include "xfs_error.h"
+#include "xfs_extent_busy.h"
#include "xfs_ag.h"
#include "xfs_ag_resv.h"
#include "xfs_buf_mem.h"
diff --git a/libxfs/xfs_rtbitmap.c b/libxfs/xfs_rtbitmap.c
index d46a1617d076..6a0fc1032753 100644
--- a/libxfs/xfs_rtbitmap.c
+++ b/libxfs/xfs_rtbitmap.c
@@ -21,6 +21,7 @@
#include "xfs_health.h"
#include "xfs_sb.h"
#include "xfs_errortag.h"
+#include "xfs_extent_busy.h"
/*
* Realtime allocator bitmap functions shared with userspace.
diff --git a/libxfs/xfs_rtrefcount_btree.c b/libxfs/xfs_rtrefcount_btree.c
index 6a6e85c413e0..22acc1411aac 100644
--- a/libxfs/xfs_rtrefcount_btree.c
+++ b/libxfs/xfs_rtrefcount_btree.c
@@ -23,6 +23,7 @@
#include "xfs_trace.h"
#include "xfs_cksum.h"
#include "xfs_error.h"
+#include "xfs_extent_busy.h"
#include "xfs_rtgroup.h"
#include "xfs_rtbitmap.h"
#include "xfs_metafile.h"
diff --git a/libxfs/xfs_rtrmap_btree.c b/libxfs/xfs_rtrmap_btree.c
index 81d517b94e46..c264bc5651c0 100644
--- a/libxfs/xfs_rtrmap_btree.c
+++ b/libxfs/xfs_rtrmap_btree.c
@@ -24,6 +24,7 @@
#include "xfs_trace.h"
#include "xfs_cksum.h"
#include "xfs_error.h"
+#include "xfs_extent_busy.h"
#include "xfs_rtgroup.h"
#include "xfs_bmap.h"
#include "xfs_health.h"
--
2.53.0
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH 8/8] libxfs: provide xfs_quota.h
2026-09-10 13:28 reduce libxfs divergence from the kernel Christoph Hellwig
` (6 preceding siblings ...)
2026-09-10 13:28 ` [PATCH 7/8] libxfs: provide xfs_extent_busy.h Christoph Hellwig
@ 2026-09-10 13:28 ` Christoph Hellwig
2026-09-10 15:39 ` reduce libxfs divergence from the kernel Andrey Albershteyn
8 siblings, 0 replies; 10+ messages in thread
From: Christoph Hellwig @ 2026-09-10 13:28 UTC (permalink / raw)
To: Andrey Albershteyn; +Cc: linux-xfs
Reduce spurious include differences to the kernel files.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
libxfs/Makefile | 1 +
libxfs/stubs/xfs_quota.h | 20 ++++++++++++++++++++
libxfs/xfs_attr.c | 2 +-
libxfs/xfs_bmap.c | 2 +-
libxfs/xfs_bmap_btree.c | 2 +-
libxfs/xfs_btree.c | 1 +
libxfs/xfs_dquot_buf.c | 2 +-
libxfs/xfs_exchmaps.c | 1 +
libxfs/xfs_metadir.c | 1 +
libxfs/xfs_metafile.c | 1 +
libxfs/xfs_platform.h | 15 ---------------
libxfs/xfs_trans_resv.c | 2 +-
12 files changed, 30 insertions(+), 20 deletions(-)
create mode 100644 libxfs/stubs/xfs_quota.h
diff --git a/libxfs/Makefile b/libxfs/Makefile
index bf681435969c..9795982b0e83 100644
--- a/libxfs/Makefile
+++ b/libxfs/Makefile
@@ -78,6 +78,7 @@ HFILES = \
stubs/xfs_extent_busy.h \
stubs/xfs_inode.h \
stubs/xfs_mount.h \
+ stubs/xfs_quota.h \
stubs/xfs_trace.h \
stubs/xfs_trans.h
diff --git a/libxfs/stubs/xfs_quota.h b/libxfs/stubs/xfs_quota.h
new file mode 100644
index 000000000000..7bc545bd5449
--- /dev/null
+++ b/libxfs/stubs/xfs_quota.h
@@ -0,0 +1,20 @@
+#ifndef __XFS_QUOTA_H__
+#define __XFS_QUOTA_H__
+
+#include "xfs_quota_defs.h"
+
+#define xfs_trans_mod_dquot_byino(t,i,f,d) ({ \
+ uint _f = (f); \
+ _f = _f; /* shut up gcc */ \
+})
+#define xfs_trans_reserve_quota_nblks(t,i,b,n,f) (0)
+
+/* hack too silence gcc */
+static inline int retzero(void) { return 0; }
+#define xfs_trans_unreserve_quota_nblks(t,i,b,n,f) retzero()
+#define xfs_quota_unreserve_blkres(i,b) retzero()
+
+#define xfs_quota_reserve_blkres(i,b) (0)
+#define xfs_qm_dqattach(i) (0)
+
+#endif /* __XFS_QUOTA_H__ */
diff --git a/libxfs/xfs_attr.c b/libxfs/xfs_attr.c
index bff809676701..57a0a175c286 100644
--- a/libxfs/xfs_attr.c
+++ b/libxfs/xfs_attr.c
@@ -21,7 +21,7 @@
#include "xfs_attr.h"
#include "xfs_attr_leaf.h"
#include "xfs_attr_remote.h"
-#include "xfs_quota_defs.h"
+#include "xfs_quota.h"
#include "xfs_trans_space.h"
#include "xfs_trace.h"
#include "defer_item.h"
diff --git a/libxfs/xfs_bmap.c b/libxfs/xfs_bmap.c
index 1d3460da84ca..cec59446711b 100644
--- a/libxfs/xfs_bmap.c
+++ b/libxfs/xfs_bmap.c
@@ -22,10 +22,10 @@
#include "xfs_bmap_btree.h"
#include "xfs_errortag.h"
#include "xfs_error.h"
+#include "xfs_quota.h"
#include "xfs_trans_space.h"
#include "xfs_trace.h"
#include "xfs_attr_leaf.h"
-#include "xfs_quota_defs.h"
#include "xfs_rmap.h"
#include "xfs_ag.h"
#include "xfs_ag_resv.h"
diff --git a/libxfs/xfs_bmap_btree.c b/libxfs/xfs_bmap_btree.c
index 5b82e732d3ad..758a4b1ccf5b 100644
--- a/libxfs/xfs_bmap_btree.c
+++ b/libxfs/xfs_bmap_btree.c
@@ -19,10 +19,10 @@
#include "xfs_bmap_btree.h"
#include "xfs_bmap.h"
#include "xfs_error.h"
+#include "xfs_quota.h"
#include "xfs_trace.h"
#include "xfs_rmap.h"
#include "xfs_ag.h"
-#include "xfs_quota_defs.h"
static struct kmem_cache *xfs_bmbt_cur_cache;
diff --git a/libxfs/xfs_btree.c b/libxfs/xfs_btree.c
index 3f820e7999a6..425fbefc31ad 100644
--- a/libxfs/xfs_btree.c
+++ b/libxfs/xfs_btree.c
@@ -31,6 +31,7 @@
#include "xfs_rtrmap_btree.h"
#include "xfs_bmap.h"
#include "xfs_rmap.h"
+#include "xfs_quota.h"
#include "xfs_metafile.h"
#include "xfs_rtrefcount_btree.h"
diff --git a/libxfs/xfs_dquot_buf.c b/libxfs/xfs_dquot_buf.c
index b0cb2a2b1cc4..0e59106303c4 100644
--- a/libxfs/xfs_dquot_buf.c
+++ b/libxfs/xfs_dquot_buf.c
@@ -11,8 +11,8 @@
#include "xfs_log_format.h"
#include "xfs_trans_resv.h"
#include "xfs_mount.h"
-#include "xfs_quota_defs.h"
#include "xfs_inode.h"
+#include "xfs_quota.h"
#include "xfs_trans.h"
#include "xfs_error.h"
#include "xfs_health.h"
diff --git a/libxfs/xfs_exchmaps.c b/libxfs/xfs_exchmaps.c
index 7b9bba1d971c..7d6f949aa1f3 100644
--- a/libxfs/xfs_exchmaps.c
+++ b/libxfs/xfs_exchmaps.c
@@ -14,6 +14,7 @@
#include "xfs_inode.h"
#include "xfs_trans.h"
#include "xfs_bmap.h"
+#include "xfs_quota.h"
#include "xfs_exchmaps.h"
#include "xfs_trace.h"
#include "xfs_bmap_btree.h"
diff --git a/libxfs/xfs_metadir.c b/libxfs/xfs_metadir.c
index aecffb11a310..74c4596ee4cf 100644
--- a/libxfs/xfs_metadir.c
+++ b/libxfs/xfs_metadir.c
@@ -18,6 +18,7 @@
#include "xfs_metadir.h"
#include "xfs_trace.h"
#include "xfs_inode.h"
+#include "xfs_quota.h"
#include "xfs_ialloc.h"
#include "xfs_bmap_btree.h"
#include "xfs_da_format.h"
diff --git a/libxfs/xfs_metafile.c b/libxfs/xfs_metafile.c
index 7973feb3b411..71f004e9dc64 100644
--- a/libxfs/xfs_metafile.c
+++ b/libxfs/xfs_metafile.c
@@ -17,6 +17,7 @@
#include "xfs_metafile.h"
#include "xfs_trace.h"
#include "xfs_inode.h"
+#include "xfs_quota.h"
#include "xfs_errortag.h"
#include "xfs_error.h"
#include "xfs_alloc.h"
diff --git a/libxfs/xfs_platform.h b/libxfs/xfs_platform.h
index 542e633f0ffe..d09fb0aae00f 100644
--- a/libxfs/xfs_platform.h
+++ b/libxfs/xfs_platform.h
@@ -394,21 +394,6 @@ xfs_buf_readahead(
#define xfs_trans_inode_buf(tp, bp) ((void) 0)
-/* quota bits */
-#define xfs_trans_mod_dquot_byino(t,i,f,d) ({ \
- uint _f = (f); \
- _f = _f; /* shut up gcc */ \
-})
-#define xfs_trans_reserve_quota_nblks(t,i,b,n,f) (0)
-
-/* hack too silence gcc */
-static inline int retzero(void) { return 0; }
-#define xfs_trans_unreserve_quota_nblks(t,i,b,n,f) retzero()
-#define xfs_quota_unreserve_blkres(i,b) retzero()
-
-#define xfs_quota_reserve_blkres(i,b) (0)
-#define xfs_qm_dqattach(i) (0)
-
#define uuid_copy(s,d) platform_uuid_copy((s),(d))
#define uuid_equal(s,d) (platform_uuid_compare((s),(d)) == 0)
diff --git a/libxfs/xfs_trans_resv.c b/libxfs/xfs_trans_resv.c
index 9294b72e61b7..5b7660b1cd8a 100644
--- a/libxfs/xfs_trans_resv.c
+++ b/libxfs/xfs_trans_resv.c
@@ -15,9 +15,9 @@
#include "xfs_da_btree.h"
#include "xfs_inode.h"
#include "xfs_bmap_btree.h"
+#include "xfs_quota.h"
#include "xfs_trans.h"
#include "xfs_trans_space.h"
-#include "xfs_quota_defs.h"
#include "xfs_rtbitmap.h"
#include "xfs_trace.h"
#include "defer_item.h"
--
2.53.0
^ permalink raw reply related [flat|nested] 10+ messages in thread* Re: reduce libxfs divergence from the kernel
2026-09-10 13:28 reduce libxfs divergence from the kernel Christoph Hellwig
` (7 preceding siblings ...)
2026-09-10 13:28 ` [PATCH 8/8] libxfs: provide xfs_quota.h Christoph Hellwig
@ 2026-09-10 15:39 ` Andrey Albershteyn
8 siblings, 0 replies; 10+ messages in thread
From: Andrey Albershteyn @ 2026-09-10 15:39 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: linux-xfs
On 2026-09-10 15:28:30, Christoph Hellwig wrote:
> Hi all,
>
> this series tries to reduce the amount of difference the shared code has
> from the kernel version, mostly by adding more stub headers. To ease
> maintenance of these stubs headers, it also moves them to a new
> directory.
>
> There's probably a few more that we could add and together with small
> kernel changes we should be able to keep the files 100% in sync, but
> I'd like to test the waters before investing more effort.
>
The series looks good to me
Reviewed-by: Andrey Albershteyn <aalbersh@kernel.org>
--
- Andrey
^ permalink raw reply [flat|nested] 10+ messages in thread