All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Naohiro Aota" <naohiro.aota@wdc.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH 3/6] xfs: add BPF data placement hook at file open
Date: Tue, 01 Dec 2026 04:49:23 +0000	[thread overview]
Message-ID: <sashiko-outbox-242543@kernel.org> (raw)
In-Reply-To: <20261201043452.3866039-4-naohiro.aota@wdc.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] xfs: unnecessary parent dentry refcount atomic ops in
  xfs_bpf_file_open()
--

commit 0cdaf5aa12590d62fbbcba19ad54035936a3eaaf
Author: Naohiro Aota <naohiro.aota@wdc.com>

xfs: add BPF data placement hook at file open

This commit adds a hook in xfs_file_open() to invoke an attached BPF data
placement policy when a file is opened for writing, allowing the policy to
update the inode's write lifetime hint.

> diff --git a/fs/xfs/xfs_bpf.c b/fs/xfs/xfs_bpf.c
> new file mode 100644
> index 0000000000000..0e7ef40d98d95
> --- /dev/null
> +++ b/fs/xfs/xfs_bpf.c
> @@ -0,0 +1,81 @@
[ ... ]
> +void
> +xfs_bpf_file_open(
> +	struct inode	*inode,
> +	struct file	*file)
> +{
> +	struct xfs_mount	*mp = XFS_M(inode->i_sb);
> +	struct fs_dp_file_open_res res = {
> +		.i_write_hint	= READ_ONCE(inode->i_write_hint),
> +	};
> +	struct file_kattr	fa = {};
> +	struct fs_dp_ops	*ops;
> +	struct dentry		*parent;
> +	unsigned long		parent_ino;
> +
> +	if (!(file->f_mode & FMODE_WRITE))
> +		return;
> +	if (!rcu_access_pointer(mp->m_dp_ops))
> +		return;
> +
> +	xfs_fileattr_get(file->f_path.dentry, &fa);
> +
> +	parent = dget_parent(file->f_path.dentry);
> +	parent_ino = d_inode(parent)->i_ino;
> +	dput(parent);

[Severity: Low]
Could this use d_parent_ino(file->f_path.dentry) instead of dget_parent()
and dput()?

Taking and dropping a reference on the parent dentry updates
parent->d_lockref on every writable file open when a policy is active,
causing cacheline and lockref contention across concurrent opens in the
same directory.  d_parent_ino() reads the parent inode number locklessly
under RCU and dentry->d_seq.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261201043452.3866039-1-naohiro.aota@wdc.com?part=3

  reply	other threads:[~2026-12-01  4:49 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01  4:34 [PATCH 0/6] xfs: BPF data placement policy for zoned file systems Naohiro Aota
2026-12-01  4:34 ` [PATCH 1/6] fs: add fs_dp BPF struct_ops for file data placement Naohiro Aota
2026-12-01  4:45   ` sashiko-bot
2026-12-01  4:34 ` [PATCH 2/6] bpf: allow fs_dp struct_ops programs to call FS kfuncs Naohiro Aota
2026-12-01  4:34 ` [PATCH 3/6] xfs: add BPF data placement hook at file open Naohiro Aota
2026-12-01  4:49   ` sashiko-bot [this message]
2026-12-01  4:34 ` [PATCH 4/6] xfs: add ioctls to select a BPF data placement policy Naohiro Aota
2026-12-01  4:34 ` [PATCH 5/6] xfs: bind a BPF data placement policy to a project ID Naohiro Aota
2026-12-01  4:34 ` [PATCH 6/6] xfs: let XFS_IOC_{SET,GET}_DP_OPS act on " Naohiro Aota
2026-12-01  4:37 ` [PATCH 1/2] fs_dp: let a policy pick a write stream Naohiro Aota
2026-12-01  4:37   ` [PATCH 2/2] xfs: bind write streams along with a data placement policy Naohiro Aota
2026-12-01  4:56 ` [PATCH 0/6] xfs: BPF data placement policy for zoned file systems Alexei Starovoitov
2026-12-01  9:15   ` Christoph Hellwig

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=sashiko-outbox-242543@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=naohiro.aota@wdc.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.