xfs: realtime rmap and reflink
Subsystems (2)
PATCH 42/43 xfs: fix CoW forks for realtime files
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
Port the copy on write fork repair to realtime files.
--- fs/xfs/scrub/agheader_repair.c | 2 fs/xfs/scrub/cow_repair.c | 178 +++++++++++++++++++++++++++-- fs/xfs/scrub/reap.c | 242 +++++++++++++++++++++++++++++++++++++++- fs/xfs/scrub/reap.h | 7 + fs/xfs/scrub/repair.h | 1 fs/xfs/scrub/rtb_bitmap.h | 37 ++++++ fs/xfs/scrub/trace.h | 36 ++++-- fs/xfs/xfs_rtalloc.c | 4 - fs/xfs/xfs_rtalloc.h | 5 + 9 files changed, 470 insertions(+), 42 deletions(-) create mode 100644 fs/xfs/scrub/rtb_bitmap.h
fs/xfs/scrub/agheader_repair.c +1 -1
@@ -647,7 +647,7 @@ xrep_agfl_fill(xfs_agblock_t agbno = start;int error; -trace_xrep_agfl_insert (sc->sa.pag, agbno, len); +trace_xrep_agfl_insert (pag_group (sc->sa.pag), agbno, len);while (agbno < start + len && af->fl_off < af->flcount) af->agfl_bno[af->fl_off++] =cpu_to_be32 (agbno++);
fs/xfs/scrub/cow_repair.c +161 -17
267 lines not on this page · raw message
fs/xfs/scrub/reap.c +234 -8
308 lines not on this page · raw message
fs/xfs/scrub/reap.h +7 -0
@@ -17,6 +17,13 @@ int xrep_reap_ifork(struct xfs_scrub *sc, struct xfs_inode *ip, int whichfork);int xrep_reap_metadir_fsblocks (struct xfs_scrub *sc,struct xfsb_bitmap *bitmap); +#ifdef CONFIG_XFS_RT +int xrep_reap_rtblocks (struct xfs_scrub *sc,struct xrtb_bitmap *bitmap, +const struct xfs_owner_info *oinfo); +#else +# define xrep_reap_rtblocks (...) (-EOPNOTSUPP) +#endif /* CONFIG_XFS_RT */ +/* Buffer cache scan context. */ struct xrep_bufscan {/* Disk address for the buffers we want to scan. */
fs/xfs/scrub/repair.h +1 -0
@@ -52,6 +52,7 @@ struct xbitmap;struct xagb_bitmap ;struct xrgb_bitmap ;struct xfsb_bitmap ; +struct xrtb_bitmap ;int xrep_fix_freelist (struct xfs_scrub *sc,int alloc_flags);
fs/xfs/scrub/rtb_bitmap.h new file +37 -0
@@ -0,0 +1,37 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* +* Copyright (c) 2022-2024 Oracle. All Rights Reserved. +* Author: Darrick J. Wong <[email protected]> +*/ +#ifndef __XFS_SCRUB_RTB_BITMAP_H__ +#define __XFS_SCRUB_RTB_BITMAP_H__ + +/* Bitmaps, but for type-checked for xfs_rtblock_t */ + +struct xrtb_bitmap { +struct xbitmap64 rtbitmap; +}; + +static inline void xrtb_bitmap_init (struct xrtb_bitmap *bitmap) +{ +xbitmap64_init (&bitmap->rtbitmap); +} + +static inline void xrtb_bitmap_destroy (struct xrtb_bitmap *bitmap) +{ +xbitmap64_destroy (&bitmap->rtbitmap); +} + +static inline int xrtb_bitmap_set (struct xrtb_bitmap *bitmap, +xfs_rtblock_t start,xfs_filblks_t len) +{ +return xbitmap64_set (&bitmap->rtbitmap, start, len); +} + +static inline int xrtb_bitmap_walk (struct xrtb_bitmap *bitmap, +xbitmap64_walk_fn fn,void *priv) +{ +return xbitmap64_walk (&bitmap->rtbitmap, fn, priv); +} + +#endif /* __XFS_SCRUB_RTB_BITMAP_H__ */
fs/xfs/scrub/trace.h +22 -14
@@ -1964,32 +1964,36 @@ DEFINE_XCHK_METAPATH_EVENT(xchk_metapath_lookup);#if IS_ENABLED (CONFIG_XFS_ONLINE_REPAIR )DECLARE_EVENT_CLASS (xrep_extent_class, - TP_PROTO(const struct xfs_perag *pag, xfs_agblock_t agbno, + TP_PROTO(const struct xfs_group *xg, xfs_agblock_t agbno, xfs_extlen_t len), -TP_ARGS (pag, agbno, len), +TP_ARGS (xg, agbno, len),TP_STRUCT__entry ( __field(dev_t, dev) + __field(enum xfs_group_type, type) __field(xfs_agnumber_t, agno) __field(xfs_agblock_t, agbno)__field (xfs_extlen_t, len) ),TP_fast_assign ( - __entry->dev = pag_mount(pag)->m_super->s_dev; - __entry->agno = pag_agno(pag); + __entry->dev = xg->xg_mount->m_super->s_dev; + __entry->type = xg->xg_type; + __entry->agno = xg->xg_gno; __entry->agbno = agbno; __entry->len = len; ), -TP_printk ("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x" , +TP_printk ("dev %d:%d %sno 0x%x %sbno 0x%x fsbcount 0x%x" ,MAJOR (__entry->dev),MINOR (__entry->dev), +__print_symbolic (__entry->type,XG_TYPE_STRINGS ), __entry->agno, +__print_symbolic (__entry->type,XG_TYPE_STRINGS ), __entry->agbno, __entry->len) );#define DEFINE_REPAIR_EXTENT_EVENT (name) \ DEFINE_EVENT(xrep_extent_class, name, \ - TP_PROTO(const struct xfs_perag *pag, xfs_agblock_t agbno, \ + TP_PROTO(const struct xfs_group *xg, xfs_agblock_t agbno, \ xfs_extlen_t len), \ - TP_ARGS(pag, agbno, len)) + TP_ARGS(xg, agbno, len))DEFINE_REPAIR_EXTENT_EVENT (xreap_dispose_unmap_extent);DEFINE_REPAIR_EXTENT_EVENT (xreap_dispose_free_extent);DEFINE_REPAIR_EXTENT_EVENT (xreap_agextent_binval);
@@ -1997,35 +2001,39 @@ DEFINE_REPAIR_EXTENT_EVENT(xreap_bmapi_binval);DEFINE_REPAIR_EXTENT_EVENT (xrep_agfl_insert);DECLARE_EVENT_CLASS (xrep_reap_find_class, - TP_PROTO(const struct xfs_perag *pag, xfs_agblock_t agbno, + TP_PROTO(const struct xfs_group *xg, xfs_agblock_t agbno, xfs_extlen_t len, bool crosslinked), -TP_ARGS (pag, agbno, len, crosslinked), +TP_ARGS (xg, agbno, len, crosslinked),TP_STRUCT__entry ( __field(dev_t, dev) + __field(enum xfs_group_type, type) __field(xfs_agnumber_t, agno) __field(xfs_agblock_t, agbno) __field(xfs_extlen_t, len)__field (bool, crosslinked) ),TP_fast_assign ( - __entry->dev = pag_mount(pag)->m_super->s_dev; - __entry->agno = pag_agno(pag); + __entry->dev = xg->xg_mount->m_super->s_dev; + __entry->type = xg->xg_type; + __entry->agno = xg->xg_gno; __entry->agbno = agbno; __entry->len = len; __entry->crosslinked = crosslinked; ), -TP_printk ("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x crosslinked %d" , +TP_printk ("dev %d:%d %sno 0x%x %sbno 0x%x fsbcount 0x%x crosslinked %d" ,MAJOR (__entry->dev),MINOR (__entry->dev), +__print_symbolic (__entry->type,XG_TYPE_STRINGS ), __entry->agno, +__print_symbolic (__entry->type,XG_TYPE_STRINGS ), __entry->agbno, __entry->len, __entry->crosslinked ?1 :0 ) );#define DEFINE_REPAIR_REAP_FIND_EVENT (name) \ DEFINE_EVENT(xrep_reap_find_class, name, \ - TP_PROTO(const struct xfs_perag *pag, xfs_agblock_t agbno, \ + TP_PROTO(const struct xfs_group *xg, xfs_agblock_t agbno, \ xfs_extlen_t len, bool crosslinked), \ - TP_ARGS(pag, agbno, len, crosslinked)) + TP_ARGS(xg, agbno, len, crosslinked))DEFINE_REPAIR_REAP_FIND_EVENT (xreap_agextent_select);DEFINE_REPAIR_REAP_FIND_EVENT (xreap_bmapi_select);
fs/xfs/xfs_rtalloc.c +2 -2
@@ -594,7 +594,7 @@ xfs_rtalloc_sumlevel(* specified. If we don't get maxlen then use prod to trim * the length, if given. The lengths are all in rtextents. */ -STATIC int +static int xfs_rtallocate_extent_size( struct xfs_rtalloc_args *args, xfs_rtxlen_t minlen, /* minimum length to allocate */
@@ -1958,7 +1958,7 @@ xfs_rtallocate_rtg( goto out_release; } -static int +int xfs_rtallocate_rtgs( struct xfs_trans *tp, xfs_fsblock_t bno_hint,
fs/xfs/xfs_rtalloc.h +5 -0
@@ -77,4 +77,9 @@ xfs_growfs_check_rtgeom(const struct xfs_mount *mp, }#endif /* CONFIG_XFS_RT */ +int xfs_rtallocate_rtgs (struct xfs_trans *tp,xfs_fsblock_t bno_hint, +xfs_rtxlen_t minlen,xfs_rtxlen_t maxlen,xfs_rtxlen_t prod, +bool wasdel,bool initial_user_data,xfs_rtblock_t *bno, +xfs_extlen_t *blen); +#endif /* __XFS_RTALLOC_H__ */
PATCH 43/43 xfs: enable realtime reflink
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
Enable reflink for realtime devices, as long as the realtime allocation unit is a single fsblock.
--- fs/xfs/xfs_reflink.c | 25 +++++++++++++++++++++++++ fs/xfs/xfs_reflink.h | 2 ++ fs/xfs/xfs_rtalloc.c | 7 +++++-- fs/xfs/xfs_super.c | 6 ++++-- 4 files changed, 36 insertions(+), 4 deletions(-)
fs/xfs/xfs_reflink.c +25 -0
@@ -1822,3 +1822,28 @@ xfs_reflink_unshare(trace_xfs_reflink_unshare_error (ip, error, _RET_IP_);return error; } + +/* +* Can we use reflink with this realtime extent size? Note that we don't check +* for rblocks > 0 here because this can be called as part of attaching a new +* rt section. +*/ +bool +xfs_reflink_supports_rextsize ( +struct xfs_mount *mp, +unsigned int rextsize) +{ +/* reflink on the realtime device requires rtgroups */ +if (!xfs_has_rtgroups (mp)) +return false; + +/* +* Reflink doesn't support rt extent size larger than a single fsblock +* because we would have to perform CoW-around for unaligned write +* requests to guarantee that we always remap entire rt extents. +*/ +if (rextsize !=1 ) +return false; + +return true; +}
fs/xfs/xfs_reflink.h +2 -0
@@ -62,4 +62,6 @@ extern int xfs_reflink_remap_blocks(struct xfs_inode *src, loff_t pos_in,extern int xfs_reflink_update_dest (struct xfs_inode *dest,xfs_off_t newlen,xfs_extlen_t cowextsize,unsigned int remap_flags); +bool xfs_reflink_supports_rextsize (struct xfs_mount *mp,unsigned int rextsize); +#endif /* __XFS_REFLINK_H */
fs/xfs/xfs_rtalloc.c +5 -2
@@ -32,6 +32,7 @@#include "xfs_error.h" #include "xfs_trace.h" #include "xfs_rtrefcount_btree.h" +#include "xfs_reflink.h" /* * Return whether there are any free extents in the size range given
@@ -1292,8 +1293,10 @@ xfs_growfs_rt( goto out_unlock;if (xfs_has_quota (mp)) goto out_unlock; - } -if (xfs_has_reflink (mp)) +if (xfs_has_reflink (mp)) + goto out_unlock; + }else if (xfs_has_reflink (mp) && + !xfs_reflink_supports_rextsize (mp, in->extsize)) goto out_unlock; error =xfs_sb_validate_fsb_count (&mp->m_sb, in->newblocks);
fs/xfs/xfs_super.c +4 -2
@@ -1754,9 +1754,11 @@ xfs_fs_fill_super(xfs_warn_experimental (mp,XFS_EXPERIMENTAL_METADIR );if (xfs_has_reflink (mp)) { -if (mp->m_sb.sb_rblocks) { +if (xfs_has_realtime (mp) && + !xfs_reflink_supports_rextsize (mp, mp->m_sb.sb_rextsize)) {xfs_alert (mp, -"reflink not compatible with realtime device!" ); +"reflink not compatible with realtime extent size %u!" , + mp->m_sb.sb_rextsize); error = -EINVAL ; goto out_filestream_unmount; }
[GIT PULL 1/5] xfs: bug fixes for 6.13
In reply to Darrick J. WongHi Carlos,
Please pull this branch with changes for xfs.
As usual, I did a test-merge with the main upstream branch as of a few minutes ago, and didn't see any conflicts. Please let me know if you encounter any problems.
--D
The following changes since commit 4bbf9020becbfd8fc2c3da790855b7042fad455b:
Linux 6.13-rc4 (2024-12-22 13:22:21 -0800)
are available in the Git repository at:
https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git tags/xfs-6.13-fixes_2024-12-23
for you to fetch changes up to 1aacd3fac248902ea1f7607f2d12b93929a4833b:
xfs: release the dquot buf outside of qli_lock (2024-12-23 13:06:01 -0800)
----------------------------------------------------------------
xfs: bug fixes for 6.13 [01/14]
Bug fixes for 6.13.
This has been running on the djcloud for months with no problems. Enjoy!
----------------------------------------------------------------
Darrick J. Wong (2):
xfs: don't over-report free space or inodes in statvfs
xfs: release the dquot buf outside of qli_lock
fs/xfs/xfs_dquot.c | 12 ++++++++---- fs/xfs/xfs_qm_bhv.c | 27 +++++++++++++++++----------
2 files changed, 25 insertions(+), 14 deletions(-)
Re: [GIT PULL 1/5] xfs: bug fixes for 6.13
Quoted 9 lines · Darrick J. Wong
Please pull this branch with changes for xfs.
As usual, I did a test-merge with the main upstream branch as of a few minutes ago, and didn't see any conflicts. Please let me know if you encounter any problems.
--D
[...]
Merged, thanks!
merge commit: 4f13f0a3fc6ad193e4d144a5e001b7b8f1fc4b7f
Best regards,
Signature · 1 line
Carlos Maiolino <[email protected]>
[GIT PULL 2/5] xfs: refactor btrees to support records in inode root
In reply to Darrick J. WongHi Carlos,
Please pull this branch with changes for xfs.
As usual, I did a test-merge with the main upstream branch as of a few minutes ago, and didn't see any conflicts. Please let me know if you encounter any problems.
--D
The following changes since commit 1aacd3fac248902ea1f7607f2d12b93929a4833b:
xfs: release the dquot buf outside of qli_lock (2024-12-23 13:06:01 -0800)
are available in the Git repository at:
https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git tags/btree-ifork-records_2024-12-23
for you to fetch changes up to 2f63b20b7a26c9a7c76ea5a6565ca38cd9e31282:
xfs: support storing records in the inode core root (2024-12-23 13:06:03 -0800)
----------------------------------------------------------------
xfs: refactor btrees to support records in inode root [v6.2 02/14]
Amend the btree code to support storing btree rcords in the inode root, because the current bmbt code does not support this.
This has been running on the djcloud for months with no problems. Enjoy!
----------------------------------------------------------------
Darrick J. Wong (8):
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: support storing records in the inode core root
fs/xfs/libxfs/xfs_bmap.c | 7 +- fs/xfs/libxfs/xfs_bmap_btree.c | 111 +++++++++++++ fs/xfs/libxfs/xfs_bmap_btree.h | 3 + fs/xfs/libxfs/xfs_btree.c | 333 ++++++++++++++++++++++++++++---------- fs/xfs/libxfs/xfs_btree.h | 18 ++- fs/xfs/libxfs/xfs_btree_staging.c | 9 +- fs/xfs/libxfs/xfs_inode_fork.c | 170 ++++++------------- fs/xfs/libxfs/xfs_inode_fork.h | 6 +- 8 files changed, 445 insertions(+), 212 deletions(-)
Re: [GIT PULL 2/5] xfs: refactor btrees to support records in inode root
Quoted 9 lines · Darrick J. Wong
Please pull this branch with changes for xfs.
As usual, I did a test-merge with the main upstream branch as of a few minutes ago, and didn't see any conflicts. Please let me know if you encounter any problems.
--D
[...]
Merged, thanks!
merge commit: af32541081ed6b6ad49b1ea38b5128cb319841b0
Best regards,
Signature · 1 line
Carlos Maiolino <[email protected]>
[GIT PULL 3/5] xfs: enable in-core block reservation for rt metadata
In reply to Darrick J. WongHi Carlos,
Please pull this branch with changes for xfs.
As usual, I did a test-merge with the main upstream branch as of a few minutes ago, and didn't see any conflicts. Please let me know if you encounter any problems.
--D
The following changes since commit 2f63b20b7a26c9a7c76ea5a6565ca38cd9e31282:
xfs: support storing records in the inode core root (2024-12-23 13:06:03 -0800)
are available in the Git repository at:
https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git tags/reserve-rt-metadata-space_2024-12-23
for you to fetch changes up to 05290bd5c6236b8ad659157edb36bd2d38f46d3e:
xfs: allow inode-based btrees to reserve space in the data device (2024-12-23 13:06:03 -0800)
----------------------------------------------------------------
xfs: enable in-core block reservation for rt metadata [v6.2 03/14]
In preparation for adding reverse mapping and refcounting to the realtime device, enhance the metadir code to reserve free space for btree shape changes as delayed allocation blocks.
This enables us to pre-allocate space for the rmap and refcount btrees in the same manner as we do for the data device counterparts, which is how we avoid ENOSPC failures when space is low but we've already committed to a COW operation.
This has been running on the djcloud for months with no problems. Enjoy!
----------------------------------------------------------------
Darrick J. Wong (2):
xfs: prepare to reuse the dquot pointer space in struct xfs_inode
xfs: allow inode-based btrees to reserve space in the data device
fs/xfs/libxfs/xfs_ag_resv.c | 3 + fs/xfs/libxfs/xfs_attr.c | 4 +- fs/xfs/libxfs/xfs_bmap.c | 4 +- fs/xfs/libxfs/xfs_errortag.h | 4 +- fs/xfs/libxfs/xfs_metadir.c | 4 + fs/xfs/libxfs/xfs_metafile.c | 205 +++++++++++++++++++++++++++++++++++++++++++ fs/xfs/libxfs/xfs_metafile.h | 11 +++ fs/xfs/libxfs/xfs_types.h | 7 ++ fs/xfs/scrub/tempfile.c | 1 + fs/xfs/xfs_dquot.h | 3 + fs/xfs/xfs_error.c | 3 + fs/xfs/xfs_exchrange.c | 3 + fs/xfs/xfs_fsops.c | 17 ++++ fs/xfs/xfs_inode.h | 16 +++- fs/xfs/xfs_mount.c | 10 +++ fs/xfs/xfs_mount.h | 1 + fs/xfs/xfs_qm.c | 2 + fs/xfs/xfs_quota.h | 5 -- fs/xfs/xfs_rtalloc.c | 21 +++++ fs/xfs/xfs_rtalloc.h | 5 ++ fs/xfs/xfs_trace.h | 45 ++++++++++ fs/xfs/xfs_trans.c | 4 + fs/xfs/xfs_trans_dquot.c | 8 +- 23 files changed, 367 insertions(+), 19 deletions(-)
Re: [GIT PULL 3/5] xfs: enable in-core block reservation for rt metadata
Quoted 9 lines · Darrick J. Wong
Please pull this branch with changes for xfs.
As usual, I did a test-merge with the main upstream branch as of a few minutes ago, and didn't see any conflicts. Please let me know if you encounter any problems.
--D
[...]
Merged, thanks!
merge commit: af32541081ed6b6ad49b1ea38b5128cb319841b0
Best regards,
Signature · 1 line
Carlos Maiolino <[email protected]>
[GIT PULL 4/5] xfs: realtime reverse-mapping support
In reply to Darrick J. WongHi Carlos,
Please pull this branch with changes for xfs.
As usual, I did a test-merge with the main upstream branch as of a few minutes ago, and didn't see any conflicts. Please let me know if you encounter any problems.
--D
The following changes since commit 05290bd5c6236b8ad659157edb36bd2d38f46d3e:
xfs: allow inode-based btrees to reserve space in the data device (2024-12-23 13:06:03 -0800)
are available in the Git repository at:
https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git tags/realtime-rmap_2024-12-23
for you to fetch changes up to c2358439af374cad47f771797875d0beb8256738:
xfs: enable realtime rmap btree (2024-12-23 13:06:09 -0800)
----------------------------------------------------------------
xfs: realtime reverse-mapping support [v6.2 04/14]
This is the latest revision of a patchset that adds to XFS kernel support for reverse mapping for the realtime device. This time around I've fixed some of the bitrot that I've noticed over the past few months, and most notably have converted rtrmapbt to use the metadata inode directory feature instead of burning more space in the superblock.
At the beginning of the set are patches to implement storing B+tree leaves in an inode root, since the realtime rmapbt is rooted in an inode, unlike the regular rmapbt which is rooted in an AG block. Prior to this, the only btree that could be rooted in the inode fork was the block mapping btree; if all the extent records fit in the inode, format would be switched from 'btree' to 'extents'.
The next few patches enhance the reverse mapping routines to handle the parts that are specific to rtgroups -- adding the new btree type, adding a new log intent item type, and wiring up the metadata directory tree entries.
Finally, implement GETFSMAP with the rtrmapbt and scrub functionality for the rtrmapbt and rtbitmap and online fsck functionality.
This has been running on the djcloud for months with no problems. Enjoy!
----------------------------------------------------------------
Darrick J. Wong (37):
xfs: add some rtgroup inode helpers
xfs: prepare rmap btree cursor tracepoints for realtime
xfs: simplify the xfs_rmap_{alloc,free}_extent calling conventions
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: support recovering rmap intent items targetting realtime extents
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: wire up getfsmap to the realtime reverse mapping btree
xfs: check that the rtrmapbt maxlevels doesn't increase when growing fs
xfs: report realtime rmap btree corruption errors to the health system
xfs: allow queued realtime intents to drain before scrubbing
xfs: scrub the realtime rmapbt
xfs: cross-reference realtime bitmap to realtime rmapbt scrubber
xfs: cross-reference the realtime rmapbt
xfs: scan rt rmap when we're doing an intense rmap check of bmbt mappings
xfs: scrub the metadir path of rt rmap btree files
xfs: walk the rt reverse mapping tree when rebuilding rmap
xfs: online repair of realtime file bmaps
xfs: repair inodes that have realtime extents
xfs: repair rmap btree inodes
xfs: online repair of realtime bitmaps for a realtime group
xfs: support repairing metadata btrees rooted in metadir inodes
xfs: online repair of the realtime rmap btree
xfs: create a shadow rmap btree during realtime rmap repair
xfs: hook live realtime rmap operations during a repair operation
xfs: don't shut down the filesystem for media failures beyond end of log
xfs: react to fsdax failure notifications on the rt device
xfs: enable realtime rmap btree
fs/xfs/Makefile | 3 + fs/xfs/libxfs/xfs_btree.c | 73 +++ fs/xfs/libxfs/xfs_btree.h | 8 +- fs/xfs/libxfs/xfs_btree_mem.c | 1 + fs/xfs/libxfs/xfs_btree_staging.c | 1 + fs/xfs/libxfs/xfs_defer.h | 1 + fs/xfs/libxfs/xfs_exchmaps.c | 4 +- fs/xfs/libxfs/xfs_format.h | 28 +- fs/xfs/libxfs/xfs_fs.h | 7 +- fs/xfs/libxfs/xfs_health.h | 4 +- fs/xfs/libxfs/xfs_inode_buf.c | 32 +- fs/xfs/libxfs/xfs_inode_fork.c | 25 + fs/xfs/libxfs/xfs_log_format.h | 6 +- fs/xfs/libxfs/xfs_log_recover.h | 2 + fs/xfs/libxfs/xfs_metafile.c | 18 + fs/xfs/libxfs/xfs_metafile.h | 2 + fs/xfs/libxfs/xfs_ondisk.h | 2 + fs/xfs/libxfs/xfs_refcount.c | 6 +- fs/xfs/libxfs/xfs_rmap.c | 171 +++++-- fs/xfs/libxfs/xfs_rmap.h | 12 +- fs/xfs/libxfs/xfs_rtbitmap.c | 2 +- fs/xfs/libxfs/xfs_rtbitmap.h | 9 + fs/xfs/libxfs/xfs_rtgroup.c | 53 +- fs/xfs/libxfs/xfs_rtgroup.h | 49 +- fs/xfs/libxfs/xfs_rtrmap_btree.c | 1011 +++++++++++++++++++++++++++++++++++++ fs/xfs/libxfs/xfs_rtrmap_btree.h | 210 ++++++++ fs/xfs/libxfs/xfs_sb.c | 6 + fs/xfs/libxfs/xfs_shared.h | 14 + fs/xfs/libxfs/xfs_trans_resv.c | 12 +- fs/xfs/libxfs/xfs_trans_space.h | 13 + fs/xfs/scrub/alloc_repair.c | 5 +- fs/xfs/scrub/bmap.c | 108 +++- fs/xfs/scrub/bmap_repair.c | 129 ++++- fs/xfs/scrub/common.c | 160 +++++- fs/xfs/scrub/common.h | 23 +- fs/xfs/scrub/health.c | 1 + fs/xfs/scrub/inode.c | 10 +- fs/xfs/scrub/inode_repair.c | 136 ++++- fs/xfs/scrub/metapath.c | 3 + fs/xfs/scrub/newbt.c | 42 ++ fs/xfs/scrub/newbt.h | 1 + fs/xfs/scrub/reap.c | 41 ++ fs/xfs/scrub/reap.h | 2 + fs/xfs/scrub/repair.c | 191 +++++++ fs/xfs/scrub/repair.h | 17 + fs/xfs/scrub/rgsuper.c | 6 +- fs/xfs/scrub/rmap_repair.c | 84 ++- fs/xfs/scrub/rtbitmap.c | 75 ++- fs/xfs/scrub/rtbitmap.h | 55 ++ fs/xfs/scrub/rtbitmap_repair.c | 429 +++++++++++++++- fs/xfs/scrub/rtrmap.c | 271 ++++++++++ fs/xfs/scrub/rtrmap_repair.c | 903 +++++++++++++++++++++++++++++++++ fs/xfs/scrub/rtsummary.c | 17 +- fs/xfs/scrub/rtsummary_repair.c | 3 +- fs/xfs/scrub/scrub.c | 11 +- fs/xfs/scrub/scrub.h | 14 + fs/xfs/scrub/stats.c | 1 + fs/xfs/scrub/tempexch.h | 2 +- fs/xfs/scrub/tempfile.c | 20 +- fs/xfs/scrub/trace.c | 1 + fs/xfs/scrub/trace.h | 228 ++++++++- fs/xfs/xfs_buf.c | 1 + fs/xfs/xfs_buf_item_recover.c | 4 + fs/xfs/xfs_drain.c | 20 +- fs/xfs/xfs_drain.h | 7 +- fs/xfs/xfs_fsmap.c | 174 ++++++- fs/xfs/xfs_fsops.c | 11 + fs/xfs/xfs_health.c | 1 + fs/xfs/xfs_inode.c | 19 +- fs/xfs/xfs_inode_item.c | 2 + fs/xfs/xfs_inode_item_recover.c | 44 +- fs/xfs/xfs_log_recover.c | 2 + fs/xfs/xfs_mount.c | 5 +- fs/xfs/xfs_mount.h | 9 + fs/xfs/xfs_notify_failure.c | 230 +++++---- fs/xfs/xfs_notify_failure.h | 11 + fs/xfs/xfs_qm.c | 8 +- fs/xfs/xfs_rmap_item.c | 216 +++++++- fs/xfs/xfs_rtalloc.c | 82 ++- fs/xfs/xfs_rtalloc.h | 10 + fs/xfs/xfs_stats.c | 4 +- fs/xfs/xfs_stats.h | 2 + fs/xfs/xfs_super.c | 6 - fs/xfs/xfs_super.h | 1 - fs/xfs/xfs_trace.h | 104 ++-- 85 files changed, 5381 insertions(+), 366 deletions(-)
create mode 100644 fs/xfs/libxfs/xfs_rtrmap_btree.c create mode 100644 fs/xfs/libxfs/xfs_rtrmap_btree.h create mode 100644 fs/xfs/scrub/rtrmap.c create mode 100644 fs/xfs/scrub/rtrmap_repair.c create mode 100644 fs/xfs/xfs_notify_failure.h
Re: [GIT PULL 4/5] xfs: realtime reverse-mapping support
Quoted 9 lines · Darrick J. Wong
Please pull this branch with changes for xfs.
As usual, I did a test-merge with the main upstream branch as of a few minutes ago, and didn't see any conflicts. Please let me know if you encounter any problems.
--D
[...]
Merged, thanks!
merge commit: 0d89af530c8c7591f75492e5814aa1ca4a0d26d7
Best regards,
Signature · 1 line
Carlos Maiolino <[email protected]>
[GIT PULL 5/5] xfs: reflink on the realtime device
In reply to Darrick J. WongHi Carlos,
Please pull this branch with changes for xfs.
As usual, I did a test-merge with the main upstream branch as of a few minutes ago, and didn't see any conflicts. Please let me know if you encounter any problems.
--D
The following changes since commit c2358439af374cad47f771797875d0beb8256738:
xfs: enable realtime rmap btree (2024-12-23 13:06:09 -0800)
are available in the Git repository at:
https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git tags/realtime-reflink_2024-12-23
for you to fetch changes up to 155debbe7e627baf6439e75f15856d40ec115c5d:
xfs: enable realtime reflink (2024-12-23 13:06:17 -0800)
----------------------------------------------------------------
xfs: reflink on the realtime device [v6.2 05/14]
This patchset enables use of the file data block sharing feature (i.e. reflink) on the realtime device. It follows the same basic sequence as the realtime rmap series -- first a few cleanups; then introduction of the new btree format and inode fork format. Next comes enabling CoW and remapping for the rt device; new scrub, repair, and health reporting code; and at the end we implement some code to lengthen write requests so that rt extents are always CoWed fully.
This has been running on the djcloud for months with no problems. Enjoy!
----------------------------------------------------------------
Christoph Hellwig (1):
xfs: refactor xfs_reflink_find_shared
Darrick J. Wong (42):
xfs: prepare refcount btree cursor tracepoints for realtime
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: support recovering refcount intent items targetting realtime extents
xfs: add realtime refcount btree block detection to log recovery
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: refactor reflink quota updates
xfs: enable CoW for realtime data
xfs: enable sharing of realtime file blocks
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: check that the rtrefcount maxlevels doesn't increase when growing fs
xfs: report realtime refcount btree corruption errors to the health system
xfs: scrub the realtime refcount btree
xfs: cross-reference checks with the rt refcount btree
xfs: allow overlapping rtrmapbt records for shared data extents
xfs: check reference counts of gaps between rt refcount records
xfs: allow dquot rt block count to exceed rt blocks on reflink fs
xfs: detect and repair misaligned rtinherit directory cowextsize hints
xfs: scrub the metadir path of rt refcount btree files
xfs: don't flag quota rt block usage on rtreflink filesystems
xfs: check new rtbitmap records against rt refcount btree
xfs: walk the rt reference count tree when rebuilding rmap
xfs: capture realtime CoW staging extents when rebuilding rt rmapbt
xfs: online repair of the realtime refcount btree
xfs: repair inodes that have a refcount btree in the data fork
xfs: check for shared rt extents when rebuilding rt file's data fork
xfs: fix CoW forks for realtime files
xfs: enable realtime reflink
fs/xfs/Makefile | 3 + fs/xfs/libxfs/xfs_bmap.c | 23 +- fs/xfs/libxfs/xfs_btree.c | 5 + fs/xfs/libxfs/xfs_btree.h | 2 +- fs/xfs/libxfs/xfs_defer.h | 1 + fs/xfs/libxfs/xfs_format.h | 25 +- fs/xfs/libxfs/xfs_fs.h | 7 +- fs/xfs/libxfs/xfs_health.h | 4 +- fs/xfs/libxfs/xfs_inode_buf.c | 33 +- fs/xfs/libxfs/xfs_inode_fork.c | 6 + fs/xfs/libxfs/xfs_log_format.h | 6 +- fs/xfs/libxfs/xfs_log_recover.h | 2 + fs/xfs/libxfs/xfs_ondisk.h | 2 + fs/xfs/libxfs/xfs_refcount.c | 276 +++++++++--- fs/xfs/libxfs/xfs_refcount.h | 23 +- fs/xfs/libxfs/xfs_rmap.c | 7 + fs/xfs/libxfs/xfs_rtgroup.c | 19 + fs/xfs/libxfs/xfs_rtgroup.h | 11 +- fs/xfs/libxfs/xfs_rtrefcount_btree.c | 757 +++++++++++++++++++++++++++++++++ fs/xfs/libxfs/xfs_rtrefcount_btree.h | 189 +++++++++ fs/xfs/libxfs/xfs_rtrmap_btree.c | 28 +- fs/xfs/libxfs/xfs_sb.c | 8 + fs/xfs/libxfs/xfs_shared.h | 7 + fs/xfs/libxfs/xfs_trans_resv.c | 25 +- fs/xfs/scrub/agheader_repair.c | 2 +- fs/xfs/scrub/bmap.c | 30 +- fs/xfs/scrub/bmap_repair.c | 21 +- fs/xfs/scrub/common.c | 10 + fs/xfs/scrub/common.h | 5 +- fs/xfs/scrub/cow_repair.c | 180 +++++++- fs/xfs/scrub/health.c | 1 + fs/xfs/scrub/inode.c | 31 +- fs/xfs/scrub/inode_repair.c | 57 ++- fs/xfs/scrub/metapath.c | 3 + fs/xfs/scrub/quota.c | 8 +- fs/xfs/scrub/quota_repair.c | 2 +- fs/xfs/scrub/reap.c | 247 ++++++++++- fs/xfs/scrub/reap.h | 7 + fs/xfs/scrub/refcount.c | 2 +- fs/xfs/scrub/refcount_repair.c | 6 +- fs/xfs/scrub/repair.c | 6 + fs/xfs/scrub/repair.h | 7 + fs/xfs/scrub/rgb_bitmap.h | 37 ++ fs/xfs/scrub/rmap_repair.c | 7 + fs/xfs/scrub/rtb_bitmap.h | 37 ++ fs/xfs/scrub/rtbitmap.c | 2 + fs/xfs/scrub/rtbitmap_repair.c | 24 +- fs/xfs/scrub/rtrefcount.c | 661 +++++++++++++++++++++++++++++ fs/xfs/scrub/rtrefcount_repair.c | 783 +++++++++++++++++++++++++++++++++++ fs/xfs/scrub/rtrmap.c | 54 ++- fs/xfs/scrub/rtrmap_repair.c | 103 +++++ fs/xfs/scrub/scrub.c | 7 + fs/xfs/scrub/scrub.h | 12 + fs/xfs/scrub/stats.c | 1 + fs/xfs/scrub/trace.h | 54 ++- fs/xfs/xfs_buf_item_recover.c | 4 + fs/xfs/xfs_fsmap.c | 25 +- fs/xfs/xfs_fsops.c | 2 + fs/xfs/xfs_health.c | 1 + fs/xfs/xfs_inode_item.c | 14 + fs/xfs/xfs_inode_item_recover.c | 4 + fs/xfs/xfs_ioctl.c | 21 +- fs/xfs/xfs_log_recover.c | 2 + fs/xfs/xfs_mount.c | 5 +- fs/xfs/xfs_mount.h | 9 + fs/xfs/xfs_refcount_item.c | 240 ++++++++++- fs/xfs/xfs_reflink.c | 325 +++++++++++---- fs/xfs/xfs_reflink.h | 4 +- fs/xfs/xfs_rtalloc.c | 24 +- fs/xfs/xfs_rtalloc.h | 5 + fs/xfs/xfs_stats.c | 3 +- fs/xfs/xfs_stats.h | 1 + fs/xfs/xfs_super.c | 6 +- fs/xfs/xfs_trace.h | 111 +++-- 74 files changed, 4330 insertions(+), 352 deletions(-)
create mode 100644 fs/xfs/libxfs/xfs_rtrefcount_btree.c create mode 100644 fs/xfs/libxfs/xfs_rtrefcount_btree.h create mode 100644 fs/xfs/scrub/rgb_bitmap.h create mode 100644 fs/xfs/scrub/rtb_bitmap.h create mode 100644 fs/xfs/scrub/rtrefcount.c create mode 100644 fs/xfs/scrub/rtrefcount_repair.c
Re: [GIT PULL 5/5] xfs: reflink on the realtime device
Quoted 9 lines · Darrick J. Wong
Please pull this branch with changes for xfs.
As usual, I did a test-merge with the main upstream branch as of a few minutes ago, and didn't see any conflicts. Please let me know if you encounter any problems.
--D
[...]
Merged, thanks!
merge commit: 156d1c389c543c4620dd86ad8636ecb224be0376
Best regards,
Signature · 1 line
Carlos Maiolino <[email protected]>