On Tue, Jul 07, 2020 at 08:05:50PM -0700, Daniel Rosenberg wrote: > +/** > + * generic_ci_d_compare - generic d_compare implementation for casefolding filesystems > + * @dentry: dentry whose name we are checking against > + * @len: len of name of dentry > + * @str: str pointer to name of dentry > + * @name: Name to compare against > + * > + * Return: 0 if names match, 1 if mismatch, or -ERRNO > + */ > +int generic_ci_d_compare(const struct dentry *dentry, unsigned int len, > + const char *str, const struct qstr *name) > +{ > + const struct dentry *parent = READ_ONCE(dentry->d_parent); > + const struct inode *inode = READ_ONCE(parent->d_inode); How about calling the 'inode' variable 'dir' instead? That would help avoid confusion about what is the directory and what is a file in the directory. Likewise in generic_ci_d_hash(). > +/** > + * generic_ci_d_hash - generic d_hash implementation for casefolding filesystems > + * @dentry: dentry whose name we are hashing This comment for @dentry needs to be updated. It's the parent dentry, not the dentry whose name we are hashing. > + * @str: qstr of name whose hash we should fill in > + * > + * Return: 0 if hash was successful, or -ERRNO As I mentioned on v9, this can also return 0 if the hashing was not done because it wants to fallback to the standard hashing. Can you please fix the comment? > +int generic_ci_d_hash(const struct dentry *dentry, struct qstr *str) > +{ > + const struct inode *inode = READ_ONCE(dentry->d_inode); > + struct super_block *sb = dentry->d_sb; > + const struct unicode_map *um = sb->s_encoding; > + int ret = 0; > + > + if (!inode || !needs_casefold(inode)) > + return 0; > + > + ret = utf8_casefold_hash(um, dentry, str); > + if (ret < 0) > + goto err; > + > + return 0; > +err: > + if (sb_has_strict_encoding(sb)) > + ret = -EINVAL; > + else > + ret = 0; > + return ret; > +} On v9, Gabriel suggested simplifying this to: ret = utf8_casefold_hash(um, dentry, str); if (ret < 0 && sb_has_enc_strict_mode(sb)) return -EINVAL; return 0; Any reason not to do that? - Eric