From: Al Viro <viro@zeniv.linux.org.uk>
To: Mateusz Guzik <mjguzik@gmail.com>
Cc: brauner@kernel.org, jack@suse.cz, linux-kernel@vger.kernel.org,
linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] fs: inline step_into() and walk_component()
Date: Wed, 19 Nov 2025 19:42:10 +0000 [thread overview]
Message-ID: <20251119194210.GO2441659@ZenIV> (raw)
In-Reply-To: <20251119184001.2942865-1-mjguzik@gmail.com>
On Wed, Nov 19, 2025 at 07:40:01PM +0100, Mateusz Guzik wrote:
> -static const char *pick_link(struct nameidata *nd, struct path *link,
> +static noinline const char *pick_link(struct nameidata *nd, struct path *link,
> struct inode *inode, int flags)
> {
> struct saved *last;
> const char *res;
> - int error = reserve_stack(nd, link);
> + int error;
> +
> + if (nd->flags & LOOKUP_RCU) {
> + /* make sure that d_is_symlink above matches inode */
Where would that "above" be? Have some pity on the readers...
> +static __always_inline const char *step_into(struct nameidata *nd, int flags,
> + struct dentry *dentry)
> +{
> + struct path path;
> + struct inode *inode;
> +
> + path.mnt = nd->path.mnt;
> + path.dentry = dentry;
> + if (!(nd->flags & LOOKUP_RCU))
> + goto slowpath;
> + if (unlikely(dentry->d_flags & DCACHE_MANAGED_DENTRY))
> + goto slowpath;
> + inode = path.dentry->d_inode;
> + if (unlikely(d_is_symlink(path.dentry)))
> + goto slowpath;
> + if (read_seqcount_retry(&path.dentry->d_seq, nd->next_seq))
> + return ERR_PTR(-ECHILD);
> + if (unlikely(!inode))
> + return ERR_PTR(-ENOENT);
> + nd->path = path;
> + nd->inode = inode;
> + nd->seq = nd->next_seq;
> + return NULL;
> +slowpath:
> + return step_into_slowpath(nd, flags, dentry);
> +}
Is there any point keeping that struct path here? Hell, what's wrong
with
static __always_inline const char *step_into(struct nameidata *nd, int flags,
struct dentry *dentry)
{
if (likely((nd->flags & LOOKUP_RCU) &&
!(dentry->d_flags & DCACHE_MANAGED_DENTRY) &&
!d_is_symlink(dentry))) {
// Simple case: no messing with refcounts and
// neither a symlink nor mountpoint.
struct inode *inode = dentry->d_inode;
if (read_seqcount_retry(&dentry->d_seq, nd->next_seq))
return ERR_PTR(-ECHILD);
if (unlikely(!inode))
return ERR_PTR(-ENOENT);
nd->path.dentry = dentry;
nd->inode = inode;
nd->seq = nd->next_seq;
return NULL;
}
return step_into_slowpath(nd, flags, dentry);
}
for that matter?
next prev parent reply other threads:[~2025-11-19 19:42 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-19 18:40 [PATCH] fs: inline step_into() and walk_component() Mateusz Guzik
2025-11-19 18:49 ` Mateusz Guzik
2025-11-19 19:42 ` Al Viro [this message]
2025-11-19 19:49 ` Mateusz Guzik
2025-11-19 20:23 ` Al Viro
2025-11-19 20:40 ` Mateusz Guzik
2025-11-19 20:41 ` Mateusz Guzik
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=20251119194210.GO2441659@ZenIV \
--to=viro@zeniv.linux.org.uk \
--cc=brauner@kernel.org \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mjguzik@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 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.