On Fri, Mar 26, 2021 at 06:30:56AM +0000, Christoph Hellwig wrote: > On Thu, Mar 25, 2021 at 05:21:40PM -0700, Darrick J. Wong wrote: > > From: Darrick J. Wong <djwong@xxxxxxxxxx> > > > > Merge these two inode walk loops together, since they're pretty similar > > now. Get rid of XFS_ICI_NO_TAG since nobody uses it. > > The laster user of XFS_ICI_NO_TAG was quotoff, and the last reference > was removed in "xfs: remove indirect calls from xfs_inode_walk{,_ag}". > So I think it should be dropped there, or even better in a prep patch > removing all the XFS_ICI_NO_TAG code before that one. Ok, moved to patch 3. > > +static inline bool > > +selected_for_walk( > > + unsigned int tag, > > + struct xfs_inode *ip) > > +{ > > + switch (tag) { > > + case XFS_ICI_BLOCKGC_TAG: > > + return xfs_blockgc_grab(ip); > > + case XFS_ICI_RECLAIM_TAG: > > + return xfs_reclaim_inode_grab(ip); > > + default: > > + return false; > > + } > > +} > > Maybe name ths something that starts with xfs_ and ends with _grab? xfs_grabbed_for_walk? > > * and release all incore inodes with the given radix tree @tag. > > @@ -786,12 +803,14 @@ xfs_inode_walk_ag( > > bool done; > > int nr_found; > > > > - ASSERT(tag == XFS_ICI_BLOCKGC_TAG); > > + ASSERT(tag < RADIX_TREE_MAX_TAGS); > > > > restart: > > done = false; > > skipped = 0; > > first_index = 0; > > + if (tag == XFS_ICI_RECLAIM_TAG) > > + first_index = READ_ONCE(pag->pag_ici_reclaim_cursor); > > if / else to make this clear? Done. > > for (i = 0; i < nr_found; i++) { > > if (!batch[i]) > > continue; > > - error = xfs_blockgc_scan_inode(batch[i], eofb); > > - xfs_irele(batch[i]); > > + switch (tag) { > > + case XFS_ICI_BLOCKGC_TAG: > > + error = xfs_blockgc_scan_inode(batch[i], eofb); > > + xfs_irele(batch[i]); > > + break; > > + case XFS_ICI_RECLAIM_TAG: > > + xfs_reclaim_inode(batch[i], pag); > > + error = 0; > > Maybe move the irele into xfs_blockgc_scan_inode to make the calling > conventions more similar? Ok. I'll also fix the off-by-one error in the nr_to_scan check. --D