public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Mateusz Guzik <mjguzik@gmail.com>
Cc: brauner@kernel.org, viro@zeniv.linux.org.uk, jack@suse.cz,
	linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [RFC PATCH] vfs: dodge strlen() in vfs_readlink() when ->i_link is populated
Date: Mon, 18 Nov 2024 12:53:59 +0100	[thread overview]
Message-ID: <20241118115359.mzzx3avongvfqaha@quack3> (raw)
In-Reply-To: <20241118085357.494178-1-mjguzik@gmail.com>

On Mon 18-11-24 09:53:57, Mateusz Guzik wrote:
> This gives me about 1.5% speed up when issuing readlink on /initrd.img
> on ext4.
> 
> Signed-off-by: Mateusz Guzik <mjguzik@gmail.com>
> ---
> 
> I had this running with the following debug:
> 
> if (strlen(link) != inode->i_size)
>        printk(KERN_CRIT "mismatch [%s] %l %l\n", link,
>            strlen(link), inode->i_size);
> 
> nothing popped up

Then you didn't run with UDF I guess ;). There inode->i_size is the length
of on-disk symlink encoding which is definitely different from the length
of the string we return to VFS (it uses weird standards-defined cross OS
compatible encoding of a path and I'm not even mentioning its own special
encoding of character sets somewhat resembling UCS-2).

> I would leave something of that sort in if it was not defeating the
> point of the change.
> 
> However, I'm a little worried some crap fs *does not* fill this in
> despite populating i_link.
> 
> Perhaps it would make sense to keep the above with the patch hanging out
> in next and remove later?
> 
> Anyhow, worst case, should it turn out i_size does not work there are at
> least two 4-byte holes which can be used to store the length (and
> chances are some existing field can be converted into a union instead).

I'm not sure I completely follow your proposal here...

								Honza
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

  reply	other threads:[~2024-11-18 11:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-18  8:53 [RFC PATCH] vfs: dodge strlen() in vfs_readlink() when ->i_link is populated Mateusz Guzik
2024-11-18 11:53 ` Jan Kara [this message]
2024-11-18 12:20   ` Mateusz Guzik
2024-11-18 14:41     ` Jan Kara
2024-11-18 14:51       ` Mateusz Guzik
2024-11-18 15:44         ` Al Viro
2024-11-18 20:32           ` Mateusz Guzik
2024-11-20  8:36             ` Christian Brauner

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=20241118115359.mzzx3avongvfqaha@quack3 \
    --to=jack@suse.cz \
    --cc=brauner@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mjguzik@gmail.com \
    --cc=viro@zeniv.linux.org.uk \
    /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