Skip to content

RFC xfs: Add support to shrink multiple empty rtgroups

Nirjhar Roy (IBM) fstests linux-xfs 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest4 patches 10 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4xfs: Re-introduce xg_active_wq field in struct xfs_groupfs/xfs/libxfs/xfs_group.c fs/xfs/libxfs/xfs_group.h+5 -11 reply
2/4xfs: Introduce xfs_rtginodes_ensure_all()fs/xfs/libxfs/xfs_rtgroup.h fs/xfs/xfs_rtalloc.c+21 -62 replies
3/4xfs: Add a new state for shrinkingfs/xfs/xfs_mount.h+3 -00 replies
4/4xfs: Add support to shrink multiple empty realtime groupsfs/xfs/libxfs/xfs_group.c fs/xfs/libxfs/xfs_group.h fs/xfs/libxfs/xfs_rtgroup.c +7 more+994 -214 replies

Reviews trailers per patch

1 of 4 patches has a Reviewed-by or Acked-by.

PatchDarrick J. WongGao Xiang
1/4R-b
2/4
3/4
4/4Inspired-by

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [RFC v1 0/4] xfs: Add support to shrink multiple empty rtgroups

From: "Nirjhar Roy (IBM)" <[email protected]>

This work is based on a previous RFC[1] by Gao Xiang and various ideas proposed by Dave Chinner in the RFC[1].

The patch begins with the re-introduction of some of the data structures that were removed, some code refactoring and finally the patch that implements the multi rtgroup shrink design. We can remove only those rtgroups which are empty.
For non-empty rtgroups the rtextents can migrated to other rtgroups (assuming the required amount of space is available).
I am working on the patch series [2](by Darrick and
Dave) for completion of the data block migration from the end of the filesystem for emptying an realtime group. That will be a future work after this.
The final patch has all the details including the definition of the terminologies and the overall design.

The design is quite similar to the design of data AG removal implemented in the patch series[3] that I have posted earlier.
The reason for keeping [3] on hold and posting this patch series is that (based on the discussion in [5], [6]), realtime devices won't have any metadata/inodes and migrating data from the end of realtime devices will be simpler. On the other hand there are challenges in moving metadata from regular AGs especially inodes.

Please note that I have added RBs from Darrick in patch 1 which was given in [4].

Instructions to test this patch:

$ Apply the patch for xfsprogs sent with this series and install it.
$ mkfs.xfs -f -m metadir=1  -r rtdev=/dev/loop2,extsize=4096,rgcount=4,size=1G \
	-d size=1G /dev/loop1
$ mount -o rtdev=/dev/loop2 /dev/loop1 /mnt/scratch
$ # shrink by 1.5 rtgroups
$ xfs_growfs -R $(( 65536 * 2 + 32768 ))  /mnt1/scratch

I have also sent the tests.

[1] https://lore.kernel.org/all/[email protected]/
[2] https://lore.kernel.org/linux-xfs/173568777852.2709794.6356870909327619205.stgit@frogsfrogsfrogs/
[3] https://lore.kernel.org/linux-xfs/[email protected]/
[4] https://lore.kernel.org/all/20250729202632.GF2672049@frogsfrogsfrogs/
[5] https://lore.kernel.org/linux-xfs/[email protected]/
[6] https://lore.kernel.org/linux-xfs/[email protected]/

Nirjhar Roy (IBM) (4):
xfs: Re-introduce xg_active_wq field in struct xfs_group
xfs: Introduce xfs_rtginodes_ensure_all()
xfs: Add a new state for shrinking
xfs: Add support to shrink multiple empty realtime groups

 fs/xfs/libxfs/xfs_group.c     |  18 +-
 fs/xfs/libxfs/xfs_group.h     |   4 +
 fs/xfs/libxfs/xfs_rtgroup.c   | 105 ++++-
 fs/xfs/libxfs/xfs_rtgroup.h   |  31 ++
 fs/xfs/xfs_buf_item_recover.c |  25 +-
 fs/xfs/xfs_extent_busy.c      |  30 ++
 fs/xfs/xfs_extent_busy.h      |   2 +
 fs/xfs/xfs_inode.c            |   8 +-
 fs/xfs/xfs_mount.h            |   3 +
 fs/xfs/xfs_rtalloc.c          | 824 +++++++++++++++++++++++++++++++++-
 fs/xfs/xfs_trans.c            |   1 -
 11 files changed, 1023 insertions(+), 28 deletions(-)

--
2.43.5