Re: [PATCH v4 07/10] tmpfs: Add casefold lookup support

From: André Almeida
Date: Tue Oct 01 2024 - 21:41:16 EST


Hey Krisman,

Em 12/09/2024 16:04, Gabriel Krisman Bertazi escreveu:
André Almeida <andrealmeid@xxxxxxxxxx> writes:


[...]

+#if IS_ENABLED(CONFIG_UNICODE)
+ if (ctx->encoding) {
+ sb->s_encoding = ctx->encoding;
+ sb->s_d_op = &shmem_ci_dentry_ops;
+ if (ctx->strict_encoding)
+ sb->s_encoding_flags = SB_ENC_STRICT_MODE_FL;
+ }
#else
- sb->s_flags |= SB_NOUSER;
+ sb->s_d_op = &simple_dentry_operations;

Moving simple_dentry_operations to be set at s_d_op should be a separate
patch.

It is a change that has non-obvious side effects (i.e. the way we
treat the root dentry) so it needs proper review by itself. It is
also not related to the rest of the case-insensitive patch.


The idea of setting simple_dentry_operations come from my previous approach of having our own shmem_lookup(), replacing simple_lookup(). Now that we are settled to keep with simple_lookup() anyway (that already sets simple_dentry_operations), I think we don't need this change anymore, right?

This will be set for every dentry that doesn't have a dentry->d_sb->s_d_op. Case-insensitive mount points will have this set, so we don't risk overwriting it.