Commit 60939826 authored by Gao Xiang's avatar Gao Xiang Committed by Greg Kroah-Hartman

staging: erofs: remove unneeded inode_operations

Currently, EROFS uses generic iops when xattr is off,
it seems unnecessary and a lot of extra code is there.
Let's follow what other filesystems do instead.
Reviewed-by: default avatarChao Yu <yuchao0@huawei.com>
Signed-off-by: default avatarGao Xiang <gaoxiang25@huawei.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 7077fffc
...@@ -184,32 +184,18 @@ static int fill_inode(struct inode *inode, int isdir) ...@@ -184,32 +184,18 @@ static int fill_inode(struct inode *inode, int isdir)
if (!err) { if (!err) {
/* setup the new inode */ /* setup the new inode */
if (S_ISREG(inode->i_mode)) { if (S_ISREG(inode->i_mode)) {
#ifdef CONFIG_EROFS_FS_XATTR inode->i_op = &erofs_generic_iops;
inode->i_op = &erofs_generic_xattr_iops;
#endif
inode->i_fop = &generic_ro_fops; inode->i_fop = &generic_ro_fops;
} else if (S_ISDIR(inode->i_mode)) { } else if (S_ISDIR(inode->i_mode)) {
inode->i_op = inode->i_op = &erofs_dir_iops;
#ifdef CONFIG_EROFS_FS_XATTR
&erofs_dir_xattr_iops;
#else
&erofs_dir_iops;
#endif
inode->i_fop = &erofs_dir_fops; inode->i_fop = &erofs_dir_fops;
} else if (S_ISLNK(inode->i_mode)) { } else if (S_ISLNK(inode->i_mode)) {
/* by default, page_get_link is used for symlink */ /* by default, page_get_link is used for symlink */
inode->i_op = inode->i_op = &erofs_symlink_iops;
#ifdef CONFIG_EROFS_FS_XATTR
&erofs_symlink_xattr_iops,
#else
&page_symlink_inode_operations;
#endif
inode_nohighmem(inode); inode_nohighmem(inode);
} else if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode) || } else if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode) ||
S_ISFIFO(inode->i_mode) || S_ISSOCK(inode->i_mode)) { S_ISFIFO(inode->i_mode) || S_ISSOCK(inode->i_mode)) {
#ifdef CONFIG_EROFS_FS_XATTR inode->i_op = &erofs_generic_iops;
inode->i_op = &erofs_special_inode_operations;
#endif
init_special_inode(inode, inode->i_mode, inode->i_rdev); init_special_inode(inode, inode->i_mode, inode->i_rdev);
} else { } else {
err = -EIO; err = -EIO;
...@@ -297,23 +283,23 @@ struct inode *erofs_iget(struct super_block *sb, ...@@ -297,23 +283,23 @@ struct inode *erofs_iget(struct super_block *sb,
return inode; return inode;
} }
const struct inode_operations erofs_generic_iops = {
#ifdef CONFIG_EROFS_FS_XATTR #ifdef CONFIG_EROFS_FS_XATTR
const struct inode_operations erofs_generic_xattr_iops = {
.listxattr = erofs_listxattr, .listxattr = erofs_listxattr,
#endif
}; };
const struct inode_operations erofs_symlink_xattr_iops = { const struct inode_operations erofs_symlink_iops = {
.get_link = page_get_link, .get_link = page_get_link,
#ifdef CONFIG_EROFS_FS_XATTR
.listxattr = erofs_listxattr, .listxattr = erofs_listxattr,
#endif
}; };
const struct inode_operations erofs_special_inode_operations = { const struct inode_operations erofs_fast_symlink_iops = {
.listxattr = erofs_listxattr,
};
const struct inode_operations erofs_fast_symlink_xattr_iops = {
.get_link = simple_get_link, .get_link = simple_get_link,
#ifdef CONFIG_EROFS_FS_XATTR
.listxattr = erofs_listxattr, .listxattr = erofs_listxattr,
};
#endif #endif
};
...@@ -414,8 +414,6 @@ static inline bool is_inode_layout_inline(struct inode *inode) ...@@ -414,8 +414,6 @@ static inline bool is_inode_layout_inline(struct inode *inode)
} }
extern const struct super_operations erofs_sops; extern const struct super_operations erofs_sops;
extern const struct inode_operations erofs_dir_iops;
extern const struct file_operations erofs_dir_fops;
extern const struct address_space_operations erofs_raw_access_aops; extern const struct address_space_operations erofs_raw_access_aops;
#ifdef CONFIG_EROFS_FS_ZIP #ifdef CONFIG_EROFS_FS_ZIP
...@@ -559,37 +557,33 @@ static inline unsigned long erofs_inode_hash(erofs_nid_t nid) ...@@ -559,37 +557,33 @@ static inline unsigned long erofs_inode_hash(erofs_nid_t nid)
extern struct inode *erofs_iget(struct super_block *sb, extern struct inode *erofs_iget(struct super_block *sb,
erofs_nid_t nid, bool dir); erofs_nid_t nid, bool dir);
/* dir.c */ extern const struct inode_operations erofs_generic_iops;
int erofs_namei(struct inode *dir, struct qstr *name, extern const struct inode_operations erofs_symlink_iops;
erofs_nid_t *nid, unsigned *d_type); extern const struct inode_operations erofs_fast_symlink_iops;
#ifdef CONFIG_EROFS_FS_XATTR
/* xattr.c */
extern const struct xattr_handler *erofs_xattr_handlers[];
/* symlink and special inode */
extern const struct inode_operations erofs_symlink_xattr_iops;
extern const struct inode_operations erofs_fast_symlink_xattr_iops;
extern const struct inode_operations erofs_special_inode_operations;
#endif
static inline void set_inode_fast_symlink(struct inode *inode) static inline void set_inode_fast_symlink(struct inode *inode)
{ {
#ifdef CONFIG_EROFS_FS_XATTR inode->i_op = &erofs_fast_symlink_iops;
inode->i_op = &erofs_fast_symlink_xattr_iops;
#else
inode->i_op = &simple_symlink_inode_operations;
#endif
} }
static inline bool is_inode_fast_symlink(struct inode *inode) static inline bool is_inode_fast_symlink(struct inode *inode)
{ {
return inode->i_op == &erofs_fast_symlink_iops;
}
/* namei.c */
extern const struct inode_operations erofs_dir_iops;
int erofs_namei(struct inode *dir, struct qstr *name,
erofs_nid_t *nid, unsigned int *d_type);
/* dir.c */
extern const struct file_operations erofs_dir_fops;
#ifdef CONFIG_EROFS_FS_XATTR #ifdef CONFIG_EROFS_FS_XATTR
return inode->i_op == &erofs_fast_symlink_xattr_iops; /* xattr.c */
#else extern const struct xattr_handler *erofs_xattr_handlers[];
return inode->i_op == &simple_symlink_inode_operations;
#endif #endif
}
static inline void *erofs_vmap(struct page **pages, unsigned int count) static inline void *erofs_vmap(struct page **pages, unsigned int count)
{ {
......
...@@ -235,10 +235,6 @@ static struct dentry *erofs_lookup(struct inode *dir, ...@@ -235,10 +235,6 @@ static struct dentry *erofs_lookup(struct inode *dir,
const struct inode_operations erofs_dir_iops = { const struct inode_operations erofs_dir_iops = {
.lookup = erofs_lookup, .lookup = erofs_lookup,
};
const struct inode_operations erofs_dir_xattr_iops = {
.lookup = erofs_lookup,
#ifdef CONFIG_EROFS_FS_XATTR #ifdef CONFIG_EROFS_FS_XATTR
.listxattr = erofs_listxattr, .listxattr = erofs_listxattr,
#endif #endif
......
...@@ -68,10 +68,6 @@ static const struct xattr_handler *xattr_handler_map[] = { ...@@ -68,10 +68,6 @@ static const struct xattr_handler *xattr_handler_map[] = {
} }
#ifdef CONFIG_EROFS_FS_XATTR #ifdef CONFIG_EROFS_FS_XATTR
extern const struct inode_operations erofs_generic_xattr_iops;
extern const struct inode_operations erofs_dir_xattr_iops;
int erofs_getxattr(struct inode *, int, const char *, void *, size_t); int erofs_getxattr(struct inode *, int, const char *, void *, size_t);
ssize_t erofs_listxattr(struct dentry *, char *, size_t); ssize_t erofs_listxattr(struct dentry *, char *, size_t);
#else #else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment