fscrypt: remove unneeded empty fscrypt_operations structs

In the case where a filesystem has been configured without encryption
support, there is no longer any need to initialize ->s_cop at all, since
none of the methods are ever called.

Reviewed-by: Chao Yu <yuchao0@huawei.com>
Acked-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
This commit is contained in:
Eric Biggers 2017-10-09 12:15:38 -07:00 committed by Jaegeuk Kim
parent 8745aa36e4
commit 8814204af9
2 changed files with 4 additions and 6 deletions

View file

@ -1189,9 +1189,6 @@ static const struct fscrypt_operations ext4_cryptops = {
.empty_dir = ext4_empty_dir, .empty_dir = ext4_empty_dir,
.max_namelen = ext4_max_namelen, .max_namelen = ext4_max_namelen,
}; };
#else
static const struct fscrypt_operations ext4_cryptops = {
};
#endif #endif
#ifdef CONFIG_QUOTA #ifdef CONFIG_QUOTA
@ -3900,7 +3897,9 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
sb->s_op = &ext4_sops; sb->s_op = &ext4_sops;
sb->s_export_op = &ext4_export_ops; sb->s_export_op = &ext4_export_ops;
sb->s_xattr = ext4_xattr_handlers; sb->s_xattr = ext4_xattr_handlers;
#ifdef CONFIG_EXT4_FS_ENCRYPTION
sb->s_cop = &ext4_cryptops; sb->s_cop = &ext4_cryptops;
#endif
#ifdef CONFIG_QUOTA #ifdef CONFIG_QUOTA
sb->dq_op = &ext4_quota_operations; sb->dq_op = &ext4_quota_operations;
if (ext4_has_feature_quota(sb)) if (ext4_has_feature_quota(sb))

View file

@ -1741,9 +1741,6 @@ static const struct fscrypt_operations f2fs_cryptops = {
.empty_dir = f2fs_empty_dir, .empty_dir = f2fs_empty_dir,
.max_namelen = f2fs_max_namelen, .max_namelen = f2fs_max_namelen,
}; };
#else
static const struct fscrypt_operations f2fs_cryptops = {
};
#endif #endif
static struct inode *f2fs_nfs_get_inode(struct super_block *sb, static struct inode *f2fs_nfs_get_inode(struct super_block *sb,
@ -2472,7 +2469,9 @@ try_onemore:
#endif #endif
sb->s_op = &f2fs_sops; sb->s_op = &f2fs_sops;
#ifdef CONFIG_F2FS_FS_ENCRYPTION
sb->s_cop = &f2fs_cryptops; sb->s_cop = &f2fs_cryptops;
#endif
sb->s_xattr = f2fs_xattr_handlers; sb->s_xattr = f2fs_xattr_handlers;
sb->s_export_op = &f2fs_export_ops; sb->s_export_op = &f2fs_export_ops;
sb->s_magic = F2FS_SUPER_MAGIC; sb->s_magic = F2FS_SUPER_MAGIC;