public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: "Darrick J. Wong" <djwong@kernel.org>
Cc: Carlos Maiolino <cem@kernel.org>, xfs <linux-xfs@vger.kernel.org>,
	Christoph Hellwig <hch@infradead.org>,
	Andrey Albershteyn <aalbersh@redhat.com>
Subject: Re: [PATCH] xfs: speed up parent pointer operations
Date: Tue, 6 Jan 2026 00:16:59 -0800	[thread overview]
Message-ID: <aVzE-5gMi1IHOLTW@infradead.org> (raw)
In-Reply-To: <20251219154154.GP7753@frogsfrogsfrogs>

On Fri, Dec 19, 2025 at 07:41:54AM -0800, Darrick J. Wong wrote:
> Now parent pointers only increase the system time by 8% for creation and
> 19% for deletion.  Wall time increases by 5% and 9%.

Nice!

> @@ -202,6 +203,16 @@ xfs_parent_addname(
>  	xfs_inode_to_parent_rec(&ppargs->rec, dp);
>  	xfs_parent_da_args_init(&ppargs->args, tp, &ppargs->rec, child,
>  			child->i_ino, parent_name);
> +
> +	if (xfs_inode_has_attr_fork(child) &&
> +	    xfs_attr_is_shortform(child)) {
> +		ppargs->args.op_flags |= XFS_DA_OP_ADDNAME;
> +
> +		error = xfs_attr_try_sf_addname(&ppargs->args);
> +		if (error != -ENOSPC)
> +			return error;
> +	}
> +
>  	xfs_attr_defer_add(&ppargs->args, XFS_ATTR_DEFER_SET);

We should be able to do this for all attrs, not just parent pointers,
right?  It might be nice to just do this for set and remove in
xfs_attr_defer_add and have it handle all attr operations.

> +	if (xfs_attr_is_shortform(child)) {
> +		ppargs->args.op_flags |= XFS_DA_OP_ADDNAME | XFS_DA_OP_REPLACE;
> +
> +		error = xfs_attr_sf_removename(&ppargs->args);
> +		if (error)
> +			return error;
> +
> +		xfs_parent_da_args_init(&ppargs->args, tp, &ppargs->new_rec,
> +				child, child->i_ino, new_name);
> +		ppargs->args.op_flags |= XFS_DA_OP_ADDNAME;
> +
> +		error = xfs_attr_try_sf_addname(&ppargs->args);
> +		if (error == -ENOSPC) {
> +			xfs_attr_defer_add(&ppargs->args, XFS_ATTR_DEFER_SET);
> +			return 0;
> +		}

And for replace we should be able to optimize this even further
by adding a new xfs_attr_sf_replacename that just checks if the new
version would fit, and then memmove everything behind the changed
attr and update it in place.  This should improve the operation a lot
more.


  reply	other threads:[~2026-01-06  8:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-19 15:41 [PATCH] xfs: speed up parent pointer operations Darrick J. Wong
2026-01-06  8:16 ` Christoph Hellwig [this message]
2026-01-07  0:09   ` Darrick J. Wong
2026-01-07  6:04     ` Christoph Hellwig
2026-01-07 18:22       ` Darrick J. Wong
2026-01-08  9:30         ` Christoph Hellwig
2026-01-08 17:03           ` 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=aVzE-5gMi1IHOLTW@infradead.org \
    --to=hch@infradead.org \
    --cc=aalbersh@redhat.com \
    --cc=cem@kernel.org \
    --cc=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