@@ -1772,19 +1772,14 @@ static int generic_ci_d_hash(const struct dentry *dentry, struct qstr *str)
1772
1772
static const struct dentry_operations generic_ci_dentry_ops = {
1773
1773
.d_hash = generic_ci_d_hash ,
1774
1774
.d_compare = generic_ci_d_compare ,
1775
- };
1776
- #endif
1777
-
1778
1775
#ifdef CONFIG_FS_ENCRYPTION
1779
- static const struct dentry_operations generic_encrypted_dentry_ops = {
1780
1776
.d_revalidate = fscrypt_d_revalidate ,
1777
+ #endif
1781
1778
};
1782
1779
#endif
1783
1780
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 = {
1788
1783
.d_revalidate = fscrypt_d_revalidate ,
1789
1784
};
1790
1785
#endif
@@ -1805,38 +1800,21 @@ static const struct dentry_operations generic_encrypted_ci_dentry_ops = {
1805
1800
* Encryption works differently in that the only dentry operation it needs is
1806
1801
* d_revalidate, which it only needs on dentries that have the no-key name flag.
1807
1802
* 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.
1813
1803
*/
1814
1804
void generic_set_encrypted_ci_d_ops (struct dentry * dentry )
1815
1805
{
1816
- #ifdef CONFIG_FS_ENCRYPTION
1817
- bool needs_encrypt_ops = dentry -> d_flags & DCACHE_NOKEY_NAME ;
1818
- #endif
1819
1806
#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 );
1825
1809
return ;
1826
1810
}
1827
1811
#endif
1828
1812
#ifdef CONFIG_FS_ENCRYPTION
1829
- if (needs_encrypt_ops ) {
1813
+ if (dentry -> d_flags & DCACHE_NOKEY_NAME ) {
1830
1814
d_set_d_op (dentry , & generic_encrypted_dentry_ops );
1831
1815
return ;
1832
1816
}
1833
1817
#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
1840
1818
}
1841
1819
EXPORT_SYMBOL (generic_set_encrypted_ci_d_ops );
1842
1820
0 commit comments