• Darrick J. Wong's avatar
    Merge tag 'inode-walk-cleanups-5.14_2021-06-03' of... · ffc18582
    Darrick J. Wong authored
    Merge tag 'inode-walk-cleanups-5.14_2021-06-03' of https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux into xfs-5.14-merge2
    
    xfs: clean up incore inode walk functions
    
    This ambitious series aims to cleans up redundant inode walk code in
    xfs_icache.c, hide implementation details of the quotaoff dquot release
    code, and eliminates indirect function calls from incore inode walks.
    
    The first thing it does is to move all the code that quotaoff calls to
    release dquots from all incore inodes into xfs_icache.c.  Next, it
    separates the goal of an inode walk from the actual radix tree tags that
    may or may not be involved and drops the kludgy XFS_ICI_NO_TAG thing.
    Finally, we split the speculative preallocation (blockgc) and quotaoff
    dquot release code paths into separate functions so that we can keep the
    implementations cohesive.
    
    Christoph suggested last cycle that we 'simply' change quotaoff not to
    allow deactivating quota entirely, but as these cleanups are to enable
    one major change in behavior (deferred inode inactivation) I do not want
    to add a second behavior change (quotaoff) as a dependency.
    
    To be blunt: Additional cleanups are not in scope for this series.
    
    Next, I made two observations about incore inode radix tree walks --
    since there's a 1:1 mapping between the walk goal and the per-inode
    processing function passed in, we can use the goal to make a direct call
    to the processing function.  Furthermore, the only caller to supply a
    nonzero iter_flags argument is quotaoff, and there's only one INEW flag.
    
    From that observation, I concluded that it's quite possible to remove
    two parameters from the xfs_inode_walk* function signatures -- the
    iter_flags, and the execute function pointer.  The middle of the series
    moves the INEW functionality into the one piece (quotaoff) that wants
    it, and removes the indirect calls.
    
    The final observation is that the inode reclaim walk loop is now almost
    the same as xfs_inode_walk, so it's silly to maintain two copies.  Merge
    the reclaim loop code into xfs_inode_walk.
    
    Lastly, refactor the per-ag radix tagging functions since there's
    duplicated code that can be consolidated.
    
    This series is a prerequisite for the next two patchsets, since deferred
    inode inactivation will add another inode radix tree tag and iterator
    function to xfs_inode_walk.
    
    v2: walk the vfs inode list when running quotaoff instead of the radix
        tree, then rework the (now completely internal) inode walk function
        to take the tag as the main parameter.
    v3: merge the reclaim loop into xfs_inode_walk, then consolidate the
        radix tree tagging functions
    v4: rebase to 5.13-rc4
    v5: combine with the quotaoff patchset, reorder functions to minimize
        forward declarations, split inode walk goals from radix tree tags
        to reduce conceptual confusion
    v6: start moving the inode cache code towards the xfs_icwalk prefix
    
    * tag 'inode-walk-cleanups-5.14_2021-06-03' of https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux:
      xfs: refactor per-AG inode tagging functions
      xfs: merge xfs_reclaim_inodes_ag into xfs_inode_walk_ag
      xfs: pass struct xfs_eofblocks to the inode scan callback
      xfs: fix radix tree tag signs
      xfs: make the icwalk processing functions clean up the grab state
      xfs: clean up inode state flag tests in xfs_blockgc_igrab
      xfs: remove indirect calls from xfs_inode_walk{,_ag}
      xfs: remove iter_flags parameter from xfs_inode_walk_*
      xfs: move xfs_inew_wait call into xfs_dqrele_inode
      xfs: separate the dqrele_all inode grab logic from xfs_inode_walk_ag_grab
      xfs: pass the goal of the incore inode walk to xfs_inode_walk()
      xfs: rename xfs_inode_walk functions to xfs_icwalk
      xfs: move the inode walk functions further down
      xfs: detach inode dquots at the end of inactivation
      xfs: move the quotaoff dqrele inode walk into xfs_icache.c
    
    [djwong: added variable names to function declarations while fixing
    merge conflicts]
    Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
    ffc18582
xfs_ag.c 24.7 KB