public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: Omar Sandoval <osandov@osandov.com>
Cc: linux-xfs@vger.kernel.org, kernel-team@fb.com,
	Prashant Nema <pnema@fb.com>
Subject: Re: [PATCH 3/6] xfs: return maximum free size from xfs_rtany_summary()
Date: Wed, 12 Jul 2023 15:44:39 -0700	[thread overview]
Message-ID: <20230712224439.GW108251@frogsfrogsfrogs> (raw)
In-Reply-To: <d3d0aad4dbf6999c5fe07d89d63ea6cfabee3ff4.1687296675.git.osandov@osandov.com>

On Tue, Jun 20, 2023 at 02:32:13PM -0700, Omar Sandoval wrote:
> From: Omar Sandoval <osandov@fb.com>
> 
> Instead of only returning whether there is any free space, return the
> maximum size, which is fast thanks to the previous commit. This will be
> used by two upcoming optimizations.
> 
> Signed-off-by: Omar Sandoval <osandov@fb.com>

Assuming I understood the changes in the /last/ two patches, this seems
like a reasonable thing to pass upwards...

Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

> ---
>  fs/xfs/xfs_rtalloc.c | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/fs/xfs/xfs_rtalloc.c b/fs/xfs/xfs_rtalloc.c
> index d3c76532d20e..ba7d42e0090f 100644
> --- a/fs/xfs/xfs_rtalloc.c
> +++ b/fs/xfs/xfs_rtalloc.c
> @@ -50,7 +50,7 @@ xfs_rtany_summary(
>  	int		high,		/* high log2 extent size */
>  	xfs_rtblock_t	bbno,		/* bitmap block number */
>  	struct xfs_rtbuf_cache *rtbufc,	/* in/out: cache of realtime blocks */
> -	int		*stat)		/* out: any good extents here? */
> +	int		*maxlog)	/* out: maximum log2 extent size free */
>  {
>  	int		error;		/* error value */
>  	int		log;		/* loop counter, log2 of ext. size */
> @@ -60,7 +60,7 @@ xfs_rtany_summary(
>  	if (mp->m_rsum_cache) {
>  		high = min(high, mp->m_rsum_cache[bbno] - 1);
>  		if (low > high) {
> -			*stat = 0;
> +			*maxlog = -1;
>  			return 0;
>  		}
>  	}
> @@ -80,14 +80,14 @@ xfs_rtany_summary(
>  		 * If there are any, return success.
>  		 */
>  		if (sum) {
> -			*stat = 1;
> +			*maxlog = log;
>  			goto out;
>  		}
>  	}
>  	/*
>  	 * Found nothing, return failure.
>  	 */
> -	*stat = 0;
> +	*maxlog = -1;
>  out:
>  	/* There were no extents at levels > log. */
>  	if (mp->m_rsum_cache && log + 1 < mp->m_rsum_cache[bbno])
> @@ -427,7 +427,7 @@ xfs_rtallocate_extent_near(
>  	xfs_extlen_t	prod,		/* extent product factor */
>  	xfs_rtblock_t	*rtblock)	/* out: start block allocated */
>  {
> -	int		any;		/* any useful extents from summary */
> +	int		maxlog;		/* maximum useful extent from summary */
>  	xfs_rtblock_t	bbno;		/* bitmap block number */
>  	int		error;		/* error value */
>  	int		i;		/* bitmap block offset (loop control) */
> @@ -479,7 +479,7 @@ xfs_rtallocate_extent_near(
>  		 * starting in this bitmap block.
>  		 */
>  		error = xfs_rtany_summary(mp, tp, log2len, mp->m_rsumlevels - 1,
> -			bbno + i, rtbufc, &any);
> +			bbno + i, rtbufc, &maxlog);
>  		if (error) {
>  			return error;
>  		}
> @@ -487,7 +487,7 @@ xfs_rtallocate_extent_near(
>  		 * If there are any useful extents starting here, try
>  		 * allocating one.
>  		 */
> -		if (any) {
> +		if (maxlog >= 0) {
>  			/*
>  			 * On the positive side of the starting location.
>  			 */
> @@ -527,7 +527,7 @@ xfs_rtallocate_extent_near(
>  					 */
>  					error = xfs_rtany_summary(mp, tp,
>  						log2len, mp->m_rsumlevels - 1,
> -						bbno + j, rtbufc, &any);
> +						bbno + j, rtbufc, &maxlog);
>  					if (error) {
>  						return error;
>  					}
> @@ -539,7 +539,7 @@ xfs_rtallocate_extent_near(
>  					 * extent given, we've already tried
>  					 * that allocation, don't do it again.
>  					 */
> -					if (any)
> +					if (maxlog >= 0)
>  						continue;
>  					error = xfs_rtallocate_extent_block(mp,
>  						tp, bbno + j, minlen, maxlen,
> -- 
> 2.41.0
> 

  reply	other threads:[~2023-07-12 22:44 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-20 21:32 [PATCH 0/6] xfs: CPU usage optimizations for realtime allocator Omar Sandoval
2023-06-20 21:32 ` [PATCH 1/6] xfs: cache last bitmap block in " Omar Sandoval
2023-07-12 18:29   ` Darrick J. Wong
2023-07-17 18:18     ` Omar Sandoval
2023-08-01 22:48       ` Darrick J. Wong
2023-06-20 21:32 ` [PATCH 2/6] xfs: invert the realtime summary cache Omar Sandoval
2023-07-12 22:40   ` Darrick J. Wong
2023-07-17 19:54     ` Omar Sandoval
2023-08-01 23:17       ` Darrick J. Wong
2023-06-20 21:32 ` [PATCH 3/6] xfs: return maximum free size from xfs_rtany_summary() Omar Sandoval
2023-07-12 22:44   ` Darrick J. Wong [this message]
2023-06-20 21:32 ` [PATCH 4/6] xfs: limit maxlen based on available space in xfs_rtallocate_extent_near() Omar Sandoval
2023-07-12 23:01   ` Darrick J. Wong
2023-07-17 20:33     ` Omar Sandoval
2023-06-20 21:32 ` [PATCH 5/6] xfs: don't try redundant allocations " Omar Sandoval
2023-07-12 23:34   ` Darrick J. Wong
2023-07-17 21:06     ` Omar Sandoval
2023-07-31 20:58       ` Omar Sandoval
2023-08-01 23:00       ` Darrick J. Wong
2023-06-20 21:32 ` [PATCH 6/6] xfs: don't look for end of extent further than necessary " Omar Sandoval
2023-08-01 23:40   ` Darrick J. Wong
2023-07-06 21:39 ` [PATCH 0/6] xfs: CPU usage optimizations for realtime allocator Omar Sandoval
2023-07-07  0:36   ` Dave Chinner

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=20230712224439.GW108251@frogsfrogsfrogs \
    --to=djwong@kernel.org \
    --cc=kernel-team@fb.com \
    --cc=linux-xfs@vger.kernel.org \
    --cc=osandov@osandov.com \
    --cc=pnema@fb.com \
    /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