Skip to content

Commit c34110e

Browse files
Hongzhen Luohsiangkao
authored andcommitted
erofs: clean up erofs_show_options()
Avoid unnecessary #ifdefs and simplify the code a bit. Signed-off-by: Hongzhen Luo <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Gao Xiang <[email protected]> Signed-off-by: Gao Xiang <[email protected]>
1 parent 20c0297 commit c34110e

File tree

2 files changed

+8
-23
lines changed

2 files changed

+8
-23
lines changed

fs/erofs/internal.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,12 @@ enum {
6464
};
6565

6666
struct erofs_mount_opts {
67-
#ifdef CONFIG_EROFS_FS_ZIP
6867
/* current strategy of how to use managed cache */
6968
unsigned char cache_strategy;
7069
/* strategy of sync decompression (0 - auto, 1 - force on, 2 - force off) */
7170
unsigned int sync_decompress;
72-
7371
/* threshold for decompression synchronously */
7472
unsigned int max_sync_decompress_pages;
75-
#endif
7673
unsigned int mount_opt;
7774
};
7875

fs/erofs/super.c

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -943,26 +943,14 @@ static int erofs_show_options(struct seq_file *seq, struct dentry *root)
943943
struct erofs_sb_info *sbi = EROFS_SB(root->d_sb);
944944
struct erofs_mount_opts *opt = &sbi->opt;
945945

946-
#ifdef CONFIG_EROFS_FS_XATTR
947-
if (test_opt(opt, XATTR_USER))
948-
seq_puts(seq, ",user_xattr");
949-
else
950-
seq_puts(seq, ",nouser_xattr");
951-
#endif
952-
#ifdef CONFIG_EROFS_FS_POSIX_ACL
953-
if (test_opt(opt, POSIX_ACL))
954-
seq_puts(seq, ",acl");
955-
else
956-
seq_puts(seq, ",noacl");
957-
#endif
958-
#ifdef CONFIG_EROFS_FS_ZIP
959-
if (opt->cache_strategy == EROFS_ZIP_CACHE_DISABLED)
960-
seq_puts(seq, ",cache_strategy=disabled");
961-
else if (opt->cache_strategy == EROFS_ZIP_CACHE_READAHEAD)
962-
seq_puts(seq, ",cache_strategy=readahead");
963-
else if (opt->cache_strategy == EROFS_ZIP_CACHE_READAROUND)
964-
seq_puts(seq, ",cache_strategy=readaround");
965-
#endif
946+
if (IS_ENABLED(CONFIG_EROFS_FS_XATTR))
947+
seq_puts(seq, test_opt(opt, XATTR_USER) ?
948+
",user_xattr" : ",nouser_xattr");
949+
if (IS_ENABLED(CONFIG_EROFS_FS_POSIX_ACL))
950+
seq_puts(seq, test_opt(opt, POSIX_ACL) ? ",acl" : ",noacl");
951+
if (IS_ENABLED(CONFIG_EROFS_FS_ZIP))
952+
seq_printf(seq, ",cache_strategy=%s",
953+
erofs_param_cache_strategy[opt->cache_strategy].name);
966954
if (test_opt(opt, DAX_ALWAYS))
967955
seq_puts(seq, ",dax=always");
968956
if (test_opt(opt, DAX_NEVER))

0 commit comments

Comments
 (0)