small cleanups to help code sharing with xfsprogs
Hi all,
this series has a few trivial cleanups and code moves that help sharing more code with xfsprogs.
Diffstat:
libxfs/xfs_attr_item.h | 2 -- libxfs/xfs_bmap_item.h | 2 -- libxfs/xfs_buf_item.h | 2 -- libxfs/xfs_defer.c | 1 - libxfs/xfs_exchmaps_item.h | 2 -- libxfs/xfs_extfree_item.h | 2 -- libxfs/xfs_inode_buf.c | 3 --- libxfs/xfs_inode_item.h | 2 -- libxfs/xfs_inode_util.c | 1 - libxfs/xfs_refcount.c | 1 - libxfs/xfs_refcount_item.h | 2 -- libxfs/xfs_rmap_item.h | 2 -- libxfs/xfs_rtbitmap.c | 1 - libxfs/xfs_rtgroup.c | 1 - libxfs/xfs_sb.c | 1 - libxfs/xfs_trans.h | 2 -- libxfs/xfs_trans_inode.c | 2 -- xfs_platform.h | 1 + 18 files changed, 1 insertion(+), 29 deletions(-)
PATCH 1/4 xfs: remove various unused includes in libxfs/
Remove a few unused includes in libxfs/ that cause spurious differences between the kernel and userspace versions of these files.
--- fs/xfs/libxfs/xfs_defer.c | 1 - fs/xfs/libxfs/xfs_inode_buf.c | 1 - fs/xfs/libxfs/xfs_refcount.c | 1 - fs/xfs/libxfs/xfs_rtbitmap.c | 1 - fs/xfs/libxfs/xfs_rtgroup.c | 1 - fs/xfs/libxfs/xfs_sb.c | 1 - 6 files changed, 6 deletions(-)
fs/xfs/libxfs/xfs_defer.c +0 -1
@@ -24,7 +24,6 @@#include "xfs_refcount.h" #include "xfs_bmap.h" #include "xfs_alloc.h" -#include "xfs_buf.h" #include "xfs_da_format.h" #include "xfs_da_btree.h" #include "xfs_attr.h"
fs/xfs/libxfs/xfs_inode_buf.c +0 -1
@@ -14,7 +14,6 @@#include "xfs_inode.h" #include "xfs_errortag.h" #include "xfs_error.h" -#include "xfs_icache.h" #include "xfs_trans.h" #include "xfs_ialloc.h" #include "xfs_dir2.h"
fs/xfs/libxfs/xfs_refcount.c +0 -1
@@ -26,7 +26,6 @@#include "xfs_health.h" #include "xfs_refcount_item.h" #include "xfs_rtgroup.h" -#include "xfs_rtalloc.h" #include "xfs_rtrefcount_btree.h" struct kmem_cache *xfs_refcount_intent_cache;
fs/xfs/libxfs/xfs_rtbitmap.c +0 -1
@@ -16,7 +16,6 @@#include "xfs_bmap_btree.h" #include "xfs_trans_space.h" #include "xfs_trans.h" -#include "xfs_rtalloc.h" #include "xfs_error.h" #include "xfs_rtbitmap.h" #include "xfs_health.h"
fs/xfs/libxfs/xfs_rtgroup.c +0 -1
@@ -27,7 +27,6 @@#include "xfs_trans.h" #include "xfs_trace.h" #include "xfs_inode.h" -#include "xfs_icache.h" #include "xfs_buf_item.h" #include "xfs_rtgroup.h" #include "xfs_rtbitmap.h"
fs/xfs/libxfs/xfs_sb.c +0 -1
@@ -26,7 +26,6 @@#include "xfs_health.h" #include "xfs_ag.h" #include "xfs_rtbitmap.h" -#include "xfs_exchrange.h" #include "xfs_rtgroup.h" #include "xfs_rtrmap_btree.h" #include "xfs_rtrefcount_btree.h"
Signature · 1 line
2.53.0
PATCH 2/4 xfs: include <linux/iversion.h> in xfs_platform.h
In reply to Christoph HellwigThis removes the only non-xfs inludes from libxfs/ and thus reduces the differences between the kernel and userspace versions of these files.
--- fs/xfs/libxfs/xfs_inode_buf.c | 2 -- fs/xfs/libxfs/xfs_inode_util.c | 1 - fs/xfs/libxfs/xfs_trans_inode.c | 2 -- fs/xfs/xfs_platform.h | 1 + 4 files changed, 1 insertion(+), 5 deletions(-)
fs/xfs/libxfs/xfs_inode_buf.c +0 -2
@@ -20,8 +20,6 @@#include "xfs_health.h" #include "xfs_metafile.h" -#include <linux/iversion.h> -/* * If we are doing readahead on an inode buffer, we might be in log recovery * reading an inode allocation buffer that hasn't yet been replayed, and hence
fs/xfs/libxfs/xfs_inode_util.c +0 -1
@@ -3,7 +3,6 @@* Copyright (c) 2000-2006 Silicon Graphics, Inc. * All Rights Reserved. */ -#include <linux/iversion.h> #include "xfs_platform.h" #include "xfs_fs.h" #include "xfs_shared.h"
fs/xfs/libxfs/xfs_trans_inode.c +0 -2
@@ -15,8 +15,6 @@#include "xfs_trans_priv.h" #include "xfs_inode_item.h" -#include <linux/iversion.h> -/* * Add a locked inode to the transaction. *
fs/xfs/xfs_platform.h +1 -0
@@ -50,6 +50,7 @@#include <linux/xattr.h> #include <linux/mnt_idmapping.h> #include <linux/debugfs.h> +#include <linux/iversion.h> #include <asm/page.h> #include <asm/div64.h> #include <asm/param.h>
Signature · 1 line
2.53.0
PATCH 3/4 xfs: move xfs_*_item.h to libxfs
In reply to Christoph HellwigAll these files can be used as-is in xfsprogs to replace various shades of copy and paste.
---
fs/xfs/{ => libxfs}/xfs_attr_item.h | 2 --
fs/xfs/{ => libxfs}/xfs_bmap_item.h | 2 --
fs/xfs/{ => libxfs}/xfs_buf_item.h | 2 --
fs/xfs/{ => libxfs}/xfs_dquot_item.h | 0
fs/xfs/{ => libxfs}/xfs_exchmaps_item.h | 2 --
fs/xfs/{ => libxfs}/xfs_extfree_item.h | 2 --
fs/xfs/{ => libxfs}/xfs_icreate_item.h | 0
fs/xfs/{ => libxfs}/xfs_inode_item.h | 2 --
fs/xfs/{ => libxfs}/xfs_iunlink_item.h | 0
fs/xfs/{ => libxfs}/xfs_refcount_item.h | 2 --
fs/xfs/{ => libxfs}/xfs_rmap_item.h | 2 --
11 files changed, 16 deletions(-)
rename fs/xfs/{ => libxfs}/xfs_attr_item.h (97%)
rename fs/xfs/{ => libxfs}/xfs_bmap_item.h (98%)
rename fs/xfs/{ => libxfs}/xfs_buf_item.h (98%)
rename fs/xfs/{ => libxfs}/xfs_dquot_item.h (100%)
rename fs/xfs/{ => libxfs}/xfs_exchmaps_item.h (98%)
rename fs/xfs/{ => libxfs}/xfs_extfree_item.h (98%)
rename fs/xfs/{ => libxfs}/xfs_icreate_item.h (100%)
rename fs/xfs/{ => libxfs}/xfs_inode_item.h (98%)
rename fs/xfs/{ => libxfs}/xfs_iunlink_item.h (100%)
rename fs/xfs/{ => libxfs}/xfs_refcount_item.h (98%)
rename fs/xfs/{ => libxfs}/xfs_rmap_item.h (98%)fs/xfs/libxfs/xfs_attr_item.h renamed from fs/xfs/xfs_attr_item.h +0 -2
@@ -6,8 +6,6 @@#ifndef __XFS_ATTR_ITEM_H__#define __XFS_ATTR_ITEM_H__ -/* kernel only ATTRI/ATTRD definitions */ -struct xfs_mount ;struct kmem_zone ;
fs/xfs/libxfs/xfs_bmap_item.h renamed from fs/xfs/xfs_bmap_item.h +0 -2
@@ -22,8 +22,6 @@* bmbt metadata updates in the non-first transaction. */ -/* kernel only BUI/BUD definitions */ -struct xfs_mount ;struct kmem_cache ;
fs/xfs/libxfs/xfs_buf_item.h renamed from fs/xfs/xfs_buf_item.h +0 -2
@@ -6,8 +6,6 @@#ifndef __XFS_BUF_ITEM_H__#define __XFS_BUF_ITEM_H__ -/* kernel only definitions */ -struct xfs_buf ;struct xfs_mount ;
fs/xfs/libxfs/xfs_dquot_item.h renamed from fs/xfs/xfs_dquot_item.h +0 -0
fs/xfs/libxfs/xfs_exchmaps_item.h renamed from fs/xfs/xfs_exchmaps_item.h +0 -2
@@ -22,8 +22,6 @@* rest of the mapping exchanges. */ -/* kernel only XMI/XMD definitions */ -struct xfs_mount ;struct kmem_cache ;
fs/xfs/libxfs/xfs_extfree_item.h renamed from fs/xfs/xfs_extfree_item.h +0 -2
@@ -6,8 +6,6 @@#ifndef __XFS_EXTFREE_ITEM_H__#define __XFS_EXTFREE_ITEM_H__ -/* kernel only EFI/EFD definitions */ -struct xfs_mount ;struct kmem_cache ;
fs/xfs/libxfs/xfs_icreate_item.h renamed from fs/xfs/xfs_icreate_item.h +0 -0
fs/xfs/libxfs/xfs_inode_item.h renamed from fs/xfs/xfs_inode_item.h +0 -2
@@ -6,8 +6,6 @@#ifndef __XFS_INODE_ITEM_H__#define __XFS_INODE_ITEM_H__ -/* kernel only definitions */ -struct xfs_buf ;struct xfs_bmbt_rec ;struct xfs_inode ;
fs/xfs/libxfs/xfs_iunlink_item.h renamed from fs/xfs/xfs_iunlink_item.h +0 -0
fs/xfs/libxfs/xfs_refcount_item.h renamed from fs/xfs/xfs_refcount_item.h +0 -2
@@ -22,8 +22,6 @@* to replay the refcountbt metadata updates. */ -/* kernel only CUI/CUD definitions */ -struct xfs_mount ;struct kmem_cache ;
fs/xfs/libxfs/xfs_rmap_item.h renamed from fs/xfs/xfs_rmap_item.h +0 -2
@@ -25,8 +25,6 @@* (rmapbt/bnobt/cntbt) metadata updates in the non-first transaction. */ -/* kernel only RUI/RUD definitions */ -struct xfs_mount ;struct kmem_cache ;
Signature · 1 line
2.53.0
PATCH 4/4 xfs: move xfs_trans.h to libxfs
In reply to Christoph HellwigThis file can be reused in xfsprogs instead of carrying a slightly modified version.
---
fs/xfs/{ => libxfs}/xfs_trans.h | 2 --
1 file changed, 2 deletions(-)
rename fs/xfs/{ => libxfs}/xfs_trans.h (99%)fs/xfs/libxfs/xfs_trans.h renamed from fs/xfs/xfs_trans.h +0 -2
@@ -6,8 +6,6 @@#ifndef __XFS_TRANS_H__#define __XFS_TRANS_H__ -/* kernel only transaction subsystem defines */ -struct xlog ;struct xlog_format_buf ;struct xfs_buf ;
Signature · 1 line
2.53.0
Darrick J. Wong
Reviewed-byQuoted 4 lines · Christoph Hellwig
Hi all,
this series has a few trivial cleanups and code moves that help sharing more code with xfsprogs.
Hrmm. This is a somewhat different approach than what Chris Wedgwood did for his log port to userspace. What do the maintainers think? I'll defer to them as to whether pushing some of the log code into fs/xfs/libxfs is better than pushing all the log code to fs/xfs/libxlog.
The code changes look ok, so for the whole series,
--D
Quoted 22 lines
Diffstat:
libxfs/xfs_attr_item.h | 2 -- libxfs/xfs_bmap_item.h | 2 -- libxfs/xfs_buf_item.h | 2 -- libxfs/xfs_defer.c | 1 - libxfs/xfs_exchmaps_item.h | 2 -- libxfs/xfs_extfree_item.h | 2 -- libxfs/xfs_inode_buf.c | 3 --- libxfs/xfs_inode_item.h | 2 -- libxfs/xfs_inode_util.c | 1 - libxfs/xfs_refcount.c | 1 - libxfs/xfs_refcount_item.h | 2 -- libxfs/xfs_rmap_item.h | 2 -- libxfs/xfs_rtbitmap.c | 1 - libxfs/xfs_rtgroup.c | 1 - libxfs/xfs_sb.c | 1 - libxfs/xfs_trans.h | 2 -- libxfs/xfs_trans_inode.c | 2 -- xfs_platform.h | 1 + 18 files changed, 1 insertion(+), 29 deletions(-)
Quoted 8 lines · Darrick J. Wong
Quoted 4 lines · Christoph Hellwig
Hi all,
this series has a few trivial cleanups and code moves that help sharing more code with xfsprogs.
Hrmm. This is a somewhat different approach than what Chris Wedgwood did for his log port to userspace.
Well, that seems to have been an AI slop dump without any further engagement from the LLM-herder, so I'm not sure it matters.
But it also is a bit of a different thing. This series tries to reduce the kernel/user libxfs differences, and reusing whatever we can from the kernel helps with that. What we do about the log becomes relevant if/when we want to update that or share more. My previously stated opinion is that splitting a single kernel code base into two libraries, which then generally are linked into the same programs again is not helpful. But someone comes up with a design that actually makes it work painlessly I would not complain. In the meantime I'd improve the maintainability of libxfs without touching the logging code at all.
Back from conferences. Sorry the late reply...
Quoted 4 lines · Christoph Hellwig
Quoted 3 lines · Darrick J. Wong
Quoted 2 lines · Christoph Hellwig
Hi all,
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
this series has a few trivial cleanups and code moves that help sharing more code with xfsprogs.
Hrmm. This is a somewhat different approach than what Chris Wedgwood did for his log port to userspace.
Well, that seems to have been an AI slop dump without any further engagement from the LLM-herder, so I'm not sure it matters.
Indeed, I'd stay with this series, so for this series:
Quoted 10 lines
But it also is a bit of a different thing. This series tries to reduce the kernel/user libxfs differences, and reusing whatever we can from the kernel helps with that. What we do about the log becomes relevant if/when we want to update that or share more. My previously stated opinion is that splitting a single kernel code base into two libraries, which then generally are linked into the same programs again is not helpful. But someone comes up with a design that actually makes it work painlessly I would not complain. In the meantime I'd improve the maintainability of libxfs without touching the logging code at all.
Agreed.
Quoted 24 lines · Christoph Hellwig
this series has a few trivial cleanups and code moves that help sharing more code with xfsprogs.
Diffstat:
libxfs/xfs_attr_item.h | 2 -- libxfs/xfs_bmap_item.h | 2 -- libxfs/xfs_buf_item.h | 2 -- libxfs/xfs_defer.c | 1 - libxfs/xfs_exchmaps_item.h | 2 -- libxfs/xfs_extfree_item.h | 2 -- libxfs/xfs_inode_buf.c | 3 --- libxfs/xfs_inode_item.h | 2 -- libxfs/xfs_inode_util.c | 1 - libxfs/xfs_refcount.c | 1 - libxfs/xfs_refcount_item.h | 2 -- libxfs/xfs_rmap_item.h | 2 -- libxfs/xfs_rtbitmap.c | 1 - libxfs/xfs_rtgroup.c | 1 - libxfs/xfs_sb.c | 1 - libxfs/xfs_trans.h | 2 -- libxfs/xfs_trans_inode.c | 2 -- xfs_platform.h | 1 + 18 files changed, 1 insertion(+), 29 deletions(-)
Quoted 1 line
[...]
Applied to for-next, thanks!
[1/4] xfs: remove various unused includes in libxfs/
commit: 6fe0d151eaada4f3ea4947b19ac048b8894b9e88
[2/4] xfs: include <linux/iversion.h> in xfs_platform.h
commit: 5e68008e9c0d5ec602582dd659d4d1c6f910ef4a
[3/4] xfs: move xfs_*_item.h to libxfs
commit: 834a6a1e9633722df3bfde5f4fa830432faa360a
[4/4] xfs: move xfs_trans.h to libxfs
commit: ce47e8aab95d6bd4f70b9cbc7308ca13b9d57660Best regards,
Signature · 1 line
Carlos Maiolino <[email protected]>