* [PATCH 1/2] ext2: fix incorrect i_op for special inode
@ 2020-05-22 4:40 Chengguang Xu
2020-05-22 4:40 ` [PATCH 2/2] ext2: code cleanup by removing ifdef macro surrounding Chengguang Xu
2020-05-22 13:11 ` [PATCH 1/2] ext2: fix incorrect i_op for special inode Jan Kara
0 siblings, 2 replies; 3+ messages in thread
From: Chengguang Xu @ 2020-05-22 4:40 UTC (permalink / raw)
To: jack; +Cc: linux-ext4, Chengguang Xu
We should always set &ext2_special_inode_operations to i_op
for special inode regardless of CONFIG_EXT2_FS_XATTR setting.
Signed-off-by: Chengguang Xu <cgxu519@mykernel.net>
---
fs/ext2/namei.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/fs/ext2/namei.c b/fs/ext2/namei.c
index ccfbbf59e2fc..1a5421a34ef7 100644
--- a/fs/ext2/namei.c
+++ b/fs/ext2/namei.c
@@ -136,9 +136,7 @@ static int ext2_mknod (struct inode * dir, struct dentry *dentry, umode_t mode,
err = PTR_ERR(inode);
if (!IS_ERR(inode)) {
init_special_inode(inode, inode->i_mode, rdev);
-#ifdef CONFIG_EXT2_FS_XATTR
inode->i_op = &ext2_special_inode_operations;
-#endif
mark_inode_dirty(inode);
err = ext2_add_nondir(dentry, inode);
}
--
2.20.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] ext2: code cleanup by removing ifdef macro surrounding
2020-05-22 4:40 [PATCH 1/2] ext2: fix incorrect i_op for special inode Chengguang Xu
@ 2020-05-22 4:40 ` Chengguang Xu
2020-05-22 13:11 ` [PATCH 1/2] ext2: fix incorrect i_op for special inode Jan Kara
1 sibling, 0 replies; 3+ messages in thread
From: Chengguang Xu @ 2020-05-22 4:40 UTC (permalink / raw)
To: jack; +Cc: linux-ext4, Chengguang Xu
Define ext2_listxattr to NULL when CONFIG_EROFS_FS_XATTR
is not enabled, then we can remove many ugly ifdef macros
in the code.
Signed-off-by: Chengguang Xu <cgxu519@mykernel.net>
---
fs/ext2/file.c | 2 --
fs/ext2/namei.c | 4 ----
fs/ext2/symlink.c | 4 ----
fs/ext2/xattr.h | 1 +
4 files changed, 1 insertion(+), 10 deletions(-)
diff --git a/fs/ext2/file.c b/fs/ext2/file.c
index 39c4772e96c9..b4de9a0f170d 100644
--- a/fs/ext2/file.c
+++ b/fs/ext2/file.c
@@ -196,9 +196,7 @@ const struct file_operations ext2_file_operations = {
};
const struct inode_operations ext2_file_inode_operations = {
-#ifdef CONFIG_EXT2_FS_XATTR
.listxattr = ext2_listxattr,
-#endif
.getattr = ext2_getattr,
.setattr = ext2_setattr,
.get_acl = ext2_get_acl,
diff --git a/fs/ext2/namei.c b/fs/ext2/namei.c
index 1a5421a34ef7..ba3e3e075891 100644
--- a/fs/ext2/namei.c
+++ b/fs/ext2/namei.c
@@ -411,9 +411,7 @@ const struct inode_operations ext2_dir_inode_operations = {
.rmdir = ext2_rmdir,
.mknod = ext2_mknod,
.rename = ext2_rename,
-#ifdef CONFIG_EXT2_FS_XATTR
.listxattr = ext2_listxattr,
-#endif
.getattr = ext2_getattr,
.setattr = ext2_setattr,
.get_acl = ext2_get_acl,
@@ -422,9 +420,7 @@ const struct inode_operations ext2_dir_inode_operations = {
};
const struct inode_operations ext2_special_inode_operations = {
-#ifdef CONFIG_EXT2_FS_XATTR
.listxattr = ext2_listxattr,
-#endif
.getattr = ext2_getattr,
.setattr = ext2_setattr,
.get_acl = ext2_get_acl,
diff --git a/fs/ext2/symlink.c b/fs/ext2/symlink.c
index 00cdb8679486..948d3a441403 100644
--- a/fs/ext2/symlink.c
+++ b/fs/ext2/symlink.c
@@ -25,16 +25,12 @@ const struct inode_operations ext2_symlink_inode_operations = {
.get_link = page_get_link,
.getattr = ext2_getattr,
.setattr = ext2_setattr,
-#ifdef CONFIG_EXT2_FS_XATTR
.listxattr = ext2_listxattr,
-#endif
};
const struct inode_operations ext2_fast_symlink_inode_operations = {
.get_link = simple_get_link,
.getattr = ext2_getattr,
.setattr = ext2_setattr,
-#ifdef CONFIG_EXT2_FS_XATTR
.listxattr = ext2_listxattr,
-#endif
};
diff --git a/fs/ext2/xattr.h b/fs/ext2/xattr.h
index 16272e6ddcf4..7925f596e8e2 100644
--- a/fs/ext2/xattr.h
+++ b/fs/ext2/xattr.h
@@ -100,6 +100,7 @@ static inline void ext2_xattr_destroy_cache(struct mb_cache *cache)
}
#define ext2_xattr_handlers NULL
+#define ext2_listxattr NULL
# endif /* CONFIG_EXT2_FS_XATTR */
--
2.20.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] ext2: fix incorrect i_op for special inode
2020-05-22 4:40 [PATCH 1/2] ext2: fix incorrect i_op for special inode Chengguang Xu
2020-05-22 4:40 ` [PATCH 2/2] ext2: code cleanup by removing ifdef macro surrounding Chengguang Xu
@ 2020-05-22 13:11 ` Jan Kara
1 sibling, 0 replies; 3+ messages in thread
From: Jan Kara @ 2020-05-22 13:11 UTC (permalink / raw)
To: Chengguang Xu; +Cc: jack, linux-ext4
On Fri 22-05-20 12:40:34, Chengguang Xu wrote:
> We should always set &ext2_special_inode_operations to i_op
> for special inode regardless of CONFIG_EXT2_FS_XATTR setting.
>
> Signed-off-by: Chengguang Xu <cgxu519@mykernel.net>
Thanks. I've applied both patches. I've just slightly expanded changelog of
this patch to better explain the implications of the change.
Honza
> ---
> fs/ext2/namei.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/fs/ext2/namei.c b/fs/ext2/namei.c
> index ccfbbf59e2fc..1a5421a34ef7 100644
> --- a/fs/ext2/namei.c
> +++ b/fs/ext2/namei.c
> @@ -136,9 +136,7 @@ static int ext2_mknod (struct inode * dir, struct dentry *dentry, umode_t mode,
> err = PTR_ERR(inode);
> if (!IS_ERR(inode)) {
> init_special_inode(inode, inode->i_mode, rdev);
> -#ifdef CONFIG_EXT2_FS_XATTR
> inode->i_op = &ext2_special_inode_operations;
> -#endif
> mark_inode_dirty(inode);
> err = ext2_add_nondir(dentry, inode);
> }
> --
> 2.20.1
>
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-05-22 13:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-22 4:40 [PATCH 1/2] ext2: fix incorrect i_op for special inode Chengguang Xu
2020-05-22 4:40 ` [PATCH 2/2] ext2: code cleanup by removing ifdef macro surrounding Chengguang Xu
2020-05-22 13:11 ` [PATCH 1/2] ext2: fix incorrect i_op for special inode Jan Kara
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).