[PATCHSET 2/5] xfsprogs: new libxfs code from kernel 6.14

Darrick J. Wong
2025-02-06T22:29:52Z

Hi all,

Port kernel libxfs code to userspace.

If you're going to start using this code, I strongly recommend pulling
from my git trees, which are linked below.

This has been running on the djcloud for months with no problems. Enjoy!
Comments and questions are, as always, welcome.

--D

xfsprogs git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfsprogs-dev.git/log/?h=libxfs-sync-6.14
---
Commits in this patchset:
* xfs: tidy up xfs_iroot_realloc
* xfs: refactor the inode fork memory allocation functions
* xfs: make xfs_iroot_realloc take the new numrecs instead of deltas
* xfs: make xfs_iroot_realloc a bmap btree function
* xfs: tidy up xfs_bmap_broot_realloc a bit
* xfs: hoist the node iroot update code out of xfs_btree_new_iroot
* xfs: hoist the node iroot update code out of xfs_btree_kill_iroot
* xfs: add some rtgroup inode helpers
* xfs: prepare to reuse the dquot pointer space in struct xfs_inode
* xfs: simplify the xfs_rmap_{alloc,free}_extent calling conventions
* xfs: support storing records in the inode core root
* xfs: allow inode-based btrees to reserve space in the data device
* xfs: introduce realtime rmap btree ondisk definitions
* xfs: realtime rmap btree transaction reservations
* xfs: add realtime rmap btree operations
* xfs: prepare rmap functions to deal with rtrmapbt
* xfs: add a realtime flag to the rmap update log redo items
* xfs: pretty print metadata file types in error messages
* xfs: support file data forks containing metadata btrees
* xfs: add realtime reverse map inode to metadata directory
* xfs: add metadata reservations for realtime rmap btrees
* xfs: wire up a new metafile type for the realtime rmap
* xfs: wire up rmap map and unmap to the realtime rmapbt
* xfs: create routine to allocate and initialize a realtime rmap btree inode
* xfs: report realtime rmap btree corruption errors to the health system
* xfs: scrub the realtime rmapbt
* xfs: scrub the metadir path of rt rmap btree files
* xfs: online repair of realtime bitmaps for a realtime group
* xfs: online repair of the realtime rmap btree
* xfs: create a shadow rmap btree during realtime rmap repair
* xfs: namespace the maximum length/refcount symbols
* xfs: introduce realtime refcount btree ondisk definitions
* xfs: realtime refcount btree transaction reservations
* xfs: add realtime refcount btree operations
* xfs: prepare refcount functions to deal with rtrefcountbt
* xfs: add a realtime flag to the refcount update log redo items
* xfs: add realtime refcount btree inode to metadata directory
* xfs: add metadata reservations for realtime refcount btree
* xfs: wire up a new metafile type for the realtime refcount
* xfs: wire up realtime refcount btree cursors
* xfs: create routine to allocate and initialize a realtime refcount btree inode
* xfs: update rmap to allow cow staging extents in the rt rmap
* xfs: compute rtrmap btree max levels when reflink enabled
* xfs: allow inodes to have the realtime and reflink flags
* xfs: recover CoW leftovers in the realtime volume
* xfs: fix xfs_get_extsz_hint behavior with realtime alwayscow files
* xfs: apply rt extent alignment constraints to CoW extsize hint
* xfs: enable extent size hints for CoW operations
* xfs: report realtime refcount btree corruption errors to the health system
* xfs: scrub the realtime refcount btree
* xfs: scrub the metadir path of rt refcount btree files
* xfs: fix the entry condition of exact EOF block allocation optimization
* xfs: mark xfs_dir_isempty static
* xfs: remove XFS_ILOG_NONCORE
* xfs: constify feature checks
* xfs/libxfs: replace kmalloc() and memcpy() with kmemdup()
---
include/kmem.h | 9
include/libxfs.h | 2
include/xfs_inode.h | 5
include/xfs_mount.h | 27 +
include/xfs_trace.h | 7
io/inject.c | 1
libxfs/Makefile | 4
libxfs/libxfs_priv.h | 11
libxfs/xfs_ag_resv.c | 3
libxfs/xfs_attr.c | 4
libxfs/xfs_bmap.c | 47 +-
libxfs/xfs_bmap_btree.c | 111 ++++
libxfs/xfs_bmap_btree.h | 3
libxfs/xfs_btree.c | 410 +++++++++++++---
libxfs/xfs_btree.h | 28 +
libxfs/xfs_btree_mem.c | 1
libxfs/xfs_btree_staging.c | 10
libxfs/xfs_defer.h | 2
libxfs/xfs_dir2.c | 9
libxfs/xfs_dir2.h | 1
libxfs/xfs_errortag.h | 4
libxfs/xfs_exchmaps.c | 4
libxfs/xfs_format.h | 51 ++
libxfs/xfs_fs.h | 10
libxfs/xfs_health.h | 6
libxfs/xfs_inode_buf.c | 65 ++-
libxfs/xfs_inode_fork.c | 201 +++-----
libxfs/xfs_inode_fork.h | 6
libxfs/xfs_log_format.h | 16 -
libxfs/xfs_metadir.c | 3
libxfs/xfs_metafile.c | 221 +++++++++
libxfs/xfs_metafile.h | 13 +
libxfs/xfs_ondisk.h | 4
libxfs/xfs_refcount.c | 277 +++++++++--
libxfs/xfs_refcount.h | 23 +
libxfs/xfs_rmap.c | 178 ++++++-
libxfs/xfs_rmap.h | 12
libxfs/xfs_rtbitmap.c | 2
libxfs/xfs_rtbitmap.h | 9
libxfs/xfs_rtgroup.c | 74 ++-
libxfs/xfs_rtgroup.h | 58 ++
libxfs/xfs_rtrefcount_btree.c | 755 ++++++++++++++++++++++++++++++
libxfs/xfs_rtrefcount_btree.h | 189 +++++++
libxfs/xfs_rtrmap_btree.c | 1034 +++++++++++++++++++++++++++++++++++++++++
libxfs/xfs_rtrmap_btree.h | 210 ++++++++
libxfs/xfs_sb.c | 14 +
libxfs/xfs_shared.h | 21 +
libxfs/xfs_trans_resv.c | 37 +
libxfs/xfs_trans_space.h | 13 +
libxfs/xfs_types.h | 7
repair/rmap.c | 2
repair/scan.c | 2
52 files changed, 3822 insertions(+), 394 deletions(-)
create mode 100644 libxfs/xfs_rtrefcount_btree.c
create mode 100644 libxfs/xfs_rtrefcount_btree.h
create mode 100644 libxfs/xfs_rtrmap_btree.c
create mode 100644 libxfs/xfs_rtrmap_btree.h