Hi folks, v5: https://lore.kernel.org/r/20210118083700.2384277-1-hsiangkao@xxxxxxxxxx This patchset attempts to support shrinking free space in the last AG. This version addresses Darrick's review of v5, aside from that I'm not sure if seperating the whole shrink functionality is a good idea (I just tried but it seemed that ~90% is duplicated code.) IMHO, It'd be better to separate when needed (I'm investigating shrinking the whole AGs as well, it seems not too much invasive than the current approach...) Yet if people have strong opinion of this, I will resend the next version instead. Thanks for the time! Thanks, Gao Xiang xfsprogs: https://lore.kernel.org/r/20201028114010.545331-1-hsiangkao@xxxxxxxxxx xfstests: https://lore.kernel.org/r/20201028230909.639698-1-hsiangkao@xxxxxxxxxx Changes since v5 (Darrick): - [3/7] use a separate patch to update lazy sb counters; - [5/7] introduce the xfs_ag_shrink_space() helper first as a seperate patch... I think it'd be better to "define xfs_ag_shrink_space() as a stub that returns EOPNOSUPP..." - [5/7] roll the transaction in advance so the new trans can be canceled safely. - [6/7] "nagcount != oagcount" ==> "nagcount < oagcount" Gao Xiang (7): xfs: rename `new' to `delta' in xfs_growfs_data_private() xfs: get rid of xfs_growfs_{data,log}_t xfs: update lazy sb counters immediately for resizefs xfs: hoist out xfs_resizefs_init_new_ags() xfs: introduce xfs_ag_shrink_space() xfs: support shrinking unused space in the last AG xfs: add error injection for per-AG resv failure when shrinkfs fs/xfs/libxfs/xfs_ag.c | 113 +++++++++++++++++++++++++ fs/xfs/libxfs/xfs_ag.h | 2 + fs/xfs/libxfs/xfs_errortag.h | 4 +- fs/xfs/xfs_error.c | 2 + fs/xfs/xfs_fsops.c | 158 ++++++++++++++++++++++------------- fs/xfs/xfs_fsops.h | 4 +- fs/xfs/xfs_ioctl.c | 4 +- fs/xfs/xfs_trans.c | 1 - 8 files changed, 224 insertions(+), 64 deletions(-) -- 2.27.0