aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ext4')
-rw-r--r--fs/ext4/super.c349
1 files changed, 175 insertions, 174 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 61a65ee2c905..7e3a319ec402 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -62,6 +62,7 @@ static struct ext4_features *ext4_feat;
62 62
63static int ext4_load_journal(struct super_block *, struct ext4_super_block *, 63static int ext4_load_journal(struct super_block *, struct ext4_super_block *,
64 unsigned long journal_devnum); 64 unsigned long journal_devnum);
65static int ext4_show_options(struct seq_file *seq, struct dentry *root);
65static int ext4_commit_super(struct super_block *sb, int sync); 66static int ext4_commit_super(struct super_block *sb, int sync);
66static void ext4_mark_recovery_complete(struct super_block *sb, 67static void ext4_mark_recovery_complete(struct super_block *sb,
67 struct ext4_super_block *es); 68 struct ext4_super_block *es);
@@ -1006,180 +1007,6 @@ void ext4_clear_inode(struct inode *inode)
1006 } 1007 }
1007} 1008}
1008 1009
1009static inline void ext4_show_quota_options(struct seq_file *seq,
1010 struct super_block *sb)
1011{
1012#if defined(CONFIG_QUOTA)
1013 struct ext4_sb_info *sbi = EXT4_SB(sb);
1014
1015 if (sbi->s_jquota_fmt) {
1016 char *fmtname = "";
1017
1018 switch (sbi->s_jquota_fmt) {
1019 case QFMT_VFS_OLD:
1020 fmtname = "vfsold";
1021 break;
1022 case QFMT_VFS_V0:
1023 fmtname = "vfsv0";
1024 break;
1025 case QFMT_VFS_V1:
1026 fmtname = "vfsv1";
1027 break;
1028 }
1029 seq_printf(seq, ",jqfmt=%s", fmtname);
1030 }
1031
1032 if (sbi->s_qf_names[USRQUOTA])
1033 seq_printf(seq, ",usrjquota=%s", sbi->s_qf_names[USRQUOTA]);
1034
1035 if (sbi->s_qf_names[GRPQUOTA])
1036 seq_printf(seq, ",grpjquota=%s", sbi->s_qf_names[GRPQUOTA]);
1037
1038 if (test_opt(sb, USRQUOTA))
1039 seq_puts(seq, ",usrquota");
1040
1041 if (test_opt(sb, GRPQUOTA))
1042 seq_puts(seq, ",grpquota");
1043#endif
1044}
1045
1046/*
1047 * Show an option if
1048 * - it's set to a non-default value OR
1049 * - if the per-sb default is different from the global default
1050 */
1051static int ext4_show_options(struct seq_file *seq, struct dentry *root)
1052{
1053 int def_errors;
1054 unsigned long def_mount_opts;
1055 struct super_block *sb = root->d_sb;
1056 struct ext4_sb_info *sbi = EXT4_SB(sb);
1057 struct ext4_super_block *es = sbi->s_es;
1058
1059 def_mount_opts = le32_to_cpu(es->s_default_mount_opts);
1060 def_errors = le16_to_cpu(es->s_errors);
1061
1062 if (sbi->s_sb_block != 1)
1063 seq_printf(seq, ",sb=%llu", sbi->s_sb_block);
1064 if (test_opt(sb, MINIX_DF))
1065 seq_puts(seq, ",minixdf");
1066 if (test_opt(sb, GRPID) && !(def_mount_opts & EXT4_DEFM_BSDGROUPS))
1067 seq_puts(seq, ",grpid");
1068 if (!test_opt(sb, GRPID) && (def_mount_opts & EXT4_DEFM_BSDGROUPS))
1069 seq_puts(seq, ",nogrpid");
1070 if (sbi->s_resuid != EXT4_DEF_RESUID ||
1071 le16_to_cpu(es->s_def_resuid) != EXT4_DEF_RESUID) {
1072 seq_printf(seq, ",resuid=%u", sbi->s_resuid);
1073 }
1074 if (sbi->s_resgid != EXT4_DEF_RESGID ||
1075 le16_to_cpu(es->s_def_resgid) != EXT4_DEF_RESGID) {
1076 seq_printf(seq, ",resgid=%u", sbi->s_resgid);
1077 }
1078 if (test_opt(sb, ERRORS_RO)) {
1079 if (def_errors == EXT4_ERRORS_PANIC ||
1080 def_errors == EXT4_ERRORS_CONTINUE) {
1081 seq_puts(seq, ",errors=remount-ro");
1082 }
1083 }
1084 if (test_opt(sb, ERRORS_CONT) && def_errors != EXT4_ERRORS_CONTINUE)
1085 seq_puts(seq, ",errors=continue");
1086 if (test_opt(sb, ERRORS_PANIC) && def_errors != EXT4_ERRORS_PANIC)
1087 seq_puts(seq, ",errors=panic");
1088 if (test_opt(sb, NO_UID32) && !(def_mount_opts & EXT4_DEFM_UID16))
1089 seq_puts(seq, ",nouid32");
1090 if (test_opt(sb, DEBUG) && !(def_mount_opts & EXT4_DEFM_DEBUG))
1091 seq_puts(seq, ",debug");
1092#ifdef CONFIG_EXT4_FS_XATTR
1093 if (test_opt(sb, XATTR_USER))
1094 seq_puts(seq, ",user_xattr");
1095 if (!test_opt(sb, XATTR_USER))
1096 seq_puts(seq, ",nouser_xattr");
1097#endif
1098#ifdef CONFIG_EXT4_FS_POSIX_ACL
1099 if (test_opt(sb, POSIX_ACL) && !(def_mount_opts & EXT4_DEFM_ACL))
1100 seq_puts(seq, ",acl");
1101 if (!test_opt(sb, POSIX_ACL) && (def_mount_opts & EXT4_DEFM_ACL))
1102 seq_puts(seq, ",noacl");
1103#endif
1104 if (sbi->s_commit_interval != JBD2_DEFAULT_MAX_COMMIT_AGE*HZ) {
1105 seq_printf(seq, ",commit=%u",
1106 (unsigned) (sbi->s_commit_interval / HZ));
1107 }
1108 if (sbi->s_min_batch_time != EXT4_DEF_MIN_BATCH_TIME) {
1109 seq_printf(seq, ",min_batch_time=%u",
1110 (unsigned) sbi->s_min_batch_time);
1111 }
1112 if (sbi->s_max_batch_time != EXT4_DEF_MAX_BATCH_TIME) {
1113 seq_printf(seq, ",max_batch_time=%u",
1114 (unsigned) sbi->s_max_batch_time);
1115 }
1116
1117 /*
1118 * We're changing the default of barrier mount option, so
1119 * let's always display its mount state so it's clear what its
1120 * status is.
1121 */
1122 seq_puts(seq, ",barrier=");
1123 seq_puts(seq, test_opt(sb, BARRIER) ? "1" : "0");
1124 if (test_opt(sb, JOURNAL_ASYNC_COMMIT))
1125 seq_puts(seq, ",journal_async_commit");
1126 else if (test_opt(sb, JOURNAL_CHECKSUM))
1127 seq_puts(seq, ",journal_checksum");
1128 if (sb->s_flags & MS_I_VERSION)
1129 seq_puts(seq, ",i_version");
1130 if (!test_opt(sb, DELALLOC) &&
1131 !(def_mount_opts & EXT4_DEFM_NODELALLOC))
1132 seq_puts(seq, ",nodelalloc");
1133
1134 if (!test_opt(sb, MBLK_IO_SUBMIT))
1135 seq_puts(seq, ",nomblk_io_submit");
1136 if (sbi->s_stripe)
1137 seq_printf(seq, ",stripe=%lu", sbi->s_stripe);
1138 /*
1139 * journal mode get enabled in different ways
1140 * So just print the value even if we didn't specify it
1141 */
1142 if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA)
1143 seq_puts(seq, ",data=journal");
1144 else if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_ORDERED_DATA)
1145 seq_puts(seq, ",data=ordered");
1146 else if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_WRITEBACK_DATA)
1147 seq_puts(seq, ",data=writeback");
1148
1149 if (sbi->s_inode_readahead_blks != EXT4_DEF_INODE_READAHEAD_BLKS)
1150 seq_printf(seq, ",inode_readahead_blks=%u",
1151 sbi->s_inode_readahead_blks);
1152
1153 if (test_opt(sb, DATA_ERR_ABORT))
1154 seq_puts(seq, ",data_err=abort");
1155
1156 if (test_opt(sb, NO_AUTO_DA_ALLOC))
1157 seq_puts(seq, ",noauto_da_alloc");
1158
1159 if (test_opt(sb, DISCARD) && !(def_mount_opts & EXT4_DEFM_DISCARD))
1160 seq_puts(seq, ",discard");
1161
1162 if (test_opt(sb, NOLOAD))
1163 seq_puts(seq, ",norecovery");
1164
1165 if (test_opt(sb, DIOREAD_NOLOCK))
1166 seq_puts(seq, ",dioread_nolock");
1167
1168 if (test_opt(sb, BLOCK_VALIDITY) &&
1169 !(def_mount_opts & EXT4_DEFM_BLOCK_VALIDITY))
1170 seq_puts(seq, ",block_validity");
1171
1172 if (!test_opt(sb, INIT_INODE_TABLE))
1173 seq_puts(seq, ",noinit_itable");
1174 else if (sbi->s_li_wait_mult != EXT4_DEF_LI_WAIT_MULT)
1175 seq_printf(seq, ",init_itable=%u",
1176 (unsigned) sbi->s_li_wait_mult);
1177
1178 ext4_show_quota_options(seq, sb);
1179
1180 return 0;
1181}
1182
1183static struct inode *ext4_nfs_get_inode(struct super_block *sb, 1010static struct inode *ext4_nfs_get_inode(struct super_block *sb,
1184 u64 ino, u32 generation) 1011 u64 ino, u32 generation)
1185{ 1012{
@@ -1804,6 +1631,180 @@ static int parse_options(char *options, struct super_block *sb,
1804 return 1; 1631 return 1;
1805} 1632}
1806 1633
1634static inline void ext4_show_quota_options(struct seq_file *seq,
1635 struct super_block *sb)
1636{
1637#if defined(CONFIG_QUOTA)
1638 struct ext4_sb_info *sbi = EXT4_SB(sb);
1639
1640 if (sbi->s_jquota_fmt) {
1641 char *fmtname = "";
1642
1643 switch (sbi->s_jquota_fmt) {
1644 case QFMT_VFS_OLD:
1645 fmtname = "vfsold";
1646 break;
1647 case QFMT_VFS_V0:
1648 fmtname = "vfsv0";
1649 break;
1650 case QFMT_VFS_V1:
1651 fmtname = "vfsv1";
1652 break;
1653 }
1654 seq_printf(seq, ",jqfmt=%s", fmtname);
1655 }
1656
1657 if (sbi->s_qf_names[USRQUOTA])
1658 seq_printf(seq, ",usrjquota=%s", sbi->s_qf_names[USRQUOTA]);
1659
1660 if (sbi->s_qf_names[GRPQUOTA])
1661 seq_printf(seq, ",grpjquota=%s", sbi->s_qf_names[GRPQUOTA]);
1662
1663 if (test_opt(sb, USRQUOTA))
1664 seq_puts(seq, ",usrquota");
1665
1666 if (test_opt(sb, GRPQUOTA))
1667 seq_puts(seq, ",grpquota");
1668#endif
1669}
1670
1671/*
1672 * Show an option if
1673 * - it's set to a non-default value OR
1674 * - if the per-sb default is different from the global default
1675 */
1676static int ext4_show_options(struct seq_file *seq, struct dentry *root)
1677{
1678 int def_errors;
1679 unsigned long def_mount_opts;
1680 struct super_block *sb = root->d_sb;
1681 struct ext4_sb_info *sbi = EXT4_SB(sb);
1682 struct ext4_super_block *es = sbi->s_es;
1683
1684 def_mount_opts = le32_to_cpu(es->s_default_mount_opts);
1685 def_errors = le16_to_cpu(es->s_errors);
1686
1687 if (sbi->s_sb_block != 1)
1688 seq_printf(seq, ",sb=%llu", sbi->s_sb_block);
1689 if (test_opt(sb, MINIX_DF))
1690 seq_puts(seq, ",minixdf");
1691 if (test_opt(sb, GRPID) && !(def_mount_opts & EXT4_DEFM_BSDGROUPS))
1692 seq_puts(seq, ",grpid");
1693 if (!test_opt(sb, GRPID) && (def_mount_opts & EXT4_DEFM_BSDGROUPS))
1694 seq_puts(seq, ",nogrpid");
1695 if (sbi->s_resuid != EXT4_DEF_RESUID ||
1696 le16_to_cpu(es->s_def_resuid) != EXT4_DEF_RESUID) {
1697 seq_printf(seq, ",resuid=%u", sbi->s_resuid);
1698 }
1699 if (sbi->s_resgid != EXT4_DEF_RESGID ||
1700 le16_to_cpu(es->s_def_resgid) != EXT4_DEF_RESGID) {
1701 seq_printf(seq, ",resgid=%u", sbi->s_resgid);
1702 }
1703 if (test_opt(sb, ERRORS_RO)) {
1704 if (def_errors == EXT4_ERRORS_PANIC ||
1705 def_errors == EXT4_ERRORS_CONTINUE) {
1706 seq_puts(seq, ",errors=remount-ro");
1707 }
1708 }
1709 if (test_opt(sb, ERRORS_CONT) && def_errors != EXT4_ERRORS_CONTINUE)
1710 seq_puts(seq, ",errors=continue");
1711 if (test_opt(sb, ERRORS_PANIC) && def_errors != EXT4_ERRORS_PANIC)
1712 seq_puts(seq, ",errors=panic");
1713 if (test_opt(sb, NO_UID32) && !(def_mount_opts & EXT4_DEFM_UID16))
1714 seq_puts(seq, ",nouid32");
1715 if (test_opt(sb, DEBUG) && !(def_mount_opts & EXT4_DEFM_DEBUG))
1716 seq_puts(seq, ",debug");
1717#ifdef CONFIG_EXT4_FS_XATTR
1718 if (test_opt(sb, XATTR_USER))
1719 seq_puts(seq, ",user_xattr");
1720 if (!test_opt(sb, XATTR_USER))
1721 seq_puts(seq, ",nouser_xattr");
1722#endif
1723#ifdef CONFIG_EXT4_FS_POSIX_ACL
1724 if (test_opt(sb, POSIX_ACL) && !(def_mount_opts & EXT4_DEFM_ACL))
1725 seq_puts(seq, ",acl");
1726 if (!test_opt(sb, POSIX_ACL) && (def_mount_opts & EXT4_DEFM_ACL))
1727 seq_puts(seq, ",noacl");
1728#endif
1729 if (sbi->s_commit_interval != JBD2_DEFAULT_MAX_COMMIT_AGE*HZ) {
1730 seq_printf(seq, ",commit=%u",
1731 (unsigned) (sbi->s_commit_interval / HZ));
1732 }
1733 if (sbi->s_min_batch_time != EXT4_DEF_MIN_BATCH_TIME) {
1734 seq_printf(seq, ",min_batch_time=%u",
1735 (unsigned) sbi->s_min_batch_time);
1736 }
1737 if (sbi->s_max_batch_time != EXT4_DEF_MAX_BATCH_TIME) {
1738 seq_printf(seq, ",max_batch_time=%u",
1739 (unsigned) sbi->s_max_batch_time);
1740 }
1741
1742 /*
1743 * We're changing the default of barrier mount option, so
1744 * let's always display its mount state so it's clear what its
1745 * status is.
1746 */
1747 seq_puts(seq, ",barrier=");
1748 seq_puts(seq, test_opt(sb, BARRIER) ? "1" : "0");
1749 if (test_opt(sb, JOURNAL_ASYNC_COMMIT))
1750 seq_puts(seq, ",journal_async_commit");
1751 else if (test_opt(sb, JOURNAL_CHECKSUM))
1752 seq_puts(seq, ",journal_checksum");
1753 if (sb->s_flags & MS_I_VERSION)
1754 seq_puts(seq, ",i_version");
1755 if (!test_opt(sb, DELALLOC) &&
1756 !(def_mount_opts & EXT4_DEFM_NODELALLOC))
1757 seq_puts(seq, ",nodelalloc");
1758
1759 if (!test_opt(sb, MBLK_IO_SUBMIT))
1760 seq_puts(seq, ",nomblk_io_submit");
1761 if (sbi->s_stripe)
1762 seq_printf(seq, ",stripe=%lu", sbi->s_stripe);
1763 /*
1764 * journal mode get enabled in different ways
1765 * So just print the value even if we didn't specify it
1766 */
1767 if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA)
1768 seq_puts(seq, ",data=journal");
1769 else if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_ORDERED_DATA)
1770 seq_puts(seq, ",data=ordered");
1771 else if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_WRITEBACK_DATA)
1772 seq_puts(seq, ",data=writeback");
1773
1774 if (sbi->s_inode_readahead_blks != EXT4_DEF_INODE_READAHEAD_BLKS)
1775 seq_printf(seq, ",inode_readahead_blks=%u",
1776 sbi->s_inode_readahead_blks);
1777
1778 if (test_opt(sb, DATA_ERR_ABORT))
1779 seq_puts(seq, ",data_err=abort");
1780
1781 if (test_opt(sb, NO_AUTO_DA_ALLOC))
1782 seq_puts(seq, ",noauto_da_alloc");
1783
1784 if (test_opt(sb, DISCARD) && !(def_mount_opts & EXT4_DEFM_DISCARD))
1785 seq_puts(seq, ",discard");
1786
1787 if (test_opt(sb, NOLOAD))
1788 seq_puts(seq, ",norecovery");
1789
1790 if (test_opt(sb, DIOREAD_NOLOCK))
1791 seq_puts(seq, ",dioread_nolock");
1792
1793 if (test_opt(sb, BLOCK_VALIDITY) &&
1794 !(def_mount_opts & EXT4_DEFM_BLOCK_VALIDITY))
1795 seq_puts(seq, ",block_validity");
1796
1797 if (!test_opt(sb, INIT_INODE_TABLE))
1798 seq_puts(seq, ",noinit_itable");
1799 else if (sbi->s_li_wait_mult != EXT4_DEF_LI_WAIT_MULT)
1800 seq_printf(seq, ",init_itable=%u",
1801 (unsigned) sbi->s_li_wait_mult);
1802
1803 ext4_show_quota_options(seq, sb);
1804
1805 return 0;
1806}
1807
1807static int ext4_setup_super(struct super_block *sb, struct ext4_super_block *es, 1808static int ext4_setup_super(struct super_block *sb, struct ext4_super_block *es,
1808 int read_only) 1809 int read_only)
1809{ 1810{