Skip to content

Commit 68afa7e

Browse files
tgnottinghamtytso
authored andcommitted
ext4: show more binary mount options in procfs
Previously, /proc/fs/ext4/<dev>/options would only show binary options if they were set (1 in the options bit mask). E.g. it would show "grpid" if it was set, but it would not show "nogrpid" if grpid was not set. This seems sensible, but when an option is absent from the file, it can be hard for the unfamiliar to know what is being used. E.g. if there isn't a (no)grpid entry, nogrpid is in effect. But if there isn't a (no)auto_da_alloc entry, auto_da_alloc is in effect. If there isn't a (minixdf|bsddf) entry, it turns out bsddf is in effect. It all depends on how the option is implemented. It's clearer to be explicit, so print the corresponding option regardless of whether it means a 1 or a 0 in the bit mask. Note that options which do not have an explicit disable option aren't indicated as being disabled even with this change (e.g. dax). Signed-off-by: Tyson Nottingham <[email protected]> Signed-off-by: Theodore Ts'o <[email protected]>
1 parent bc1420a commit 68afa7e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

fs/ext4/super.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2021,7 +2021,7 @@ static int _ext4_show_options(struct seq_file *seq, struct super_block *sb,
20212021
{
20222022
struct ext4_sb_info *sbi = EXT4_SB(sb);
20232023
struct ext4_super_block *es = sbi->s_es;
2024-
int def_errors, def_mount_opt = nodefs ? 0 : sbi->s_def_mount_opt;
2024+
int def_errors, def_mount_opt = sbi->s_def_mount_opt;
20252025
const struct mount_opts *m;
20262026
char sep = nodefs ? '\n' : ',';
20272027

@@ -2036,7 +2036,7 @@ static int _ext4_show_options(struct seq_file *seq, struct super_block *sb,
20362036
if (((m->flags & (MOPT_SET|MOPT_CLEAR)) == 0) ||
20372037
(m->flags & MOPT_CLEAR_ERR))
20382038
continue;
2039-
if (!(m->mount_opt & (sbi->s_mount_opt ^ def_mount_opt)))
2039+
if (!nodefs && !(m->mount_opt & (sbi->s_mount_opt ^ def_mount_opt)))
20402040
continue; /* skip if same as the default */
20412041
if ((want_set &&
20422042
(sbi->s_mount_opt & m->mount_opt) != m->mount_opt) ||
@@ -2070,7 +2070,8 @@ static int _ext4_show_options(struct seq_file *seq, struct super_block *sb,
20702070
SEQ_OPTS_PUTS("i_version");
20712071
if (nodefs || sbi->s_stripe)
20722072
SEQ_OPTS_PRINT("stripe=%lu", sbi->s_stripe);
2073-
if (EXT4_MOUNT_DATA_FLAGS & (sbi->s_mount_opt ^ def_mount_opt)) {
2073+
if (nodefs || EXT4_MOUNT_DATA_FLAGS &
2074+
(sbi->s_mount_opt ^ def_mount_opt)) {
20742075
if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA)
20752076
SEQ_OPTS_PUTS("data=journal");
20762077
else if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_ORDERED_DATA)

0 commit comments

Comments
 (0)