| @@ -596,9 +596,80 @@ static inline void ext4_show_quota_options(struct seq_file *seq, struct super_bl · 595 unmodified lines |
| 596 | 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 | + */ |
| 599 | 604 | static int ext4_show_options(struct seq_file *seq, struct vfsmount *vfs) |
| 600 | 605 | { |
| 601 | 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 | 674 | if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA) |
| 604 | 675 | seq_puts(seq, ",data=journal"); |
| @@ -1486,6 +1557,7 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent) · 881 unmodified lines |
| 1486 | 1557 | sbi->s_mount_opt = 0; |
| 1487 | 1558 | sbi->s_resuid = EXT4_DEF_RESUID; |
| 1488 | 1559 | sbi->s_resgid = EXT4_DEF_RESGID; |
| 1560 | + sbi->s_sb_block = sb_block; |
| 1489 | 1561 | |
| 1490 | 1562 | unlock_kernel(); |
| 1491 | 1563 | |