aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/ext4/super.c72
-rw-r--r--include/linux/ext4_fs_sb.h1
2 files changed, 73 insertions, 0 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index fc3eb79faa49..0e829cc8a18a 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -596,9 +596,80 @@ static inline void ext4_show_quota_options(struct seq_file *seq, struct super_bl
596#endif 596#endif
597} 597}
598 598
599/*
600 * Show an option if
601 * - it's set to a non-default value OR
602 * - if the per-sb default is different from the global default
603 */
599static int ext4_show_options(struct seq_file *seq, struct vfsmount *vfs) 604static int ext4_show_options(struct seq_file *seq, struct vfsmount *vfs)
600{ 605{
601 struct super_block *sb = vfs->mnt_sb; 606 struct super_block *sb = vfs->mnt_sb;
607 struct ext4_sb_info *sbi = EXT4_SB(sb);
608 struct ext4_super_block *es = sbi->s_es;
609 unsigned long def_mount_opts;
610
611 def_mount_opts = le32_to_cpu(es->s_default_mount_opts);
612
613 if (sbi->s_sb_block != 1)
614 seq_printf(seq, ",sb=%llu", sbi->s_sb_block);
615 if (test_opt(sb, MINIX_DF))
616 seq_puts(seq, ",minixdf");
617 if (test_opt(sb, GRPID))
618 seq_puts(seq, ",grpid");
619 if (!test_opt(sb, GRPID) && (def_mount_opts & EXT4_DEFM_BSDGROUPS))
620 seq_puts(seq, ",nogrpid");
621 if (sbi->s_resuid != EXT4_DEF_RESUID ||
622 le16_to_cpu(es->s_def_resuid) != EXT4_DEF_RESUID) {
623 seq_printf(seq, ",resuid=%u", sbi->s_resuid);
624 }
625 if (sbi->s_resgid != EXT4_DEF_RESGID ||
626 le16_to_cpu(es->s_def_resgid) != EXT4_DEF_RESGID) {
627 seq_printf(seq, ",resgid=%u", sbi->s_resgid);
628 }
629 if (test_opt(sb, ERRORS_CONT)) {
630 int def_errors = le16_to_cpu(es->s_errors);
631
632 if (def_errors == EXT4_ERRORS_PANIC ||
633 def_errors == EXT4_ERRORS_RO) {
634 seq_puts(seq, ",errors=continue");
635 }
636 }
637 if (test_opt(sb, ERRORS_RO))
638 seq_puts(seq, ",errors=remount-ro");
639 if (test_opt(sb, ERRORS_PANIC))
640 seq_puts(seq, ",errors=panic");
641 if (test_opt(sb, NO_UID32))
642 seq_puts(seq, ",nouid32");
643 if (test_opt(sb, DEBUG))
644 seq_puts(seq, ",debug");
645 if (test_opt(sb, OLDALLOC))
646 seq_puts(seq, ",oldalloc");
647#ifdef CONFIG_EXT4_FS_XATTR
648 if (test_opt(sb, XATTR_USER))
649 seq_puts(seq, ",user_xattr");
650 if (!test_opt(sb, XATTR_USER) &&
651 (def_mount_opts & EXT4_DEFM_XATTR_USER)) {
652 seq_puts(seq, ",nouser_xattr");
653 }
654#endif
655#ifdef CONFIG_EXT4_FS_POSIX_ACL
656 if (test_opt(sb, POSIX_ACL))
657 seq_puts(seq, ",acl");
658 if (!test_opt(sb, POSIX_ACL) && (def_mount_opts & EXT4_DEFM_ACL))
659 seq_puts(seq, ",noacl");
660#endif
661 if (!test_opt(sb, RESERVATION))
662 seq_puts(seq, ",noreservation");
663 if (sbi->s_commit_interval) {
664 seq_printf(seq, ",commit=%u",
665 (unsigned) (sbi->s_commit_interval / HZ));
666 }
667 if (test_opt(sb, BARRIER))
668 seq_puts(seq, ",barrier=1");
669 if (test_opt(sb, NOBH))
670 seq_puts(seq, ",nobh");
671 if (!test_opt(sb, EXTENTS))
672 seq_puts(seq, ",noextents");
602 673
603 if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA) 674 if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA)
604 seq_puts(seq, ",data=journal"); 675 seq_puts(seq, ",data=journal");
@@ -1486,6 +1557,7 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent)
1486 sbi->s_mount_opt = 0; 1557 sbi->s_mount_opt = 0;
1487 sbi->s_resuid = EXT4_DEF_RESUID; 1558 sbi->s_resuid = EXT4_DEF_RESUID;
1488 sbi->s_resgid = EXT4_DEF_RESGID; 1559 sbi->s_resgid = EXT4_DEF_RESGID;
1560 sbi->s_sb_block = sb_block;
1489 1561
1490 unlock_kernel(); 1562 unlock_kernel();
1491 1563
diff --git a/include/linux/ext4_fs_sb.h b/include/linux/ext4_fs_sb.h
index 1b2ffee12be9..0a8e47d47c91 100644
--- a/include/linux/ext4_fs_sb.h
+++ b/include/linux/ext4_fs_sb.h
@@ -45,6 +45,7 @@ struct ext4_sb_info {
45 struct ext4_super_block * s_es; /* Pointer to the super block in the buffer */ 45 struct ext4_super_block * s_es; /* Pointer to the super block in the buffer */
46 struct buffer_head ** s_group_desc; 46 struct buffer_head ** s_group_desc;
47 unsigned long s_mount_opt; 47 unsigned long s_mount_opt;
48 ext4_fsblk_t s_sb_block;
48 uid_t s_resuid; 49 uid_t s_resuid;
49 gid_t s_resgid; 50 gid_t s_resgid;
50 unsigned short s_mount_state; 51 unsigned short s_mount_state;