On Thu, Mar 25, 2021 at 05:21:46PM -0700, Darrick J. Wong wrote: > From: Darrick J. Wong <djwong@xxxxxxxxxx> > > In preparation for adding another incore inode tree tag, refactor the > code that sets and clears tags from the per-AG inode tree and the tree > of per-AG structures, and remove the open-coded versions used by the > blockgc code. > > Signed-off-by: Darrick J. Wong <djwong@xxxxxxxxxx> > --- > fs/xfs/xfs_icache.c | 127 ++++++++++++++++++++++++--------------------------- > fs/xfs/xfs_icache.h | 2 - > fs/xfs/xfs_super.c | 2 - > fs/xfs/xfs_trace.h | 6 +- > 4 files changed, 65 insertions(+), 72 deletions(-) > > > diff --git a/fs/xfs/xfs_icache.c b/fs/xfs/xfs_icache.c > index 2b25fe679b0e..4c124bc98f39 100644 > --- a/fs/xfs/xfs_icache.c > +++ b/fs/xfs/xfs_icache.c > @@ -29,6 +29,7 @@ > /* Forward declarations to reduce indirect calls */ > static int xfs_blockgc_scan_inode(struct xfs_inode *ip, > struct xfs_eofblocks *eofb); > +static inline void xfs_blockgc_queue(struct xfs_perag *pag); > static bool xfs_reclaim_inode_grab(struct xfs_inode *ip); > static void xfs_reclaim_inode(struct xfs_inode *ip, struct xfs_perag *pag); > > @@ -163,46 +164,78 @@ xfs_reclaim_work_queue( > rcu_read_unlock(); > } > > +/* Set a tag on both the AG incore inode tree and the AG radix tree. */ > static void > +xfs_perag_set_ici_tag( > + struct xfs_perag *pag, > + xfs_agino_t agino, > + unsigned int tag) Looking at the callers - I think the logic to lookup the pag and set the inode flag should also go in here. Currently only xfs_inode_destroy nests i_Flags log inside the pag_ici_lock, but I don't see how that would harm the xfs_blockgc_set_iflag case. I suspect the unlocked check in xfs_blockgc_set_iflag would harm in the reclaim case either. > void > +xfs_inode_destroy( I find this new name a little confusing. What about xfs_inode_mark_reclaimable? But overall this new scheme looks nice to me.