All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gabriel Krisman Bertazi <gabriel@krisman.be>
To: Amir Goldstein <amir73il@gmail.com>
Cc: "André Almeida" <andrealmeid@igalia.com>,
	"Miklos Szeredi" <miklos@szeredi.hu>,
	"Theodore Tso" <tytso@mit.edu>,
	linux-unionfs@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-fsdevel@vger.kernel.org,
	"Alexander Viro" <viro@zeniv.linux.org.uk>,
	"Christian Brauner" <brauner@kernel.org>,
	"Jan Kara" <jack@suse.cz>,
	kernel-dev@igalia.com
Subject: Re: [PATCH 1/3] ovl: Make ovl_cache_entry_find support casefold
Date: Mon, 14 Jul 2025 16:12:31 -0400	[thread overview]
Message-ID: <87seiycz0w.fsf@mailhost.krisman.be> (raw)
In-Reply-To: <CAOQ4uxjv199LB4XhgeSbTc9VkPB16S86vwcz9tq4GHVX4eVx-w@mail.gmail.com> (Amir Goldstein's message of "Fri, 11 Jul 2025 11:46:30 +0200")

Amir Goldstein <amir73il@gmail.com> writes:

> On Wed, Apr 9, 2025 at 5:01 PM André Almeida <andrealmeid@igalia.com> wrote:
>>
>> To add overlayfs support casefold filesystems, make
>> ovl_cache_entry_find() support casefold dentries.
>>
>> For the casefold support, just comparing the strings does not work
>> because we need the dentry enconding, so make this function find the
>> equivalent dentry for a giving directory, if any.
>>
>> Also, if two strings are not equal, strncmp() return value sign can be
>> either positive or negative and this information can be used to optimize
>> the walk in the rb tree. utf8_strncmp(), in the other hand, just return
>> true or false, so replace the rb walk with a normal rb_next() function.
>
> You cannot just replace a more performance implementation with a
> less performant one for everyone else just for your niche use case.
> Also it is the wrong approach.
>
> This code needs to use utf8_normalize() to store the normalized
> name in the rbtree instead of doing lookup and d_same_name().
> and you need to do ovl_cache_entry_add_rb() with the normalized
> name anotherwise you break the logic of ovl_dir_read_merged().
>
> Gabriel,
>
> Do you think it makes sense to use utf8_normalize() from this code
> directly to generate a key for "is this name found in another layer"
> search tree?

utf8_normalize is on its way out of the kernel and I don't think it
would help here, since it doesn't handle case-insensitive equivalent
names either, bug is just as expensive.

utf8_casefold might do what you want, but it is expensive as well.  With
it, you can store the folded version and be sure it is a byte-per-byte
match.

Alternatively, you can keep the existing name and open code something
similar to what generic_ci_match does: check with strncmp first and only
if the mountpoint must consider case-insensitive, do a
utf8_strncasecmp_folded if the first check wasn't a match.


-- 
Gabriel Krisman Bertazi

  reply	other threads:[~2025-07-14 20:12 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-09 15:00 [PATCH 0/3] ovl: Enable support for casefold filesystems André Almeida
2025-04-09 15:00 ` [PATCH 1/3] ovl: Make ovl_cache_entry_find support casefold André Almeida
2025-07-11  9:46   ` Amir Goldstein
2025-07-14 20:12     ` Gabriel Krisman Bertazi [this message]
2025-04-09 15:00 ` [PATCH 2/3] ovl: Make ovl_dentry_weird() accept casefold dentries André Almeida
2025-04-09 17:11   ` Amir Goldstein
2025-07-11  9:20     ` Amir Goldstein
2025-04-09 15:00 ` [PATCH 3/3] ovl: Enable support for casefold filesystems André Almeida
2025-04-09 16:52 ` [PATCH 0/3] " Gabriel Krisman Bertazi
2025-04-09 17:02   ` André Almeida
2025-04-09 17:17 ` Amir Goldstein
2025-07-10 20:54   ` André Almeida
2025-07-11  9:08     ` Amir Goldstein

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=87seiycz0w.fsf@mailhost.krisman.be \
    --to=gabriel@krisman.be \
    --cc=amir73il@gmail.com \
    --cc=andrealmeid@igalia.com \
    --cc=brauner@kernel.org \
    --cc=jack@suse.cz \
    --cc=kernel-dev@igalia.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-unionfs@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=tytso@mit.edu \
    --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 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.