linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: "Nirjhar Roy (IBM)" <nirjhar.roy.lists@gmail.com>
Cc: linux-xfs@vger.kernel.org, ritesh.list@gmail.com,
	ojaswin@linux.ibm.com, bfoster@redhat.com, david@fromorbit.com,
	hsiangkao@linux.alibaba.com
Subject: Re: [RFC 1/3] xfs: Re-introduce xg_active_wq field in struct xfs_group
Date: Tue, 29 Jul 2025 13:26:32 -0700	[thread overview]
Message-ID: <20250729202632.GF2672049@frogsfrogsfrogs> (raw)
In-Reply-To: <70c065f02299e09b1569c3bc45ff493c9ac55fda.1752746805.git.nirjhar.roy.lists@gmail.com>

On Thu, Jul 17, 2025 at 04:00:43PM +0530, Nirjhar Roy (IBM) wrote:
> pag_active_wq was removed in
> commit 9943b4573290
> 	("xfs: remove the unused pag_active_wq field in struct xfs_perag")
> because it was not waited upon. Re-introducing this in struct xfs_group.
> This patch also replaces atomic_dec() in xfs_group_rele() with
> 
> if (atomic_dec_and_test(&xg->xg_active_ref))
> 	wake_up(&xg->xg_active_wq);
> 
> The reason for this change is that the online shrink code will wait
> for all the active references to come down to zero before actually
> starting the shrink process (only if the number of blocks that
> we are trying to remove is worth 1 or more AGs).

...and I guess this is the start of being able to remove live rtgroups
too?

> Signed-off-by: Nirjhar Roy (IBM) <nirjhar.roy.lists@gmail.com>
> ---
>  fs/xfs/libxfs/xfs_group.c | 4 +++-
>  fs/xfs/libxfs/xfs_group.h | 1 +
>  2 files changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/xfs/libxfs/xfs_group.c b/fs/xfs/libxfs/xfs_group.c
> index e9d76bcdc820..1fe5319de338 100644
> --- a/fs/xfs/libxfs/xfs_group.c
> +++ b/fs/xfs/libxfs/xfs_group.c
> @@ -147,7 +147,8 @@ xfs_group_rele(
>  	struct xfs_group	*xg)
>  {
>  	trace_xfs_group_rele(xg, _RET_IP_);
> -	atomic_dec(&xg->xg_active_ref);
> +	if (atomic_dec_and_test(&xg->xg_active_ref))
> +		wake_up(&xg->xg_active_wq);
>  }
>  
>  void
> @@ -198,6 +199,7 @@ xfs_group_insert(
>  	xfs_defer_drain_init(&xg->xg_intents_drain);
>  
>  	/* Active ref owned by mount indicates group is online. */
> +	init_waitqueue_head(&xg->xg_active_wq);
>  	atomic_set(&xg->xg_active_ref, 1);
>  
>  	error = xa_insert(&mp->m_groups[type].xa, index, xg, GFP_KERNEL);
> diff --git a/fs/xfs/libxfs/xfs_group.h b/fs/xfs/libxfs/xfs_group.h
> index 4423932a2313..dbef389ef838 100644
> --- a/fs/xfs/libxfs/xfs_group.h
> +++ b/fs/xfs/libxfs/xfs_group.h
> @@ -11,6 +11,7 @@ struct xfs_group {
>  	enum xfs_group_type	xg_type;
>  	atomic_t		xg_ref;		/* passive reference count */
>  	atomic_t		xg_active_ref;	/* active reference count */
> +	wait_queue_head_t xg_active_wq; /* woken active_ref falls to zero */

Nit: tab between the     ^ variable and its type.

With that fixed,
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>

--D

>  
>  	/* Precalculated geometry info */
>  	uint32_t		xg_block_count;	/* max usable gbno */
> -- 
> 2.43.5
> 
> 

  reply	other threads:[~2025-07-29 20:26 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-17 10:30 [RFC 0/3] xfs: Add support to shrink multiple empty AGs Nirjhar Roy (IBM)
2025-07-17 10:30 ` [RFC 1/3] xfs: Re-introduce xg_active_wq field in struct xfs_group Nirjhar Roy (IBM)
2025-07-29 20:26   ` Darrick J. Wong [this message]
2025-07-30  6:14     ` Nirjhar Roy (IBM)
2025-07-17 10:30 ` [RFC 2/3] xfs: Refactoring the nagcount and delta calculation Nirjhar Roy (IBM)
2025-07-29 20:24   ` Darrick J. Wong
2025-07-30  5:04     ` Nirjhar Roy (IBM)
2025-07-17 10:30 ` [RFC 3/3] xfs: Add support to shrink multiple empty AGs Nirjhar Roy (IBM)
2025-07-29 21:05   ` Darrick J. Wong
2025-07-30 18:36     ` Nirjhar Roy (IBM)
2025-08-12 19:07       ` Darrick J. Wong
2025-08-13  8:04         ` Nirjhar Roy (IBM)
2025-08-14 18:31           ` Darrick J. Wong
2025-08-19  5:56             ` Nirjhar Roy (IBM)
2025-07-30  4:55   ` Ritesh Harjani
2025-07-30 11:53     ` Nirjhar Roy (IBM)

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=20250729202632.GF2672049@frogsfrogsfrogs \
    --to=djwong@kernel.org \
    --cc=bfoster@redhat.com \
    --cc=david@fromorbit.com \
    --cc=hsiangkao@linux.alibaba.com \
    --cc=linux-xfs@vger.kernel.org \
    --cc=nirjhar.roy.lists@gmail.com \
    --cc=ojaswin@linux.ibm.com \
    --cc=ritesh.list@gmail.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;
as well as URLs for NNTP newsgroup(s).