[RFC PATCH 0/4] xfs: support shrinking empty AGs

Gao Xiang
2021-04-14T19:53:23Z

Hi folks,

Sorry for some delay... After "support shrinking unused space in
the last AG" patchset was settled for-next, I spent some time working
on arranging this patchset in order to shrink empty AGs as well.

As mentioned before, freespace can be shrinked atomicly with the
following steps:

- make sure the pending-for-discard AGs are all stablized as empty;
- a transaction to
fix up freespace btrees for the target tail AG;
decrease agcount to the target value.

All pending-for-discard per-ags will be marked as inactive in advance
and excluded from most fs paths. A per-ag lock is used to stablize
the inactive status together with agi/agf buffer lock. It also
introduces a new max_agcount in order to free such inactive perags.

This patchset has been preliminary manually tested by hand and it
seems work. but I still haven't tested with other fs workloads
together. I will work on refine previous fstests to cover this.
But meanwhile I think it'd be better hear more ideas about this
first.

Kindly point out any strange or what I'm missing so I could revise
it and get it in shape as soon as possible...

xfsprogs is still:
https://lore.kernel.org/r/20210326024631.12921-1-hsiangkao@aol.com

Thanks for your time!

Thanks,
Gao Xiang

Gao Xiang (4):
xfs: support deactivating AGs
xfs: check ag is empty
xfs: introduce max_agcount
xfs: support shrinking empty AGs

fs/xfs/libxfs/xfs_ag.c | 17 ++++-
fs/xfs/libxfs/xfs_ag.h | 2 +-
fs/xfs/libxfs/xfs_alloc.c | 111 +++++++++++++++++++++++++++-
fs/xfs/libxfs/xfs_alloc.h | 4 +
fs/xfs/libxfs/xfs_bmap.c | 8 +-
fs/xfs/libxfs/xfs_ialloc.c | 28 ++++++-
fs/xfs/libxfs/xfs_sb.c | 1 +
fs/xfs/xfs_extent_busy.c | 2 +-
fs/xfs/xfs_fsops.c | 148 ++++++++++++++++++++++++++++++++++---
fs/xfs/xfs_mount.c | 89 ++++++++++++++++++----
fs/xfs/xfs_mount.h | 7 ++
fs/xfs/xfs_trans.c | 3 +-
12 files changed, 379 insertions(+), 41 deletions(-)

--
2.27.0