linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: djwong@kernel.org
Cc: linux-xfs@vger.kernel.org
Subject: [PATCH 5/7] xfs: only walk the incore inode tree once per blockgc scan
Date: Mon, 11 Jan 2021 15:23:46 -0800	[thread overview]
Message-ID: <161040742666.1582286.3910636058356753098.stgit@magnolia> (raw)
In-Reply-To: <161040739544.1582286.11068012972712089066.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>
---
 fs/xfs/xfs_icache.c |   27 ++++++++++++++++++++-------
 1 file changed, 20 insertions(+), 7 deletions(-)


diff --git a/fs/xfs/xfs_icache.c b/fs/xfs/xfs_icache.c
index 92fcec349054..4f68375cf873 100644
--- a/fs/xfs/xfs_icache.c
+++ b/fs/xfs/xfs_icache.c
@@ -31,6 +31,9 @@
  */
 #define XFS_INODE_WALK_INEW_WAIT	0x1	/* wait on new inodes */
 
+STATIC int xfs_inode_free_eofblocks(struct xfs_inode *ip, void *args);
+STATIC int xfs_inode_free_cowblocks(struct xfs_inode *ip, void *args);
+
 /*
  * Allocate and initialise an xfs_inode.
  */
@@ -950,19 +953,29 @@ xfs_queue_blockgc(
 	rcu_read_unlock();
 }
 
+/* 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_free_eofblocks(ip, args);
+	if (error && error != -EAGAIN)
+		return error;
+
+	return xfs_inode_free_cowblocks(ip, args);
+}
+
 /* 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)
 {
-	int			error;
-
-	error = xfs_icache_free_eofblocks(mp, eofb);
-	if (error && error != -EAGAIN)
-		return error;
-
-	return xfs_icache_free_cowblocks(mp, eofb);
+	return __xfs_inode_walk(mp, 0, xfs_blockgc_scan_inode, eofb,
+			XFS_ICI_BLOCK_GC_TAG);
 }
 
 /* Background worker that trims preallocated space. */


  parent reply	other threads:[~2021-01-12  0:30 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-11 23:23 [PATCHSET v2 0/7] xfs: consolidate posteof and cowblocks cleanup Darrick J. Wong
2021-01-11 23:23 ` [PATCH 1/7] xfs: increase the default parallelism levels of pwork clients Darrick J. Wong
2021-01-13 14:49   ` Christoph Hellwig
2021-01-14 21:32     ` Darrick J. Wong
2021-01-14 22:38       ` Darrick J. Wong
2021-01-18 17:36         ` Christoph Hellwig
2021-01-18 19:57           ` Darrick J. Wong
2021-01-19 16:37             ` Christoph Hellwig
2021-01-19 19:17               ` Darrick J. Wong
2021-01-11 23:23 ` [PATCH 2/7] xfs: refactor the predicate part of xfs_free_eofblocks Darrick J. Wong
2021-01-13 14:57   ` Christoph Hellwig
2021-01-14 22:49     ` Darrick J. Wong
2021-01-18 17:38       ` Christoph Hellwig
2021-01-11 23:23 ` [PATCH 3/7] xfs: consolidate incore inode radix tree posteof/cowblocks tags Darrick J. Wong
2021-01-13 14:59   ` Christoph Hellwig
2021-01-11 23:23 ` [PATCH 4/7] xfs: consolidate the eofblocks and cowblocks workers Darrick J. Wong
2021-01-13 15:04   ` Christoph Hellwig
2021-01-13 23:53     ` Darrick J. Wong
2021-01-11 23:23 ` Darrick J. Wong [this message]
2021-01-13 15:06   ` [PATCH 5/7] xfs: only walk the incore inode tree once per blockgc scan Christoph Hellwig
2021-01-13 20:41     ` Darrick J. Wong
2021-01-11 23:23 ` [PATCH 6/7] xfs: rename block gc start and stop functions Darrick J. Wong
2021-01-13 15:07   ` Christoph Hellwig
2021-01-11 23:23 ` [PATCH 7/7] xfs: parallelize block preallocation garbage collection Darrick J. Wong
2021-01-13 15:09   ` 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=161040742666.1582286.3910636058356753098.stgit@magnolia \
    --to=djwong@kernel.org \
    --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;
as well as URLs for NNTP newsgroup(s).