Hi Linus, Please pull this branch with changes for xfs for 6.3-rc1. This second pull request contains a fix for a deadlock in the allocator. It continues the slow march towards being able to offline AGs, and it refactors the interface to the xfs allocator to be less indirection happy. 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 dd07bb8b6baf2389caff221f043d9188ce6bab8c: xfs: revert commit 8954c44ff477 (2023-02-10 09:06:06 -0800) are available in the Git repository at: git://git.kernel.org/pub/scm/fs/xfs/xfs-linux.git tags/xfs-6.3-merge-4 for you to fetch changes up to 6e2985c938e8b765b3de299c561d87f98330c546: xfs: restore old agirotor behavior (2023-02-27 08:53:45 -0800) ---------------------------------------------------------------- New code for 6.3-rc1, part 2: * Fix a deadlock in the free space allocator due to the AG-walking algorithm forgetting to follow AG-order locking rules. * Make the inode allocator prefer existing free inodes instead of failing to allocate new inode chunks when free space is low. * Set minleft correctly when setting allocator parameters for bmap changes. * Fix uninitialized variable access in the getfsmap code. * Make a distinction between active and passive per-AG structure references. For now, active references are taken to perform some work in an AG on behalf of a high level operation; passive references are used by lower level code to finish operations started by other threads. Eventually this will become part of online shrink. * Split out all the different allocator strategies into separate functions to move us away from design antipattern of filling out a huge structure for various differentish things and issuing a single function multiplexing call. * Various cleanups in the filestreams allocator code, which we might very well want to deprecate instead of continuing. * Fix a bug with the agi rotor code that was introduced earlier in this series. Signed-off-by: Darrick J. Wong <djwong@xxxxxxxxxx> ---------------------------------------------------------------- Darrick J. Wong (3): Merge tag 'xfs-alloc-perag-conversion' of git://git.kernel.org/pub/scm/linux/kernel/git/dgc/linux-xfs into xfs-6.3-merge-A xfs: fix uninitialized variable access xfs: restore old agirotor behavior Dave Chinner (42): xfs: fix low space alloc deadlock xfs: prefer free inodes at ENOSPC over chunk allocation xfs: block reservation too large for minleft allocation xfs: drop firstblock constraints from allocation setup xfs: t_firstblock is tracking AGs not blocks xfs: don't assert fail on transaction cancel with deferred ops xfs: active perag reference counting xfs: rework the perag trace points to be perag centric xfs: convert xfs_imap() to take a perag xfs: use active perag references for inode allocation xfs: inobt can use perags in many more places than it does xfs: convert xfs_ialloc_next_ag() to an atomic xfs: perags need atomic operational state xfs: introduce xfs_for_each_perag_wrap() xfs: rework xfs_alloc_vextent() xfs: factor xfs_alloc_vextent_this_ag() for _iterate_ags() xfs: combine __xfs_alloc_vextent_this_ag and xfs_alloc_ag_vextent xfs: use xfs_alloc_vextent_this_ag() where appropriate xfs: factor xfs_bmap_btalloc() xfs: use xfs_alloc_vextent_first_ag() where appropriate xfs: use xfs_alloc_vextent_start_bno() where appropriate xfs: introduce xfs_alloc_vextent_near_bno() xfs: introduce xfs_alloc_vextent_exact_bno() xfs: introduce xfs_alloc_vextent_prepare() xfs: move allocation accounting to xfs_alloc_vextent_set_fsbno() xfs: fold xfs_alloc_ag_vextent() into callers xfs: move the minimum agno checks into xfs_alloc_vextent_check_args xfs: convert xfs_alloc_vextent_iterate_ags() to use perag walker xfs: convert trim to use for_each_perag_range xfs: factor out filestreams from xfs_bmap_btalloc_nullfb xfs: get rid of notinit from xfs_bmap_longest_free_extent xfs: use xfs_bmap_longest_free_extent() in filestreams xfs: move xfs_bmap_btalloc_filestreams() to xfs_filestreams.c xfs: merge filestream AG lookup into xfs_filestream_select_ag() xfs: merge new filestream AG selection into xfs_filestream_select_ag() xfs: remove xfs_filestream_select_ag() longest extent check xfs: factor out MRU hit case in xfs_filestream_select_ag xfs: track an active perag reference in filestreams xfs: use for_each_perag_wrap in xfs_filestream_pick_ag xfs: pass perag to filestreams tracing xfs: return a referenced perag from filestreams allocator xfs: refactor the filestreams allocator pick functions fs/xfs/libxfs/xfs_ag.c | 93 ++++- fs/xfs/libxfs/xfs_ag.h | 111 +++++- fs/xfs/libxfs/xfs_ag_resv.c | 2 +- fs/xfs/libxfs/xfs_alloc.c | 685 +++++++++++++++++++++++-------------- fs/xfs/libxfs/xfs_alloc.h | 61 ++-- fs/xfs/libxfs/xfs_alloc_btree.c | 2 +- fs/xfs/libxfs/xfs_bmap.c | 672 +++++++++++++++++------------------- fs/xfs/libxfs/xfs_bmap.h | 7 + fs/xfs/libxfs/xfs_bmap_btree.c | 64 ++-- fs/xfs/libxfs/xfs_btree.c | 2 +- fs/xfs/libxfs/xfs_ialloc.c | 242 ++++++------- fs/xfs/libxfs/xfs_ialloc.h | 5 +- fs/xfs/libxfs/xfs_ialloc_btree.c | 47 ++- fs/xfs/libxfs/xfs_ialloc_btree.h | 20 +- fs/xfs/libxfs/xfs_refcount_btree.c | 10 +- fs/xfs/libxfs/xfs_rmap_btree.c | 2 +- fs/xfs/libxfs/xfs_sb.c | 3 +- fs/xfs/scrub/agheader_repair.c | 35 +- fs/xfs/scrub/bmap.c | 2 +- fs/xfs/scrub/common.c | 21 +- fs/xfs/scrub/fscounters.c | 13 +- fs/xfs/scrub/repair.c | 7 +- fs/xfs/xfs_bmap_util.c | 2 +- fs/xfs/xfs_discard.c | 50 ++- fs/xfs/xfs_filestream.c | 455 ++++++++++++------------ fs/xfs/xfs_filestream.h | 6 +- fs/xfs/xfs_fsmap.c | 5 +- fs/xfs/xfs_icache.c | 8 +- fs/xfs/xfs_inode.c | 2 +- fs/xfs/xfs_iwalk.c | 10 +- fs/xfs/xfs_mount.h | 3 +- fs/xfs/xfs_reflink.c | 4 +- fs/xfs/xfs_super.c | 47 ++- fs/xfs/xfs_trace.h | 81 ++--- fs/xfs/xfs_trans.c | 8 +- fs/xfs/xfs_trans.h | 2 +- 36 files changed, 1541 insertions(+), 1248 deletions(-)