public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: djwong@kernel.org
Cc: Christoph Hellwig <hch@lst.de>,
	linux-xfs@vger.kernel.org, hch@infradead.org,
	david@fromorbit.com, bfoster@redhat.com
Subject: [PATCH 07/11] xfs: only walk the incore inode tree once per blockgc scan
Date: Wed, 27 Jan 2021 22:04:19 -0800	[thread overview]
Message-ID: <161181385904.1525433.780225995842501821.stgit@magnolia> (raw)
In-Reply-To: <161181381898.1525433.10723801103841220046.stgit@magnolia>

From: Darrick J. Wong <djwong@kernel.org>

Perform background block preallocation gc scans more efficiently by
walking the incore inode tree once.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
 fs/xfs/xfs_icache.c |   22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)


diff --git a/fs/xfs/xfs_icache.c b/fs/xfs/xfs_icache.c
index 0d0462268711..b32400b8e1ee 100644
--- a/fs/xfs/xfs_icache.c
+++ b/fs/xfs/xfs_icache.c
@@ -1571,21 +1571,19 @@ xfs_start_block_reaping(
 	xfs_blockgc_queue(mp);
 }
 
-/* Scan all incore inodes for block preallocations that we can remove. */
-static inline int
-xfs_blockgc_scan(
-	struct xfs_mount	*mp,
-	struct xfs_eofblocks	*eofb)
+/* Scan one incore inode for block preallocations that we can remove. */
+static int
+xfs_blockgc_scan_inode(
+	struct xfs_inode	*ip,
+	void			*args)
 {
 	int			error;
 
-	error = xfs_inode_walk(mp, 0, xfs_inode_free_eofblocks, eofb,
-			XFS_ICI_BLOCKGC_TAG);
+	error = xfs_inode_free_eofblocks(ip, args);
 	if (error)
 		return error;
 
-	error = xfs_inode_walk(mp, 0, xfs_inode_free_cowblocks, eofb,
-			XFS_ICI_BLOCKGC_TAG);
+	error = xfs_inode_free_cowblocks(ip, args);
 	if (error)
 		return error;
 
@@ -1603,7 +1601,8 @@ xfs_blockgc_worker(
 
 	if (!sb_start_write_trylock(mp->m_super))
 		return;
-	error = xfs_blockgc_scan(mp, NULL);
+	error = xfs_inode_walk(mp, 0, xfs_blockgc_scan_inode, NULL,
+			XFS_ICI_BLOCKGC_TAG);
 	if (error)
 		xfs_info(mp, "preallocation gc worker failed, err=%d", error);
 	sb_end_write(mp->m_super);
@@ -1620,7 +1619,8 @@ xfs_blockgc_free_space(
 {
 	trace_xfs_blockgc_free_space(mp, eofb, _RET_IP_);
 
-	return xfs_blockgc_scan(mp, eofb);
+	return xfs_inode_walk(mp, 0, xfs_blockgc_scan_inode, eofb,
+			XFS_ICI_BLOCKGC_TAG);
 }
 
 /*


  parent reply	other threads:[~2021-01-28  6:06 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-28  6:03 [PATCHSET v5 00/11] xfs: consolidate posteof and cowblocks cleanup Darrick J. Wong
2021-01-28  6:03 ` [PATCH 01/11] xfs: relocate the eofb/cowb workqueue functions Darrick J. Wong
2021-01-28  6:03 ` [PATCH 02/11] xfs: hide xfs_icache_free_eofblocks Darrick J. Wong
2021-01-28  6:03 ` [PATCH 03/11] xfs: hide xfs_icache_free_cowblocks Darrick J. Wong
2021-01-28  6:04 ` [PATCH 04/11] xfs: remove trivial eof/cowblocks functions Darrick J. Wong
2021-01-28  6:04 ` [PATCH 05/11] xfs: consolidate incore inode radix tree posteof/cowblocks tags Darrick J. Wong
2021-01-28  6:04 ` [PATCH 06/11] xfs: consolidate the eofblocks and cowblocks workers Darrick J. Wong
2021-01-28  6:04 ` Darrick J. Wong [this message]
2021-01-28  6:04 ` [PATCH 08/11] xfs: rename block gc start and stop functions Darrick J. Wong
2021-01-28  6:04 ` [PATCH 09/11] xfs: parallelize block preallocation garbage collection Darrick J. Wong
2021-01-28  6:04 ` [PATCH 10/11] xfs: expose the blockgc workqueue knobs publicly Darrick J. Wong
2021-01-28  6:04 ` [PATCH 11/11] xfs: don't bounce the iolock between free_{eof,cow}blocks Darrick J. Wong
2021-01-28  9:30   ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=161181385904.1525433.780225995842501821.stgit@magnolia \
    --to=djwong@kernel.org \
    --cc=bfoster@redhat.com \
    --cc=david@fromorbit.com \
    --cc=hch@infradead.org \
    --cc=hch@lst.de \
    --cc=linux-xfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox