Re: [PATCH 5/6] xfs: merge xfs_reclaim_inodes_ag into xfs_inode_walk_ag
From: Christoph Hellwig <hch@infradead.org>
Date: 2021-03-26 06:32:04
On Thu, Mar 25, 2021 at 05:21:40PM -0700, Darrick J. Wong wrote:
From: Darrick J. Wong <djwong@kernel.org> 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.
+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?
quoted hunk ↗ jump to hunk
* 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?
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?