reduce libxfs divergence from the kernel
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.
PATCH 1/8 include: fix LIBHFILES in Makefile
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.
--- include/Makefile | 4 ---- libxfs/Makefile | 1 + 2 files changed, 1 insertion(+), 4 deletions(-)
include/Makefile +0 -4
@@ -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 \
libxfs/Makefile +1 -0
@@ -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 \
Signature · 1 line
2.53.0
PATCH 2/8 libxfs: remove a spurious xfs.h include in xfs_zones.c
In reply to Christoph HellwigThis fully resyncs with the kernel version.
--- libxfs/xfs_zones.c | 1 - 1 file changed, 1 deletion(-)
libxfs/xfs_zones.c +0 -1
@@ -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"
Signature · 1 line
2.53.0
PATCH 3/8 libxfs: move a few xfs_health.h includes
In reply to Christoph HellwigReduction of spurious differences to the kernel version of these files.
--- 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(-)
libxfs/xfs_alloc_btree.c +1 -1
@@ -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;
libxfs/xfs_ialloc_btree.c +1 -1
@@ -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;
libxfs/xfs_refcount_btree.c +1 -1
@@ -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;
libxfs/xfs_rmap_btree.c +1 -1
@@ -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"
Signature · 1 line
2.53.0
PATCH 4/8 libxfs: find a better location for stub headers
In reply to Christoph Hellwiginclude/ 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.
---
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%)include/Makefile +0 -4
@@ -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
include/builddefs.in +2 -1
@@ -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)
libxfs/Makefile +5 -1
@@ -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 \
libxfs/stubs/xfs_inode.h renamed from include/xfs_inode.h +0 -0
libxfs/stubs/xfs_mount.h renamed from include/xfs_mount.h +0 -0
libxfs/stubs/xfs_trace.h renamed from include/xfs_trace.h +0 -0
libxfs/stubs/xfs_trans.h renamed from include/xfs_trans.h +0 -0
Signature · 1 line
2.53.0
PATCH 5/8 libxfs: rename buf_mem.h to xfs_buf_mem.h
In reply to Christoph HellwigGive 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.
---
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%)include/libxfs.h +1 -2
@@ -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"
libxfs/Makefile +1 -1
@@ -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 \
libxfs/buf_mem.c +1 -2
@@ -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>
libxfs/init.c +1 -2
@@ -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"
libxfs/rdwr.c +1 -2
@@ -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);
libxfs/stubs/xfs_buf_mem.h renamed from libxfs/buf_mem.h +2 -0
@@ -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 ;
libxfs/xfs_btree.c +1 -2
@@ -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"
libxfs/xfs_btree_mem.c +1 -2
@@ -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"
libxfs/xfs_rmap_btree.c +1 -2
@@ -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;
libxfs/xfs_rtrmap_btree.c +1 -2
@@ -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;
Signature · 1 line
2.53.0
PATCH 6/8 libxfs: provide xfs_error.h
In reply to Christoph HellwigThis removes a lot of divergence in the include statements compared to the kernel version.
--- 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
libxfs/Makefile +1 -0
@@ -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 \
libxfs/defer_item.c +1 -0
@@ -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"
libxfs/stubs/xfs_error.h new file +34 -0
@@ -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__ */
libxfs/xfs_ag.c +1 -0
@@ -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"
libxfs/xfs_ag_resv.c +1 -0
@@ -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"
libxfs/xfs_alloc.c +1 -0
@@ -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"
libxfs/xfs_alloc_btree.c +1 -0
@@ -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"
libxfs/xfs_attr_leaf.c +1 -0
@@ -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"
libxfs/xfs_attr_remote.c +1 -0
@@ -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 */
libxfs/xfs_bmap.c +1 -0
@@ -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"
libxfs/xfs_bmap_btree.c +1 -0
@@ -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"
libxfs/xfs_btree.c +1 -0
@@ -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"
libxfs/xfs_btree_mem.c +1 -0
@@ -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"
libxfs/xfs_da_btree.c +2 -0
@@ -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" /*
libxfs/xfs_dir2.c +1 -0
@@ -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"
libxfs/xfs_dir2_block.c +1 -0
@@ -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"
libxfs/xfs_dir2_data.c +1 -0
@@ -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"
libxfs/xfs_dir2_leaf.c +1 -0
@@ -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"
libxfs/xfs_dir2_node.c +1 -0
@@ -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"
libxfs/xfs_dquot_buf.c +1 -0
@@ -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"
libxfs/xfs_exchmaps.c +1 -0
@@ -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"
libxfs/xfs_group.c +1 -0
@@ -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"
libxfs/xfs_ialloc.c +1 -0
@@ -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"
libxfs/xfs_ialloc_btree.c +1 -0
@@ -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"
libxfs/xfs_inode_buf.c +1 -0
@@ -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"
libxfs/xfs_inode_fork.c +1 -0
@@ -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"
libxfs/xfs_inode_util.c +1 -0
@@ -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"
libxfs/xfs_metadir.c +1 -0
@@ -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"
libxfs/xfs_metafile.c +1 -0
@@ -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"
libxfs/xfs_parent.c +1 -0
@@ -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"
libxfs/xfs_platform.h +0 -27
@@ -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)))
libxfs/xfs_refcount.c +1 -0
@@ -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"
libxfs/xfs_refcount_btree.c +1 -0
@@ -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"
libxfs/xfs_rmap.c +1 -0
@@ -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"
libxfs/xfs_rmap_btree.c +1 -0
@@ -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"
libxfs/xfs_rtbitmap.c +1 -0
@@ -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"
libxfs/xfs_rtgroup.c +1 -0
@@ -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"
libxfs/xfs_rtrefcount_btree.c +1 -0
@@ -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"
libxfs/xfs_rtrmap_btree.c +1 -0
@@ -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"
libxfs/xfs_sb.c +1 -1
@@ -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"
libxfs/xfs_symlink_remote.c +1 -0
@@ -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"
Signature · 1 line
2.53.0
PATCH 7/8 libxfs: provide xfs_extent_busy.h
In reply to Christoph HellwigReduces various spurious differences with the kernel.
--- 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
libxfs/Makefile +1 -0
@@ -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 \
libxfs/stubs/xfs_extent_busy.h new file +20 -0
@@ -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__ */
libxfs/xfs_alloc.c +1 -0
@@ -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"
libxfs/xfs_alloc_btree.c +1 -0
@@ -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"
libxfs/xfs_group.c +1 -0
@@ -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" /*
libxfs/xfs_platform.h +0 -15
@@ -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)
libxfs/xfs_rmap_btree.c +1 -0
@@ -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"
libxfs/xfs_rtbitmap.c +1 -0
@@ -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.
libxfs/xfs_rtrefcount_btree.c +1 -0
@@ -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"
libxfs/xfs_rtrmap_btree.c +1 -0
@@ -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"
Signature · 1 line
2.53.0
PATCH 8/8 libxfs: provide xfs_quota.h
In reply to Christoph HellwigReduce spurious include differences to the kernel files.
--- 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
libxfs/Makefile +1 -0
@@ -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
libxfs/stubs/xfs_quota.h new file +20 -0
@@ -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__ */
libxfs/xfs_attr.c +1 -1
@@ -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"
libxfs/xfs_bmap.c +1 -1
@@ -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"
libxfs/xfs_bmap_btree.c +1 -1
@@ -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;
libxfs/xfs_btree.c +1 -0
@@ -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"
libxfs/xfs_dquot_buf.c +1 -1
@@ -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"
libxfs/xfs_exchmaps.c +1 -0
@@ -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"
libxfs/xfs_metadir.c +1 -0
@@ -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"
libxfs/xfs_metafile.c +1 -0
@@ -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"
libxfs/xfs_platform.h +0 -15
@@ -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)
libxfs/xfs_trans_resv.c +1 -1
@@ -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"
Signature · 1 line
2.53.0
Andrey Albershteyn
Reviewed-byQuoted 11 lines · Christoph Hellwig
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
Signature · 1 line
- Andrey