This work is based on a previous RFC[1] by Gao Xiang and various ideas proposed by Dave Chinner in the RFC[1]. Currently the functionality of shrink is limited to shrinking the last AG partially but not beyond that. This patch extends the functionality to support shrinking beyond 1 AG. However the AGs that we will be remove have to empty in order to prevent any loss of data. The patch begins with the re-introduction of some of the data structures that were removed, some code refactoring, then introduction of some helper functions and finally the patch that implements the multi AG shrink design. The final patch has all the details including the definition of the terminologies and the overall design. We will have the tests soon. [1] https://lore.kernel.org/all/20210414195240.1802221-1-hsiangkao@xxxxxxxxxx/ Nirjhar Roy (IBM) (3): xfs: Re-introduce xg_active_wq field in struct xfs_group xfs: Refactoring the nagcount and delta calculation xfs: Add support to shrink multiple empty AGs fs/xfs/libxfs/xfs_ag.c | 160 ++++++++++++++++++++- fs/xfs/libxfs/xfs_ag.h | 13 ++ fs/xfs/libxfs/xfs_alloc.c | 9 +- fs/xfs/libxfs/xfs_group.c | 4 +- fs/xfs/libxfs/xfs_group.h | 1 + fs/xfs/xfs_buf.c | 76 ++++++++++ fs/xfs/xfs_buf.h | 1 + fs/xfs/xfs_buf_item_recover.c | 37 +++-- fs/xfs/xfs_extent_busy.c | 28 ++++ fs/xfs/xfs_extent_busy.h | 2 + fs/xfs/xfs_fsops.c | 258 ++++++++++++++++++++++++++++++---- fs/xfs/xfs_trans.c | 1 - 12 files changed, 536 insertions(+), 54 deletions(-) -- 2.43.5