public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: Long Li <leo.lilong@huawei.com>
Cc: cem@kernel.org, linux-xfs@vger.kernel.org, david@fromorbit.com,
	yi.zhang@huawei.com, houtao1@huawei.com, yangerkun@huawei.com,
	lonuxli.64@gmail.com
Subject: Re: [PATCH 3/4] xfs: factor out xfs_attr3_leaf_init
Date: Mon, 9 Mar 2026 09:44:37 -0700	[thread overview]
Message-ID: <20260309164437.GJ6033@frogsfrogsfrogs> (raw)
In-Reply-To: <20260309082752.2039861-4-leo.lilong@huawei.com>

On Mon, Mar 09, 2026 at 04:27:51PM +0800, Long Li wrote:
> Factor out wrapper xfs_attr3_leaf_init function, which exported for
> external use.
> 
> Signed-off-by: Long Li <leo.lilong@huawei.com>
> ---
>  fs/xfs/libxfs/xfs_attr_leaf.c | 20 ++++++++++++++++++++
>  fs/xfs/libxfs/xfs_attr_leaf.h |  3 +++
>  2 files changed, 23 insertions(+)
> 
> diff --git a/fs/xfs/libxfs/xfs_attr_leaf.c b/fs/xfs/libxfs/xfs_attr_leaf.c
> index 47f48ae555c0..6599b53f4822 100644
> --- a/fs/xfs/libxfs/xfs_attr_leaf.c
> +++ b/fs/xfs/libxfs/xfs_attr_leaf.c
> @@ -1415,6 +1415,26 @@ xfs_attr3_leaf_create(
>  	return 0;
>  }
>  
> +/*
> + * Wrapper function of initializing contents of a leaf, export for external use.
> + */
> +int
> +xfs_attr3_leaf_init(
> +	struct xfs_trans	*tp,
> +	struct xfs_inode	*dp,
> +	xfs_dablk_t		blkno)
> +{
> +	struct xfs_buf		*bp = NULL;
> +	struct xfs_da_args	args;

Same thing as previous patch:

	struct xfs_da_args	args = {
		.trans		= tp,
		...
	};

Also I think this should just go in whichever patch uses the new
function since this is pretty trivial.

> +
> +	memset(&args, 0, sizeof(args));
> +	args.trans = tp;
> +	args.dp = dp;
> +	args.owner = dp->i_ino;
> +	args.geo = dp->i_mount->m_attr_geo;
> +
> +	return xfs_attr3_leaf_create(&args, blkno, &bp);

Ummm ... who releases the returned xfs_buf pointer?

--D

> +}
>  /*
>   * Split the leaf node, rebalance, then add the new entry.
>   *
> diff --git a/fs/xfs/libxfs/xfs_attr_leaf.h b/fs/xfs/libxfs/xfs_attr_leaf.h
> index aca46da2bc50..72639efe6ac3 100644
> --- a/fs/xfs/libxfs/xfs_attr_leaf.h
> +++ b/fs/xfs/libxfs/xfs_attr_leaf.h
> @@ -87,6 +87,9 @@ int	xfs_attr3_leaf_list_int(struct xfs_buf *bp,
>  /*
>   * Routines used for shrinking the Btree.
>   */
> +
> +int	xfs_attr3_leaf_init(struct xfs_trans *tp, struct xfs_inode *dp,
> +				xfs_dablk_t blkno);
>  int	xfs_attr3_leaf_toosmall(struct xfs_da_state *state, int *retval);
>  void	xfs_attr3_leaf_unbalance(struct xfs_da_state *state,
>  				       struct xfs_da_state_blk *drop_blk,
> -- 
> 2.39.2
> 
> 

  reply	other threads:[~2026-03-09 16:44 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-09  8:27 [PATCH 0/4] xfs: close crash window in attr dabtree inactivation Long Li
2026-03-09  8:27 ` [PATCH 1/4] xfs: only assert new size for datafork during truncate extents Long Li
2026-03-09 16:39   ` Darrick J. Wong
2026-03-09  8:27 ` [PATCH 2/4] xfs: factor out xfs_da3_node_entry_remove Long Li
2026-03-09 16:42   ` Darrick J. Wong
2026-03-10  2:15     ` Long Li
2026-03-10 11:58     ` Long Li
2026-03-10 14:38       ` Darrick J. Wong
2026-03-09  8:27 ` [PATCH 3/4] xfs: factor out xfs_attr3_leaf_init Long Li
2026-03-09 16:44   ` Darrick J. Wong [this message]
2026-03-10  7:42     ` Long Li
2026-03-09  8:27 ` [PATCH 4/4] xfs: close crash window in attr dabtree inactivation Long Li
2026-03-09 16:59   ` Darrick J. Wong
2026-03-10  8:19     ` Long Li
2026-03-10 14:46       ` Darrick J. Wong
2026-03-11  2:34         ` Long Li
2026-03-13 14:46           ` 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=20260309164437.GJ6033@frogsfrogsfrogs \
    --to=djwong@kernel.org \
    --cc=cem@kernel.org \
    --cc=david@fromorbit.com \
    --cc=houtao1@huawei.com \
    --cc=leo.lilong@huawei.com \
    --cc=linux-xfs@vger.kernel.org \
    --cc=lonuxli.64@gmail.com \
    --cc=yangerkun@huawei.com \
    --cc=yi.zhang@huawei.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