aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/dev-replace.c
diff options
context:
space:
mode:
authorGabriel Krisman Bertazi <[email protected]>2024-01-24 18:13:40 +0000
committerGabriel Krisman Bertazi <[email protected]>2024-02-27 21:55:25 +0000
commit0906fbb2f7ad6ae4b1bee8777bf83171a12c10b0 (patch)
tree3e95fa8918261c1a077a1bbd4dd47156508c7bf2 /fs/btrfs/dev-replace.c
parentMerge tag 'exfat-for-6.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/gi... (diff)
downloadkernel-0906fbb2f7ad6ae4b1bee8777bf83171a12c10b0.tar.gz
kernel-0906fbb2f7ad6ae4b1bee8777bf83171a12c10b0.zip
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/[email protected] Suggested-by: Linus Torvalds <[email protected]> Signed-off-by: Gabriel Krisman Bertazi <[email protected]>
Diffstat (limited to 'fs/btrfs/dev-replace.c')
0 files changed, 0 insertions, 0 deletions