From: Gabriel Krisman Bertazi <krisman@suse.de>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: ebiggers@kernel.org, viro@zeniv.linux.org.uk, tytso@mit.edu,
linux-fsdevel@vger.kernel.org, jaegeuk@kernel.org
Subject: Re: [PATCH v3 1/2] dcache: Expose dentry_string_cmp outside of dcache
Date: Sun, 21 Jan 2024 13:34:03 -0300 [thread overview]
Message-ID: <87mssywsqs.fsf@mailhost.krisman.be> (raw)
In-Reply-To: <CAHk-=whW=jahYWDezh8PeudB5ozfjNpdHnek3scMAyWHT5+=Og@mail.gmail.com> (Linus Torvalds's message of "Fri, 19 Jan 2024 12:48:51 -0800")
Linus Torvalds <torvalds@linux-foundation.org> writes:
> On Fri, 19 Jan 2024 at 12:25, Gabriel Krisman Bertazi <krisman@suse.de> wrote:
>>
>> In preparation to call these from libfs, expose dentry_string_cmp in the
>> header file.
>
> Let's not make these header files bigger and more complex.
>
> Particularly not for generic_ci_d_compare() to inline it, which makes
> no sense: generic_ci_d_compare() is so heavy with a big stack frame
> anyway, that the inlining of this would seem to be just in the noise.
>
> And when I look closer, it turns out that __d_lookup_rcu_op_compare()
> that does this all also does the proper sequence number magic to make
> the name pointer and the length consistent.
Ok. I see that we retry the read before calling d_compare here:
/* we want a consistent (name,len) pair */
if (read_seqcount_retry(&dentry->d_seq, seq)) {
cpu_relax();
goto seqretry;
}
for RCU and for d_same_name we are holding the d_lock.
So, I guess I was right for the wrong reason in the earlier
versions. which doesn't really do me any good.
> So I don't think we need the careful name compare after all, because
> the caller has fixed the consistency issue.
>
> I do also wonder if we should just move the "identical always compares
> equal" case into __d_lookup_rcu_op_compare(), and not have
> ->d_compare() have to worry about it at all?
I considered that, and I can do it as a follow up. I'd like to audit
d_compare to ensure we can change its semantics by only calling it if
the exact-match d_compare failed. Is there a filesystem where that
really matters? If so, we can add a new ->d_weak_compare hook.
Considering the ones I looked already will do fine with this change,
it's likely possible.
Are you ok with the earlier v2 of this patchset as-is, and I'll send a
new series proposing this change?
Thank you,
--
Gabriel Krisman Bertazi
next prev parent reply other threads:[~2024-01-21 16:34 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-19 20:25 [PATCH v3 0/2] Try exact-match comparison ahead of case-insensitive match Gabriel Krisman Bertazi
2024-01-19 20:25 ` [PATCH v3 1/2] dcache: Expose dentry_string_cmp outside of dcache Gabriel Krisman Bertazi
2024-01-19 20:48 ` Linus Torvalds
2024-01-21 16:34 ` Gabriel Krisman Bertazi [this message]
2024-01-21 19:09 ` Linus Torvalds
2024-01-24 18:13 ` [PATCH v4] libfs: Attempt exact-match comparison first during casefolded lookup Gabriel Krisman Bertazi
2024-01-24 18:42 ` Linus Torvalds
2024-01-24 22:44 ` Eric Biggers
2024-01-19 20:25 ` [PATCH v3 2/2] libfs: Attempt exact-match comparison first during casefold lookup Gabriel Krisman Bertazi
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=87mssywsqs.fsf@mailhost.krisman.be \
--to=krisman@suse.de \
--cc=ebiggers@kernel.org \
--cc=jaegeuk@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).