diff options
author | Gabriel Krisman Bertazi <krisman@suse.de> | 2024-01-24 21:13:40 +0300 |
---|---|---|
committer | Gabriel Krisman Bertazi <krisman@suse.de> | 2024-02-28 00:55:25 +0300 |
commit | 0906fbb2f7ad6ae4b1bee8777bf83171a12c10b0 (patch) | |
tree | 3e95fa8918261c1a077a1bbd4dd47156508c7bf2 /fs/freevxfs | |
parent | 052d534373b7ed33712a63d5e17b2b6cdbce84fd (diff) | |
download | linux-0906fbb2f7ad6ae4b1bee8777bf83171a12c10b0.tar.xz |
libfs: Attempt exact-match comparison first during casefolded lookup
Casefolded comparisons are (obviously) way more costly than a simple
memcmp. Try the case-sensitive comparison first, falling-back to the
case-insensitive lookup only when needed. This allows any exact-match
lookup to complete without having to walk the utf8 trie.
Note that, for strict mode, generic_ci_d_compare used to reject an
invalid UTF-8 string, which would now be considered valid if it
exact-matches the disk-name. But, if that is the case, the filesystem
is corrupt. More than that, it really doesn't matter in practice,
because the name-under-lookup will have already been rejected by
generic_ci_d_hash and we won't even get here.
The memcmp is safe under RCU because we are operating on str/len instead
of dentry->d_name directly, and the caller guarantees their consistency
between each other in __d_lookup_rcu_op_compare.
Link: https://lore.kernel.org/r/87ttn2sip7.fsf_-_@mailhost.krisman.be
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Gabriel Krisman Bertazi <krisman@suse.de>
Diffstat (limited to 'fs/freevxfs')
0 files changed, 0 insertions, 0 deletions