Re: [RFC PATCH v2 17/18] fs: touch up predicts in putname()

Mateusz Guzik <[email protected]>
Newsgroups org.kernel.vger.audit,org.kernel.vger.io-uring,org.kernel.vger.linux-fsdevel
Message-ID <CAGudoHENCNV87W_wngFsfC99xYohQUiXOjeB24VcYTTOQPv5VQ@mail.gmail.com>
this was already included by Christian, although with both predicts. I
don't know if the other one fell off by accident.

regardless, this patch needs to get dropped

On Sat, Nov 29, 2025 at 6:01 PM Al Viro <[email protected]> wrote:
>
> From: Mateusz Guzik <[email protected]>
>
> 1. we already expect the refcount is 1.
> 2. path creation predicts name == iname
>
> I verified this straightens out the asm, no functional changes.
>
> Signed-off-by: Mateusz Guzik <[email protected]>
> Link: https://patch.msgid.link/[email protected]
> Reviewed-by: Jan Kara <[email protected]>
> Signed-off-by: Christian Brauner <[email protected]>
> ---
>  fs/namei.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/namei.c b/fs/namei.c
> index 37b13339f046..8530d75fb270 100644
> --- a/fs/namei.c
> +++ b/fs/namei.c
> @@ -285,7 +285,7 @@ void putname(struct filename *name)
>                 return;
>
>         refcnt = atomic_read(&name->refcnt);
> -       if (refcnt != 1) {
> +       if (unlikely(refcnt != 1)) {
>                 if (WARN_ON_ONCE(!refcnt))
>                         return;
>
> --
> 2.47.3
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.