@@ -1772,19 +1772,14 @@ static int generic_ci_d_hash(const struct dentry *dentry, struct qstr *str)
17721772static const struct dentry_operations generic_ci_dentry_ops = {
17731773 .d_hash = generic_ci_d_hash ,
17741774 .d_compare = generic_ci_d_compare ,
1775- };
1776- #endif
1777-
17781775#ifdef CONFIG_FS_ENCRYPTION
1779- static const struct dentry_operations generic_encrypted_dentry_ops = {
17801776 .d_revalidate = fscrypt_d_revalidate ,
1777+ #endif
17811778};
17821779#endif
17831780
1784- #if defined(CONFIG_FS_ENCRYPTION ) && IS_ENABLED (CONFIG_UNICODE )
1785- static const struct dentry_operations generic_encrypted_ci_dentry_ops = {
1786- .d_hash = generic_ci_d_hash ,
1787- .d_compare = generic_ci_d_compare ,
1781+ #ifdef CONFIG_FS_ENCRYPTION
1782+ static const struct dentry_operations generic_encrypted_dentry_ops = {
17881783 .d_revalidate = fscrypt_d_revalidate ,
17891784};
17901785#endif
@@ -1805,38 +1800,21 @@ static const struct dentry_operations generic_encrypted_ci_dentry_ops = {
18051800 * Encryption works differently in that the only dentry operation it needs is
18061801 * d_revalidate, which it only needs on dentries that have the no-key name flag.
18071802 * The no-key flag can't be set "later", so we don't have to worry about that.
1808- *
1809- * Finally, to maximize compatibility with overlayfs (which isn't compatible
1810- * with certain dentry operations) and to avoid taking an unnecessary
1811- * performance hit, we use custom dentry_operations for each possible
1812- * combination rather than always installing all operations.
18131803 */
18141804void generic_set_encrypted_ci_d_ops (struct dentry * dentry )
18151805{
1816- #ifdef CONFIG_FS_ENCRYPTION
1817- bool needs_encrypt_ops = dentry -> d_flags & DCACHE_NOKEY_NAME ;
1818- #endif
18191806#if IS_ENABLED (CONFIG_UNICODE )
1820- bool needs_ci_ops = dentry -> d_sb -> s_encoding ;
1821- #endif
1822- #if defined(CONFIG_FS_ENCRYPTION ) && IS_ENABLED (CONFIG_UNICODE )
1823- if (needs_encrypt_ops && needs_ci_ops ) {
1824- d_set_d_op (dentry , & generic_encrypted_ci_dentry_ops );
1807+ if (dentry -> d_sb -> s_encoding ) {
1808+ d_set_d_op (dentry , & generic_ci_dentry_ops );
18251809 return ;
18261810 }
18271811#endif
18281812#ifdef CONFIG_FS_ENCRYPTION
1829- if (needs_encrypt_ops ) {
1813+ if (dentry -> d_flags & DCACHE_NOKEY_NAME ) {
18301814 d_set_d_op (dentry , & generic_encrypted_dentry_ops );
18311815 return ;
18321816 }
18331817#endif
1834- #if IS_ENABLED (CONFIG_UNICODE )
1835- if (needs_ci_ops ) {
1836- d_set_d_op (dentry , & generic_ci_dentry_ops );
1837- return ;
1838- }
1839- #endif
18401818}
18411819EXPORT_SYMBOL (generic_set_encrypted_ci_d_ops );
18421820
0 commit comments