linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: Christoph Hellwig <hch@lst.de>
Cc: Carlos Maiolino <cem@kernel.org>, linux-xfs@vger.kernel.org
Subject: Re: [PATCH 16/17] xfs: move xfs_dquot_tree calls into xfs_qm_dqget_cache_{lookup,insert}
Date: Wed, 15 Oct 2025 14:21:05 -0700	[thread overview]
Message-ID: <20251015212105.GL2591640@frogsfrogsfrogs> (raw)
In-Reply-To: <20251013024851.4110053-17-hch@lst.de>

On Mon, Oct 13, 2025 at 11:48:17AM +0900, Christoph Hellwig wrote:
> These are the low-level functions that needs them, so localize the
> (trivial) calculation of the radix tree root there.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Much cleaner, thanks for doing this.
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>

--D

> ---
>  fs/xfs/xfs_dquot.c | 24 +++++++++++-------------
>  1 file changed, 11 insertions(+), 13 deletions(-)
> 
> diff --git a/fs/xfs/xfs_dquot.c b/fs/xfs/xfs_dquot.c
> index 98593b380e94..29f578d66230 100644
> --- a/fs/xfs/xfs_dquot.c
> +++ b/fs/xfs/xfs_dquot.c
> @@ -801,10 +801,11 @@ xfs_dq_get_next_id(
>  static struct xfs_dquot *
>  xfs_qm_dqget_cache_lookup(
>  	struct xfs_mount	*mp,
> -	struct xfs_quotainfo	*qi,
> -	struct radix_tree_root	*tree,
> -	xfs_dqid_t		id)
> +	xfs_dqid_t		id,
> +	xfs_dqtype_t		type)
>  {
> +	struct xfs_quotainfo	*qi = mp->m_quotainfo;
> +	struct radix_tree_root	*tree = xfs_dquot_tree(qi, type);
>  	struct xfs_dquot	*dqp;
>  
>  restart:
> @@ -843,11 +844,12 @@ xfs_qm_dqget_cache_lookup(
>  static int
>  xfs_qm_dqget_cache_insert(
>  	struct xfs_mount	*mp,
> -	struct xfs_quotainfo	*qi,
> -	struct radix_tree_root	*tree,
>  	xfs_dqid_t		id,
> +	xfs_dqtype_t		type,
>  	struct xfs_dquot	*dqp)
>  {
> +	struct xfs_quotainfo	*qi = mp->m_quotainfo;
> +	struct radix_tree_root	*tree = xfs_dquot_tree(qi, type);
>  	unsigned int		nofs_flags;
>  	int			error;
>  
> @@ -906,8 +908,6 @@ xfs_qm_dqget(
>  	bool			can_alloc,
>  	struct xfs_dquot	**O_dqpp)
>  {
> -	struct xfs_quotainfo	*qi = mp->m_quotainfo;
> -	struct radix_tree_root	*tree = xfs_dquot_tree(qi, type);
>  	struct xfs_dquot	*dqp;
>  	int			error;
>  
> @@ -916,7 +916,7 @@ xfs_qm_dqget(
>  		return error;
>  
>  restart:
> -	dqp = xfs_qm_dqget_cache_lookup(mp, qi, tree, id);
> +	dqp = xfs_qm_dqget_cache_lookup(mp, id, type);
>  	if (dqp)
>  		goto found;
>  
> @@ -924,7 +924,7 @@ xfs_qm_dqget(
>  	if (error)
>  		return error;
>  
> -	error = xfs_qm_dqget_cache_insert(mp, qi, tree, id, dqp);
> +	error = xfs_qm_dqget_cache_insert(mp, id, type, dqp);
>  	if (error) {
>  		/*
>  		 * Duplicate found. Just throw away the new dquot and start
> @@ -994,8 +994,6 @@ xfs_qm_dqget_inode(
>  	struct xfs_dquot	**dqpp)
>  {
>  	struct xfs_mount	*mp = ip->i_mount;
> -	struct xfs_quotainfo	*qi = mp->m_quotainfo;
> -	struct radix_tree_root	*tree = xfs_dquot_tree(qi, type);
>  	struct xfs_dquot	*dqp;
>  	xfs_dqid_t		id;
>  	int			error;
> @@ -1014,7 +1012,7 @@ xfs_qm_dqget_inode(
>  	id = xfs_qm_id_for_quotatype(ip, type);
>  
>  restart:
> -	dqp = xfs_qm_dqget_cache_lookup(mp, qi, tree, id);
> +	dqp = xfs_qm_dqget_cache_lookup(mp, id, type);
>  	if (dqp)
>  		goto found;
>  
> @@ -1050,7 +1048,7 @@ xfs_qm_dqget_inode(
>  		return -ESRCH;
>  	}
>  
> -	error = xfs_qm_dqget_cache_insert(mp, qi, tree, id, dqp);
> +	error = xfs_qm_dqget_cache_insert(mp, id, type, dqp);
>  	if (error) {
>  		/*
>  		 * Duplicate found. Just throw away the new dquot and start
> -- 
> 2.47.3
> 
> 

  reply	other threads:[~2025-10-15 21:21 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-13  2:48 cleanup quota locking Christoph Hellwig
2025-10-13  2:48 ` [PATCH 01/17] xfs: make qi_dquots a 64-bit value Christoph Hellwig
2025-10-14 23:16   ` Darrick J. Wong
2025-10-15  4:48     ` Christoph Hellwig
2025-10-13  2:48 ` [PATCH 02/17] xfs: remove xfs_dqunlock and friends Christoph Hellwig
2025-10-14 23:17   ` Darrick J. Wong
2025-10-13  2:48 ` [PATCH 03/17] xfs: don't lock the dquot before return in xqcheck_commit_dquot Christoph Hellwig
2025-10-14 23:22   ` Darrick J. Wong
2025-10-15  5:00     ` Christoph Hellwig
2025-10-15 20:27       ` Darrick J. Wong
2025-10-13  2:48 ` [PATCH 04/17] xfs: don't lock the dquot before return in xrep_quota_item Christoph Hellwig
2025-10-14 23:24   ` Darrick J. Wong
2025-10-13  2:48 ` [PATCH 05/17] xfs: use a lockref for the xfs_dquot reference count Christoph Hellwig
2025-10-15 21:02   ` Darrick J. Wong
2025-10-13  2:48 ` [PATCH 06/17] xfs: remove xfs_qm_dqput and optimize dropping dquot references Christoph Hellwig
2025-10-15 21:04   ` Darrick J. Wong
2025-10-13  2:48 ` [PATCH 07/17] xfs: consolidate q_qlock locking in xfs_qm_dqget and xfs_qm_dqget_inode Christoph Hellwig
2025-10-15 21:05   ` Darrick J. Wong
2025-10-13  2:48 ` [PATCH 08/17] xfs: xfs_qm_dqattach_one is never called with a non-NULL *IO_idqpp Christoph Hellwig
2025-10-14 23:27   ` Darrick J. Wong
2025-10-13  2:48 ` [PATCH 09/17] xfs: fold xfs_qm_dqattach_one into xfs_qm_dqget_inode Christoph Hellwig
2025-10-15 21:13   ` Darrick J. Wong
2025-10-13  2:48 ` [PATCH 10/17] xfs: return the dquot unlocked from xfs_qm_dqget Christoph Hellwig
2025-10-15 21:17   ` Darrick J. Wong
2025-10-15 21:18     ` Darrick J. Wong
2025-10-16  4:21       ` Christoph Hellwig
2025-10-13  2:48 ` [PATCH 11/17] xfs: remove q_qlock locking in xfs_qm_scall_setqlim Christoph Hellwig
2025-10-15 21:17   ` Darrick J. Wong
2025-10-13  2:48 ` [PATCH 12/17] xfs: push q_qlock acquisition from xchk_dquot_iter to the callers Christoph Hellwig
2025-10-15 21:19   ` Darrick J. Wong
2025-10-13  2:48 ` [PATCH 13/17] xfs: move q_qlock locking into xchk_quota_item Christoph Hellwig
2025-10-15 21:19   ` Darrick J. Wong
2025-10-13  2:48 ` [PATCH 14/17] xfs: move q_qlock locking into xqcheck_compare_dquot Christoph Hellwig
2025-10-15 21:20   ` Darrick J. Wong
2025-10-13  2:48 ` [PATCH 15/17] xfs: move q_qlock acquisition into xqcheck_commit_dquot Christoph Hellwig
2025-10-15 21:20   ` Darrick J. Wong
2025-10-16  4:22     ` Christoph Hellwig
2025-10-13  2:48 ` [PATCH 16/17] xfs: move xfs_dquot_tree calls into xfs_qm_dqget_cache_{lookup,insert} Christoph Hellwig
2025-10-15 21:21   ` Darrick J. Wong [this message]
2025-10-13  2:48 ` [PATCH 17/17] xfs: reduce ilock roundtrips in xfs_qm_vop_dqalloc Christoph Hellwig
2025-10-15 21:27   ` Darrick J. Wong
2025-10-16  4:23     ` Christoph Hellwig
2025-10-16 15:59       ` Darrick J. Wong
2025-10-17  3:50         ` Christoph Hellwig
2025-10-17 23:09           ` Darrick J. Wong

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=20251015212105.GL2591640@frogsfrogsfrogs \
    --to=djwong@kernel.org \
    --cc=cem@kernel.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;
as well as URLs for NNTP newsgroup(s).