aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/super.c
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2015-10-17 16:18:43 -0400
committerTheodore Ts'o <tytso@mit.edu>2015-10-17 16:18:43 -0400
commite2b911c53584a92266943f3b7f2cdbc19c1a4e80 (patch)
tree2f1fd1771ef5e3a24b05c1fad3dc9026b3ecd73d /fs/ext4/super.c
parent6a797d2737838906f2ea0a31686e87c3151e21ca (diff)
ext4: clean up feature test macros with predicate functions
Create separate predicate functions to test/set/clear feature flags, thereby replacing the wordy old macros. Furthermore, clean out the places where we open-coded feature tests. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Diffstat (limited to 'fs/ext4/super.c')
-rw-r--r--fs/ext4/super.c165
1 files changed, 71 insertions, 94 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index f7519ad25cce..49fa4d48b6a4 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -110,8 +110,7 @@ MODULE_ALIAS("ext3");
110static int ext4_verify_csum_type(struct super_block *sb, 110static int ext4_verify_csum_type(struct super_block *sb,
111 struct ext4_super_block *es) 111 struct ext4_super_block *es)
112{ 112{
113 if (!EXT4_HAS_RO_COMPAT_FEATURE(sb, 113 if (!ext4_has_feature_metadata_csum(sb))
114 EXT4_FEATURE_RO_COMPAT_METADATA_CSUM))
115 return 1; 114 return 1;
116 115
117 return es->s_checksum_type == EXT4_CRC32C_CHKSUM; 116 return es->s_checksum_type == EXT4_CRC32C_CHKSUM;
@@ -810,7 +809,7 @@ static void ext4_put_super(struct super_block *sb)
810 ext4_xattr_put_super(sb); 809 ext4_xattr_put_super(sb);
811 810
812 if (!(sb->s_flags & MS_RDONLY)) { 811 if (!(sb->s_flags & MS_RDONLY)) {
813 EXT4_CLEAR_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER); 812 ext4_clear_feature_journal_needs_recovery(sb);
814 es->s_state = cpu_to_le16(sbi->s_mount_state); 813 es->s_state = cpu_to_le16(sbi->s_mount_state);
815 } 814 }
816 if (!(sb->s_flags & MS_RDONLY)) 815 if (!(sb->s_flags & MS_RDONLY))
@@ -1284,7 +1283,7 @@ static int set_qf_name(struct super_block *sb, int qtype, substring_t *args)
1284 "quota options when quota turned on"); 1283 "quota options when quota turned on");
1285 return -1; 1284 return -1;
1286 } 1285 }
1287 if (EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_QUOTA)) { 1286 if (ext4_has_feature_quota(sb)) {
1288 ext4_msg(sb, KERN_ERR, "Cannot set journaled quota options " 1287 ext4_msg(sb, KERN_ERR, "Cannot set journaled quota options "
1289 "when QUOTA feature is enabled"); 1288 "when QUOTA feature is enabled");
1290 return -1; 1289 return -1;
@@ -1643,8 +1642,7 @@ static int handle_mount_opt(struct super_block *sb, char *opt, int token,
1643 "quota options when quota turned on"); 1642 "quota options when quota turned on");
1644 return -1; 1643 return -1;
1645 } 1644 }
1646 if (EXT4_HAS_RO_COMPAT_FEATURE(sb, 1645 if (ext4_has_feature_quota(sb)) {
1647 EXT4_FEATURE_RO_COMPAT_QUOTA)) {
1648 ext4_msg(sb, KERN_ERR, 1646 ext4_msg(sb, KERN_ERR,
1649 "Cannot set journaled quota options " 1647 "Cannot set journaled quota options "
1650 "when QUOTA feature is enabled"); 1648 "when QUOTA feature is enabled");
@@ -1703,7 +1701,7 @@ static int parse_options(char *options, struct super_block *sb,
1703 return 0; 1701 return 0;
1704 } 1702 }
1705#ifdef CONFIG_QUOTA 1703#ifdef CONFIG_QUOTA
1706 if (EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_QUOTA) && 1704 if (ext4_has_feature_quota(sb) &&
1707 (test_opt(sb, USRQUOTA) || test_opt(sb, GRPQUOTA))) { 1705 (test_opt(sb, USRQUOTA) || test_opt(sb, GRPQUOTA))) {
1708 ext4_msg(sb, KERN_ERR, "Cannot set quota options when QUOTA " 1706 ext4_msg(sb, KERN_ERR, "Cannot set quota options when QUOTA "
1709 "feature is enabled"); 1707 "feature is enabled");
@@ -1927,7 +1925,7 @@ static int ext4_setup_super(struct super_block *sb, struct ext4_super_block *es,
1927 es->s_mtime = cpu_to_le32(get_seconds()); 1925 es->s_mtime = cpu_to_le32(get_seconds());
1928 ext4_update_dynamic_rev(sb); 1926 ext4_update_dynamic_rev(sb);
1929 if (sbi->s_journal) 1927 if (sbi->s_journal)
1930 EXT4_SET_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER); 1928 ext4_set_feature_journal_needs_recovery(sb);
1931 1929
1932 ext4_commit_super(sb, 1); 1930 ext4_commit_super(sb, 1);
1933done: 1931done:
@@ -2010,12 +2008,13 @@ failed:
2010 return 0; 2008 return 0;
2011} 2009}
2012 2010
2013static __le16 ext4_group_desc_csum(struct ext4_sb_info *sbi, __u32 block_group, 2011static __le16 ext4_group_desc_csum(struct super_block *sb, __u32 block_group,
2014 struct ext4_group_desc *gdp) 2012 struct ext4_group_desc *gdp)
2015{ 2013{
2016 int offset; 2014 int offset;
2017 __u16 crc = 0; 2015 __u16 crc = 0;
2018 __le32 le_group = cpu_to_le32(block_group); 2016 __le32 le_group = cpu_to_le32(block_group);
2017 struct ext4_sb_info *sbi = EXT4_SB(sb);
2019 2018
2020 if (ext4_has_metadata_csum(sbi->s_sb)) { 2019 if (ext4_has_metadata_csum(sbi->s_sb)) {
2021 /* Use new metadata_csum algorithm */ 2020 /* Use new metadata_csum algorithm */
@@ -2035,8 +2034,7 @@ static __le16 ext4_group_desc_csum(struct ext4_sb_info *sbi, __u32 block_group,
2035 } 2034 }
2036 2035
2037 /* old crc16 code */ 2036 /* old crc16 code */
2038 if (!(sbi->s_es->s_feature_ro_compat & 2037 if (!ext4_has_feature_gdt_csum(sb))
2039 cpu_to_le32(EXT4_FEATURE_RO_COMPAT_GDT_CSUM)))
2040 return 0; 2038 return 0;
2041 2039
2042 offset = offsetof(struct ext4_group_desc, bg_checksum); 2040 offset = offsetof(struct ext4_group_desc, bg_checksum);
@@ -2046,8 +2044,7 @@ static __le16 ext4_group_desc_csum(struct ext4_sb_info *sbi, __u32 block_group,
2046 crc = crc16(crc, (__u8 *)gdp, offset); 2044 crc = crc16(crc, (__u8 *)gdp, offset);
2047 offset += sizeof(gdp->bg_checksum); /* skip checksum */ 2045 offset += sizeof(gdp->bg_checksum); /* skip checksum */
2048 /* for checksum of struct ext4_group_desc do the rest...*/ 2046 /* for checksum of struct ext4_group_desc do the rest...*/
2049 if ((sbi->s_es->s_feature_incompat & 2047 if (ext4_has_feature_64bit(sb) &&
2050 cpu_to_le32(EXT4_FEATURE_INCOMPAT_64BIT)) &&
2051 offset < le16_to_cpu(sbi->s_es->s_desc_size)) 2048 offset < le16_to_cpu(sbi->s_es->s_desc_size))
2052 crc = crc16(crc, (__u8 *)gdp + offset, 2049 crc = crc16(crc, (__u8 *)gdp + offset,
2053 le16_to_cpu(sbi->s_es->s_desc_size) - 2050 le16_to_cpu(sbi->s_es->s_desc_size) -
@@ -2061,8 +2058,7 @@ int ext4_group_desc_csum_verify(struct super_block *sb, __u32 block_group,
2061 struct ext4_group_desc *gdp) 2058 struct ext4_group_desc *gdp)
2062{ 2059{
2063 if (ext4_has_group_desc_csum(sb) && 2060 if (ext4_has_group_desc_csum(sb) &&
2064 (gdp->bg_checksum != ext4_group_desc_csum(EXT4_SB(sb), 2061 (gdp->bg_checksum != ext4_group_desc_csum(sb, block_group, gdp)))
2065 block_group, gdp)))
2066 return 0; 2062 return 0;
2067 2063
2068 return 1; 2064 return 1;
@@ -2073,7 +2069,7 @@ void ext4_group_desc_csum_set(struct super_block *sb, __u32 block_group,
2073{ 2069{
2074 if (!ext4_has_group_desc_csum(sb)) 2070 if (!ext4_has_group_desc_csum(sb))
2075 return; 2071 return;
2076 gdp->bg_checksum = ext4_group_desc_csum(EXT4_SB(sb), block_group, gdp); 2072 gdp->bg_checksum = ext4_group_desc_csum(sb, block_group, gdp);
2077} 2073}
2078 2074
2079/* Called at mount-time, super-block is locked */ 2075/* Called at mount-time, super-block is locked */
@@ -2089,7 +2085,7 @@ static int ext4_check_descriptors(struct super_block *sb,
2089 int flexbg_flag = 0; 2085 int flexbg_flag = 0;
2090 ext4_group_t i, grp = sbi->s_groups_count; 2086 ext4_group_t i, grp = sbi->s_groups_count;
2091 2087
2092 if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_FLEX_BG)) 2088 if (ext4_has_feature_flex_bg(sb))
2093 flexbg_flag = 1; 2089 flexbg_flag = 1;
2094 2090
2095 ext4_debug("Checking group descriptors"); 2091 ext4_debug("Checking group descriptors");
@@ -2133,7 +2129,7 @@ static int ext4_check_descriptors(struct super_block *sb,
2133 if (!ext4_group_desc_csum_verify(sb, i, gdp)) { 2129 if (!ext4_group_desc_csum_verify(sb, i, gdp)) {
2134 ext4_msg(sb, KERN_ERR, "ext4_check_descriptors: " 2130 ext4_msg(sb, KERN_ERR, "ext4_check_descriptors: "
2135 "Checksum for group %u failed (%u!=%u)", 2131 "Checksum for group %u failed (%u!=%u)",
2136 i, le16_to_cpu(ext4_group_desc_csum(sbi, i, 2132 i, le16_to_cpu(ext4_group_desc_csum(sb, i,
2137 gdp)), le16_to_cpu(gdp->bg_checksum)); 2133 gdp)), le16_to_cpu(gdp->bg_checksum));
2138 if (!(sb->s_flags & MS_RDONLY)) { 2134 if (!(sb->s_flags & MS_RDONLY)) {
2139 ext4_unlock_group(sb, i); 2135 ext4_unlock_group(sb, i);
@@ -2396,8 +2392,7 @@ static ext4_fsblk_t descriptor_loc(struct super_block *sb,
2396 2392
2397 first_meta_bg = le32_to_cpu(sbi->s_es->s_first_meta_bg); 2393 first_meta_bg = le32_to_cpu(sbi->s_es->s_first_meta_bg);
2398 2394
2399 if (!EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_META_BG) || 2395 if (!ext4_has_feature_meta_bg(sb) || nr < first_meta_bg)
2400 nr < first_meta_bg)
2401 return logical_sb_block + nr + 1; 2396 return logical_sb_block + nr + 1;
2402 bg = sbi->s_desc_per_block * nr; 2397 bg = sbi->s_desc_per_block * nr;
2403 if (ext4_bg_has_super(sb, bg)) 2398 if (ext4_bg_has_super(sb, bg))
@@ -2461,7 +2456,7 @@ static unsigned long ext4_get_stripe_size(struct ext4_sb_info *sbi)
2461 */ 2456 */
2462static int ext4_feature_set_ok(struct super_block *sb, int readonly) 2457static int ext4_feature_set_ok(struct super_block *sb, int readonly)
2463{ 2458{
2464 if (EXT4_HAS_INCOMPAT_FEATURE(sb, ~EXT4_FEATURE_INCOMPAT_SUPP)) { 2459 if (ext4_has_unknown_ext4_incompat_features(sb)) {
2465 ext4_msg(sb, KERN_ERR, 2460 ext4_msg(sb, KERN_ERR,
2466 "Couldn't mount because of " 2461 "Couldn't mount because of "
2467 "unsupported optional features (%x)", 2462 "unsupported optional features (%x)",
@@ -2473,14 +2468,14 @@ static int ext4_feature_set_ok(struct super_block *sb, int readonly)
2473 if (readonly) 2468 if (readonly)
2474 return 1; 2469 return 1;
2475 2470
2476 if (EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_READONLY)) { 2471 if (ext4_has_feature_readonly(sb)) {
2477 ext4_msg(sb, KERN_INFO, "filesystem is read-only"); 2472 ext4_msg(sb, KERN_INFO, "filesystem is read-only");
2478 sb->s_flags |= MS_RDONLY; 2473 sb->s_flags |= MS_RDONLY;
2479 return 1; 2474 return 1;
2480 } 2475 }
2481 2476
2482 /* Check that feature set is OK for a read-write mount */ 2477 /* Check that feature set is OK for a read-write mount */
2483 if (EXT4_HAS_RO_COMPAT_FEATURE(sb, ~EXT4_FEATURE_RO_COMPAT_SUPP)) { 2478 if (ext4_has_unknown_ext4_ro_compat_features(sb)) {
2484 ext4_msg(sb, KERN_ERR, "couldn't mount RDWR because of " 2479 ext4_msg(sb, KERN_ERR, "couldn't mount RDWR because of "
2485 "unsupported optional features (%x)", 2480 "unsupported optional features (%x)",
2486 (le32_to_cpu(EXT4_SB(sb)->s_es->s_feature_ro_compat) & 2481 (le32_to_cpu(EXT4_SB(sb)->s_es->s_feature_ro_compat) &
@@ -2491,7 +2486,7 @@ static int ext4_feature_set_ok(struct super_block *sb, int readonly)
2491 * Large file size enabled file system can only be mounted 2486 * Large file size enabled file system can only be mounted
2492 * read-write on 32-bit systems if kernel is built with CONFIG_LBDAF 2487 * read-write on 32-bit systems if kernel is built with CONFIG_LBDAF
2493 */ 2488 */
2494 if (EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_HUGE_FILE)) { 2489 if (ext4_has_feature_huge_file(sb)) {
2495 if (sizeof(blkcnt_t) < sizeof(u64)) { 2490 if (sizeof(blkcnt_t) < sizeof(u64)) {
2496 ext4_msg(sb, KERN_ERR, "Filesystem with huge files " 2491 ext4_msg(sb, KERN_ERR, "Filesystem with huge files "
2497 "cannot be mounted RDWR without " 2492 "cannot be mounted RDWR without "
@@ -2499,8 +2494,7 @@ static int ext4_feature_set_ok(struct super_block *sb, int readonly)
2499 return 0; 2494 return 0;
2500 } 2495 }
2501 } 2496 }
2502 if (EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_BIGALLOC) && 2497 if (ext4_has_feature_bigalloc(sb) && !ext4_has_feature_extents(sb)) {
2503 !EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS)) {
2504 ext4_msg(sb, KERN_ERR, 2498 ext4_msg(sb, KERN_ERR,
2505 "Can't support bigalloc feature without " 2499 "Can't support bigalloc feature without "
2506 "extents feature\n"); 2500 "extents feature\n");
@@ -2508,8 +2502,7 @@ static int ext4_feature_set_ok(struct super_block *sb, int readonly)
2508 } 2502 }
2509 2503
2510#ifndef CONFIG_QUOTA 2504#ifndef CONFIG_QUOTA
2511 if (EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_QUOTA) && 2505 if (ext4_has_feature_quota(sb) && !readonly) {
2512 !readonly) {
2513 ext4_msg(sb, KERN_ERR, 2506 ext4_msg(sb, KERN_ERR,
2514 "Filesystem with quota feature cannot be mounted RDWR " 2507 "Filesystem with quota feature cannot be mounted RDWR "
2515 "without CONFIG_QUOTA"); 2508 "without CONFIG_QUOTA");
@@ -2966,7 +2959,7 @@ static int count_overhead(struct super_block *sb, ext4_group_t grp,
2966 ext4_group_t i, ngroups = ext4_get_groups_count(sb); 2959 ext4_group_t i, ngroups = ext4_get_groups_count(sb);
2967 int s, j, count = 0; 2960 int s, j, count = 0;
2968 2961
2969 if (!EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_BIGALLOC)) 2962 if (!ext4_has_feature_bigalloc(sb))
2970 return (ext4_bg_has_super(sb, grp) + ext4_bg_num_gdb(sb, grp) + 2963 return (ext4_bg_has_super(sb, grp) + ext4_bg_num_gdb(sb, grp) +
2971 sbi->s_itb_per_group + 2); 2964 sbi->s_itb_per_group + 2);
2972 2965
@@ -3068,7 +3061,7 @@ static void ext4_set_resv_clusters(struct super_block *sb)
3068 * hole punching doesn't need new metadata... This is needed especially 3061 * hole punching doesn't need new metadata... This is needed especially
3069 * to keep ext2/3 backward compatibility. 3062 * to keep ext2/3 backward compatibility.
3070 */ 3063 */
3071 if (!EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS)) 3064 if (!ext4_has_feature_extents(sb))
3072 return; 3065 return;
3073 /* 3066 /*
3074 * By default we reserve 2% or 4096 clusters, whichever is smaller. 3067 * By default we reserve 2% or 4096 clusters, whichever is smaller.
@@ -3167,9 +3160,8 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
3167 sbi->s_kbytes_written = le64_to_cpu(es->s_kbytes_written); 3160 sbi->s_kbytes_written = le64_to_cpu(es->s_kbytes_written);
3168 3161
3169 /* Warn if metadata_csum and gdt_csum are both set. */ 3162 /* Warn if metadata_csum and gdt_csum are both set. */
3170 if (EXT4_HAS_RO_COMPAT_FEATURE(sb, 3163 if (ext4_has_feature_metadata_csum(sb) &&
3171 EXT4_FEATURE_RO_COMPAT_METADATA_CSUM) && 3164 ext4_has_feature_gdt_csum(sb))
3172 EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_GDT_CSUM))
3173 ext4_warning(sb, "metadata_csum and uninit_bg are " 3165 ext4_warning(sb, "metadata_csum and uninit_bg are "
3174 "redundant flags; please run fsck."); 3166 "redundant flags; please run fsck.");
3175 3167
@@ -3182,8 +3174,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
3182 } 3174 }
3183 3175
3184 /* Load the checksum driver */ 3176 /* Load the checksum driver */
3185 if (EXT4_HAS_RO_COMPAT_FEATURE(sb, 3177 if (ext4_has_feature_metadata_csum(sb)) {
3186 EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) {
3187 sbi->s_chksum_driver = crypto_alloc_shash("crc32c", 0, 0); 3178 sbi->s_chksum_driver = crypto_alloc_shash("crc32c", 0, 0);
3188 if (IS_ERR(sbi->s_chksum_driver)) { 3179 if (IS_ERR(sbi->s_chksum_driver)) {
3189 ext4_msg(sb, KERN_ERR, "Cannot load crc32c driver."); 3180 ext4_msg(sb, KERN_ERR, "Cannot load crc32c driver.");
@@ -3203,7 +3194,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
3203 } 3194 }
3204 3195
3205 /* Precompute checksum seed for all metadata */ 3196 /* Precompute checksum seed for all metadata */
3206 if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_CSUM_SEED)) 3197 if (ext4_has_feature_csum_seed(sb))
3207 sbi->s_csum_seed = le32_to_cpu(es->s_checksum_seed); 3198 sbi->s_csum_seed = le32_to_cpu(es->s_checksum_seed);
3208 else if (ext4_has_metadata_csum(sb)) 3199 else if (ext4_has_metadata_csum(sb))
3209 sbi->s_csum_seed = ext4_chksum(sbi, ~0, es->s_uuid, 3200 sbi->s_csum_seed = ext4_chksum(sbi, ~0, es->s_uuid,
@@ -3308,17 +3299,16 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
3308 (test_opt(sb, POSIX_ACL) ? MS_POSIXACL : 0); 3299 (test_opt(sb, POSIX_ACL) ? MS_POSIXACL : 0);
3309 3300
3310 if (le32_to_cpu(es->s_rev_level) == EXT4_GOOD_OLD_REV && 3301 if (le32_to_cpu(es->s_rev_level) == EXT4_GOOD_OLD_REV &&
3311 (EXT4_HAS_COMPAT_FEATURE(sb, ~0U) || 3302 (ext4_has_compat_features(sb) ||
3312 EXT4_HAS_RO_COMPAT_FEATURE(sb, ~0U) || 3303 ext4_has_ro_compat_features(sb) ||
3313 EXT4_HAS_INCOMPAT_FEATURE(sb, ~0U))) 3304 ext4_has_incompat_features(sb)))
3314 ext4_msg(sb, KERN_WARNING, 3305 ext4_msg(sb, KERN_WARNING,
3315 "feature flags set on rev 0 fs, " 3306 "feature flags set on rev 0 fs, "
3316 "running e2fsck is recommended"); 3307 "running e2fsck is recommended");
3317 3308
3318 if (es->s_creator_os == cpu_to_le32(EXT4_OS_HURD)) { 3309 if (es->s_creator_os == cpu_to_le32(EXT4_OS_HURD)) {
3319 set_opt2(sb, HURD_COMPAT); 3310 set_opt2(sb, HURD_COMPAT);
3320 if (EXT4_HAS_INCOMPAT_FEATURE(sb, 3311 if (ext4_has_feature_64bit(sb)) {
3321 EXT4_FEATURE_INCOMPAT_64BIT)) {
3322 ext4_msg(sb, KERN_ERR, 3312 ext4_msg(sb, KERN_ERR,
3323 "The Hurd can't support 64-bit file systems"); 3313 "The Hurd can't support 64-bit file systems");
3324 goto failed_mount; 3314 goto failed_mount;
@@ -3376,8 +3366,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
3376 } 3366 }
3377 } 3367 }
3378 3368
3379 if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_ENCRYPT) && 3369 if (ext4_has_feature_encrypt(sb) && es->s_encryption_level) {
3380 es->s_encryption_level) {
3381 ext4_msg(sb, KERN_ERR, "Unsupported encryption level %d", 3370 ext4_msg(sb, KERN_ERR, "Unsupported encryption level %d",
3382 es->s_encryption_level); 3371 es->s_encryption_level);
3383 goto failed_mount; 3372 goto failed_mount;
@@ -3409,8 +3398,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
3409 } 3398 }
3410 } 3399 }
3411 3400
3412 has_huge_files = EXT4_HAS_RO_COMPAT_FEATURE(sb, 3401 has_huge_files = ext4_has_feature_huge_file(sb);
3413 EXT4_FEATURE_RO_COMPAT_HUGE_FILE);
3414 sbi->s_bitmap_maxbytes = ext4_max_bitmap_size(sb->s_blocksize_bits, 3402 sbi->s_bitmap_maxbytes = ext4_max_bitmap_size(sb->s_blocksize_bits,
3415 has_huge_files); 3403 has_huge_files);
3416 sb->s_maxbytes = ext4_max_size(sb->s_blocksize_bits, has_huge_files); 3404 sb->s_maxbytes = ext4_max_size(sb->s_blocksize_bits, has_huge_files);
@@ -3434,7 +3422,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
3434 } 3422 }
3435 3423
3436 sbi->s_desc_size = le16_to_cpu(es->s_desc_size); 3424 sbi->s_desc_size = le16_to_cpu(es->s_desc_size);
3437 if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_64BIT)) { 3425 if (ext4_has_feature_64bit(sb)) {
3438 if (sbi->s_desc_size < EXT4_MIN_DESC_SIZE_64BIT || 3426 if (sbi->s_desc_size < EXT4_MIN_DESC_SIZE_64BIT ||
3439 sbi->s_desc_size > EXT4_MAX_DESC_SIZE || 3427 sbi->s_desc_size > EXT4_MAX_DESC_SIZE ||
3440 !is_power_of_2(sbi->s_desc_size)) { 3428 !is_power_of_2(sbi->s_desc_size)) {
@@ -3465,7 +3453,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
3465 for (i = 0; i < 4; i++) 3453 for (i = 0; i < 4; i++)
3466 sbi->s_hash_seed[i] = le32_to_cpu(es->s_hash_seed[i]); 3454 sbi->s_hash_seed[i] = le32_to_cpu(es->s_hash_seed[i]);
3467 sbi->s_def_hash_version = es->s_def_hash_version; 3455 sbi->s_def_hash_version = es->s_def_hash_version;
3468 if (EXT4_HAS_COMPAT_FEATURE(sb, EXT4_FEATURE_COMPAT_DIR_INDEX)) { 3456 if (ext4_has_feature_dir_index(sb)) {
3469 i = le32_to_cpu(es->s_flags); 3457 i = le32_to_cpu(es->s_flags);
3470 if (i & EXT2_FLAGS_UNSIGNED_HASH) 3458 if (i & EXT2_FLAGS_UNSIGNED_HASH)
3471 sbi->s_hash_unsigned = 3; 3459 sbi->s_hash_unsigned = 3;
@@ -3485,8 +3473,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
3485 3473
3486 /* Handle clustersize */ 3474 /* Handle clustersize */
3487 clustersize = BLOCK_SIZE << le32_to_cpu(es->s_log_cluster_size); 3475 clustersize = BLOCK_SIZE << le32_to_cpu(es->s_log_cluster_size);
3488 has_bigalloc = EXT4_HAS_RO_COMPAT_FEATURE(sb, 3476 has_bigalloc = ext4_has_feature_bigalloc(sb);
3489 EXT4_FEATURE_RO_COMPAT_BIGALLOC);
3490 if (has_bigalloc) { 3477 if (has_bigalloc) {
3491 if (clustersize < blocksize) { 3478 if (clustersize < blocksize) {
3492 ext4_msg(sb, KERN_ERR, 3479 ext4_msg(sb, KERN_ERR,
@@ -3645,7 +3632,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
3645 sb->s_xattr = ext4_xattr_handlers; 3632 sb->s_xattr = ext4_xattr_handlers;
3646#ifdef CONFIG_QUOTA 3633#ifdef CONFIG_QUOTA
3647 sb->dq_op = &ext4_quota_operations; 3634 sb->dq_op = &ext4_quota_operations;
3648 if (EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_QUOTA)) 3635 if (ext4_has_feature_quota(sb))
3649 sb->s_qcop = &dquot_quotactl_sysfile_ops; 3636 sb->s_qcop = &dquot_quotactl_sysfile_ops;
3650 else 3637 else
3651 sb->s_qcop = &ext4_qctl_operations; 3638 sb->s_qcop = &ext4_qctl_operations;
@@ -3659,11 +3646,9 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
3659 sb->s_root = NULL; 3646 sb->s_root = NULL;
3660 3647
3661 needs_recovery = (es->s_last_orphan != 0 || 3648 needs_recovery = (es->s_last_orphan != 0 ||
3662 EXT4_HAS_INCOMPAT_FEATURE(sb, 3649 ext4_has_feature_journal_needs_recovery(sb));
3663 EXT4_FEATURE_INCOMPAT_RECOVER));
3664 3650
3665 if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_MMP) && 3651 if (ext4_has_feature_mmp(sb) && !(sb->s_flags & MS_RDONLY))
3666 !(sb->s_flags & MS_RDONLY))
3667 if (ext4_multi_mount_protect(sb, le64_to_cpu(es->s_mmp_block))) 3652 if (ext4_multi_mount_protect(sb, le64_to_cpu(es->s_mmp_block)))
3668 goto failed_mount3a; 3653 goto failed_mount3a;
3669 3654
@@ -3671,12 +3656,11 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
3671 * The first inode we look at is the journal inode. Don't try 3656 * The first inode we look at is the journal inode. Don't try
3672 * root first: it may be modified in the journal! 3657 * root first: it may be modified in the journal!
3673 */ 3658 */
3674 if (!test_opt(sb, NOLOAD) && 3659 if (!test_opt(sb, NOLOAD) && ext4_has_feature_journal(sb)) {
3675 EXT4_HAS_COMPAT_FEATURE(sb, EXT4_FEATURE_COMPAT_HAS_JOURNAL)) {
3676 if (ext4_load_journal(sb, es, journal_devnum)) 3660 if (ext4_load_journal(sb, es, journal_devnum))
3677 goto failed_mount3a; 3661 goto failed_mount3a;
3678 } else if (test_opt(sb, NOLOAD) && !(sb->s_flags & MS_RDONLY) && 3662 } else if (test_opt(sb, NOLOAD) && !(sb->s_flags & MS_RDONLY) &&
3679 EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER)) { 3663 ext4_has_feature_journal_needs_recovery(sb)) {
3680 ext4_msg(sb, KERN_ERR, "required journal recovery " 3664 ext4_msg(sb, KERN_ERR, "required journal recovery "
3681 "suppressed and not mounted read-only"); 3665 "suppressed and not mounted read-only");
3682 goto failed_mount_wq; 3666 goto failed_mount_wq;
@@ -3687,7 +3671,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
3687 goto no_journal; 3671 goto no_journal;
3688 } 3672 }
3689 3673
3690 if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_64BIT) && 3674 if (ext4_has_feature_64bit(sb) &&
3691 !jbd2_journal_set_features(EXT4_SB(sb)->s_journal, 0, 0, 3675 !jbd2_journal_set_features(EXT4_SB(sb)->s_journal, 0, 0,
3692 JBD2_FEATURE_INCOMPAT_64BIT)) { 3676 JBD2_FEATURE_INCOMPAT_64BIT)) {
3693 ext4_msg(sb, KERN_ERR, "Failed to set 64-bit journal feature"); 3677 ext4_msg(sb, KERN_ERR, "Failed to set 64-bit journal feature");
@@ -3739,18 +3723,16 @@ no_journal:
3739 } 3723 }
3740 } 3724 }
3741 3725
3742 if ((DUMMY_ENCRYPTION_ENABLED(sbi) || 3726 if ((DUMMY_ENCRYPTION_ENABLED(sbi) || ext4_has_feature_encrypt(sb)) &&
3743 EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_ENCRYPT)) &&
3744 (blocksize != PAGE_CACHE_SIZE)) { 3727 (blocksize != PAGE_CACHE_SIZE)) {
3745 ext4_msg(sb, KERN_ERR, 3728 ext4_msg(sb, KERN_ERR,
3746 "Unsupported blocksize for fs encryption"); 3729 "Unsupported blocksize for fs encryption");
3747 goto failed_mount_wq; 3730 goto failed_mount_wq;
3748 } 3731 }
3749 3732
3750 if (DUMMY_ENCRYPTION_ENABLED(sbi) && 3733 if (DUMMY_ENCRYPTION_ENABLED(sbi) && !(sb->s_flags & MS_RDONLY) &&
3751 !(sb->s_flags & MS_RDONLY) && 3734 !ext4_has_feature_encrypt(sb)) {
3752 !EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_ENCRYPT)) { 3735 ext4_set_feature_encrypt(sb);
3753 EXT4_SET_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_ENCRYPT);
3754 ext4_commit_super(sb, 1); 3736 ext4_commit_super(sb, 1);
3755 } 3737 }
3756 3738
@@ -3809,8 +3791,7 @@ no_journal:
3809 if (sbi->s_inode_size > EXT4_GOOD_OLD_INODE_SIZE) { 3791 if (sbi->s_inode_size > EXT4_GOOD_OLD_INODE_SIZE) {
3810 sbi->s_want_extra_isize = sizeof(struct ext4_inode) - 3792 sbi->s_want_extra_isize = sizeof(struct ext4_inode) -
3811 EXT4_GOOD_OLD_INODE_SIZE; 3793 EXT4_GOOD_OLD_INODE_SIZE;
3812 if (EXT4_HAS_RO_COMPAT_FEATURE(sb, 3794 if (ext4_has_feature_extra_isize(sb)) {
3813 EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE)) {
3814 if (sbi->s_want_extra_isize < 3795 if (sbi->s_want_extra_isize <
3815 le16_to_cpu(es->s_want_extra_isize)) 3796 le16_to_cpu(es->s_want_extra_isize))
3816 sbi->s_want_extra_isize = 3797 sbi->s_want_extra_isize =
@@ -3869,7 +3850,7 @@ no_journal:
3869 goto failed_mount6; 3850 goto failed_mount6;
3870 } 3851 }
3871 3852
3872 if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_FLEX_BG)) 3853 if (ext4_has_feature_flex_bg(sb))
3873 if (!ext4_fill_flex_info(sb)) { 3854 if (!ext4_fill_flex_info(sb)) {
3874 ext4_msg(sb, KERN_ERR, 3855 ext4_msg(sb, KERN_ERR,
3875 "unable to initialize " 3856 "unable to initialize "
@@ -3887,8 +3868,7 @@ no_journal:
3887 3868
3888#ifdef CONFIG_QUOTA 3869#ifdef CONFIG_QUOTA
3889 /* Enable quota usage during mount. */ 3870 /* Enable quota usage during mount. */
3890 if (EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_QUOTA) && 3871 if (ext4_has_feature_quota(sb) && !(sb->s_flags & MS_RDONLY)) {
3891 !(sb->s_flags & MS_RDONLY)) {
3892 err = ext4_enable_quotas(sb); 3872 err = ext4_enable_quotas(sb);
3893 if (err) 3873 if (err)
3894 goto failed_mount8; 3874 goto failed_mount8;
@@ -4029,7 +4009,7 @@ static journal_t *ext4_get_journal(struct super_block *sb,
4029 struct inode *journal_inode; 4009 struct inode *journal_inode;
4030 journal_t *journal; 4010 journal_t *journal;
4031 4011
4032 BUG_ON(!EXT4_HAS_COMPAT_FEATURE(sb, EXT4_FEATURE_COMPAT_HAS_JOURNAL)); 4012 BUG_ON(!ext4_has_feature_journal(sb));
4033 4013
4034 /* First, test for the existence of a valid inode on disk. Bad 4014 /* First, test for the existence of a valid inode on disk. Bad
4035 * things happen if we iget() an unused inode, as the subsequent 4015 * things happen if we iget() an unused inode, as the subsequent
@@ -4079,7 +4059,7 @@ static journal_t *ext4_get_dev_journal(struct super_block *sb,
4079 struct ext4_super_block *es; 4059 struct ext4_super_block *es;
4080 struct block_device *bdev; 4060 struct block_device *bdev;
4081 4061
4082 BUG_ON(!EXT4_HAS_COMPAT_FEATURE(sb, EXT4_FEATURE_COMPAT_HAS_JOURNAL)); 4062 BUG_ON(!ext4_has_feature_journal(sb));
4083 4063
4084 bdev = ext4_blkdev_get(j_dev, sb); 4064 bdev = ext4_blkdev_get(j_dev, sb);
4085 if (bdev == NULL) 4065 if (bdev == NULL)
@@ -4171,7 +4151,7 @@ static int ext4_load_journal(struct super_block *sb,
4171 int err = 0; 4151 int err = 0;
4172 int really_read_only; 4152 int really_read_only;
4173 4153
4174 BUG_ON(!EXT4_HAS_COMPAT_FEATURE(sb, EXT4_FEATURE_COMPAT_HAS_JOURNAL)); 4154 BUG_ON(!ext4_has_feature_journal(sb));
4175 4155
4176 if (journal_devnum && 4156 if (journal_devnum &&
4177 journal_devnum != le32_to_cpu(es->s_journal_dev)) { 4157 journal_devnum != le32_to_cpu(es->s_journal_dev)) {
@@ -4188,7 +4168,7 @@ static int ext4_load_journal(struct super_block *sb,
4188 * crash? For recovery, we need to check in advance whether we 4168 * crash? For recovery, we need to check in advance whether we
4189 * can get read-write access to the device. 4169 * can get read-write access to the device.
4190 */ 4170 */
4191 if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER)) { 4171 if (ext4_has_feature_journal_needs_recovery(sb)) {
4192 if (sb->s_flags & MS_RDONLY) { 4172 if (sb->s_flags & MS_RDONLY) {
4193 ext4_msg(sb, KERN_INFO, "INFO: recovery " 4173 ext4_msg(sb, KERN_INFO, "INFO: recovery "
4194 "required on readonly filesystem"); 4174 "required on readonly filesystem");
@@ -4219,7 +4199,7 @@ static int ext4_load_journal(struct super_block *sb,
4219 if (!(journal->j_flags & JBD2_BARRIER)) 4199 if (!(journal->j_flags & JBD2_BARRIER))
4220 ext4_msg(sb, KERN_INFO, "barriers disabled"); 4200 ext4_msg(sb, KERN_INFO, "barriers disabled");
4221 4201
4222 if (!EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER)) 4202 if (!ext4_has_feature_journal_needs_recovery(sb))
4223 err = jbd2_journal_wipe(journal, !really_read_only); 4203 err = jbd2_journal_wipe(journal, !really_read_only);
4224 if (!err) { 4204 if (!err) {
4225 char *save = kmalloc(EXT4_S_ERR_LEN, GFP_KERNEL); 4205 char *save = kmalloc(EXT4_S_ERR_LEN, GFP_KERNEL);
@@ -4333,7 +4313,7 @@ static void ext4_mark_recovery_complete(struct super_block *sb,
4333{ 4313{
4334 journal_t *journal = EXT4_SB(sb)->s_journal; 4314 journal_t *journal = EXT4_SB(sb)->s_journal;
4335 4315
4336 if (!EXT4_HAS_COMPAT_FEATURE(sb, EXT4_FEATURE_COMPAT_HAS_JOURNAL)) { 4316 if (!ext4_has_feature_journal(sb)) {
4337 BUG_ON(journal != NULL); 4317 BUG_ON(journal != NULL);
4338 return; 4318 return;
4339 } 4319 }
@@ -4341,9 +4321,9 @@ static void ext4_mark_recovery_complete(struct super_block *sb,
4341 if (jbd2_journal_flush(journal) < 0) 4321 if (jbd2_journal_flush(journal) < 0)
4342 goto out; 4322 goto out;
4343 4323
4344 if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER) && 4324 if (ext4_has_feature_journal_needs_recovery(sb) &&
4345 sb->s_flags & MS_RDONLY) { 4325 sb->s_flags & MS_RDONLY) {
4346 EXT4_CLEAR_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER); 4326 ext4_clear_feature_journal_needs_recovery(sb);
4347 ext4_commit_super(sb, 1); 4327 ext4_commit_super(sb, 1);
4348 } 4328 }
4349 4329
@@ -4363,7 +4343,7 @@ static void ext4_clear_journal_err(struct super_block *sb,
4363 int j_errno; 4343 int j_errno;
4364 const char *errstr; 4344 const char *errstr;
4365 4345
4366 BUG_ON(!EXT4_HAS_COMPAT_FEATURE(sb, EXT4_FEATURE_COMPAT_HAS_JOURNAL)); 4346 BUG_ON(!ext4_has_feature_journal(sb));
4367 4347
4368 journal = EXT4_SB(sb)->s_journal; 4348 journal = EXT4_SB(sb)->s_journal;
4369 4349
@@ -4478,7 +4458,7 @@ static int ext4_freeze(struct super_block *sb)
4478 goto out; 4458 goto out;
4479 4459
4480 /* Journal blocked and flushed, clear needs_recovery flag. */ 4460 /* Journal blocked and flushed, clear needs_recovery flag. */
4481 EXT4_CLEAR_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER); 4461 ext4_clear_feature_journal_needs_recovery(sb);
4482 } 4462 }
4483 4463
4484 error = ext4_commit_super(sb, 1); 4464 error = ext4_commit_super(sb, 1);
@@ -4500,7 +4480,7 @@ static int ext4_unfreeze(struct super_block *sb)
4500 4480
4501 if (EXT4_SB(sb)->s_journal) { 4481 if (EXT4_SB(sb)->s_journal) {
4502 /* Reset the needs_recovery flag before the fs is unlocked. */ 4482 /* Reset the needs_recovery flag before the fs is unlocked. */
4503 EXT4_SET_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER); 4483 ext4_set_feature_journal_needs_recovery(sb);
4504 } 4484 }
4505 4485
4506 ext4_commit_super(sb, 1); 4486 ext4_commit_super(sb, 1);
@@ -4653,8 +4633,7 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
4653 ext4_mark_recovery_complete(sb, es); 4633 ext4_mark_recovery_complete(sb, es);
4654 } else { 4634 } else {
4655 /* Make sure we can mount this feature set readwrite */ 4635 /* Make sure we can mount this feature set readwrite */
4656 if (EXT4_HAS_RO_COMPAT_FEATURE(sb, 4636 if (ext4_has_feature_readonly(sb) ||
4657 EXT4_FEATURE_RO_COMPAT_READONLY) ||
4658 !ext4_feature_set_ok(sb, 0)) { 4637 !ext4_feature_set_ok(sb, 0)) {
4659 err = -EROFS; 4638 err = -EROFS;
4660 goto restore_opts; 4639 goto restore_opts;
@@ -4670,7 +4649,7 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
4670 if (!ext4_group_desc_csum_verify(sb, g, gdp)) { 4649 if (!ext4_group_desc_csum_verify(sb, g, gdp)) {
4671 ext4_msg(sb, KERN_ERR, 4650 ext4_msg(sb, KERN_ERR,
4672 "ext4_remount: Checksum for group %u failed (%u!=%u)", 4651 "ext4_remount: Checksum for group %u failed (%u!=%u)",
4673 g, le16_to_cpu(ext4_group_desc_csum(sbi, g, gdp)), 4652 g, le16_to_cpu(ext4_group_desc_csum(sb, g, gdp)),
4674 le16_to_cpu(gdp->bg_checksum)); 4653 le16_to_cpu(gdp->bg_checksum));
4675 err = -EFSBADCRC; 4654 err = -EFSBADCRC;
4676 goto restore_opts; 4655 goto restore_opts;
@@ -4702,8 +4681,7 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
4702 sbi->s_mount_state = le16_to_cpu(es->s_state); 4681 sbi->s_mount_state = le16_to_cpu(es->s_state);
4703 if (!ext4_setup_super(sb, es, 0)) 4682 if (!ext4_setup_super(sb, es, 0))
4704 sb->s_flags &= ~MS_RDONLY; 4683 sb->s_flags &= ~MS_RDONLY;
4705 if (EXT4_HAS_INCOMPAT_FEATURE(sb, 4684 if (ext4_has_feature_mmp(sb))
4706 EXT4_FEATURE_INCOMPAT_MMP))
4707 if (ext4_multi_mount_protect(sb, 4685 if (ext4_multi_mount_protect(sb,
4708 le64_to_cpu(es->s_mmp_block))) { 4686 le64_to_cpu(es->s_mmp_block))) {
4709 err = -EROFS; 4687 err = -EROFS;
@@ -4736,8 +4714,7 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
4736 if (enable_quota) { 4714 if (enable_quota) {
4737 if (sb_any_quota_suspended(sb)) 4715 if (sb_any_quota_suspended(sb))
4738 dquot_resume(sb, -1); 4716 dquot_resume(sb, -1);
4739 else if (EXT4_HAS_RO_COMPAT_FEATURE(sb, 4717 else if (ext4_has_feature_quota(sb)) {
4740 EXT4_FEATURE_RO_COMPAT_QUOTA)) {
4741 err = ext4_enable_quotas(sb); 4718 err = ext4_enable_quotas(sb);
4742 if (err) 4719 if (err)
4743 goto restore_opts; 4720 goto restore_opts;
@@ -4881,7 +4858,7 @@ static int ext4_mark_dquot_dirty(struct dquot *dquot)
4881 struct ext4_sb_info *sbi = EXT4_SB(sb); 4858 struct ext4_sb_info *sbi = EXT4_SB(sb);
4882 4859
4883 /* Are we journaling quotas? */ 4860 /* Are we journaling quotas? */
4884 if (EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_QUOTA) || 4861 if (ext4_has_feature_quota(sb) ||
4885 sbi->s_qf_names[USRQUOTA] || sbi->s_qf_names[GRPQUOTA]) { 4862 sbi->s_qf_names[USRQUOTA] || sbi->s_qf_names[GRPQUOTA]) {
4886 dquot_mark_dquot_dirty(dquot); 4863 dquot_mark_dquot_dirty(dquot);
4887 return ext4_write_dquot(dquot); 4864 return ext4_write_dquot(dquot);
@@ -4969,7 +4946,7 @@ static int ext4_quota_enable(struct super_block *sb, int type, int format_id,
4969 le32_to_cpu(EXT4_SB(sb)->s_es->s_grp_quota_inum) 4946 le32_to_cpu(EXT4_SB(sb)->s_es->s_grp_quota_inum)
4970 }; 4947 };
4971 4948
4972 BUG_ON(!EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_QUOTA)); 4949 BUG_ON(!ext4_has_feature_quota(sb));
4973 4950
4974 if (!qf_inums[type]) 4951 if (!qf_inums[type])
4975 return -EPERM; 4952 return -EPERM;
@@ -5163,11 +5140,11 @@ static inline void unregister_as_ext2(void)
5163 5140
5164static inline int ext2_feature_set_ok(struct super_block *sb) 5141static inline int ext2_feature_set_ok(struct super_block *sb)
5165{ 5142{
5166 if (EXT4_HAS_INCOMPAT_FEATURE(sb, ~EXT2_FEATURE_INCOMPAT_SUPP)) 5143 if (ext4_has_unknown_ext2_incompat_features(sb))
5167 return 0; 5144 return 0;
5168 if (sb->s_flags & MS_RDONLY) 5145 if (sb->s_flags & MS_RDONLY)
5169 return 1; 5146 return 1;
5170 if (EXT4_HAS_RO_COMPAT_FEATURE(sb, ~EXT2_FEATURE_RO_COMPAT_SUPP)) 5147 if (ext4_has_unknown_ext2_ro_compat_features(sb))
5171 return 0; 5148 return 0;
5172 return 1; 5149 return 1;
5173} 5150}
@@ -5192,13 +5169,13 @@ static inline void unregister_as_ext3(void)
5192 5169
5193static inline int ext3_feature_set_ok(struct super_block *sb) 5170static inline int ext3_feature_set_ok(struct super_block *sb)
5194{ 5171{
5195 if (EXT4_HAS_INCOMPAT_FEATURE(sb, ~EXT3_FEATURE_INCOMPAT_SUPP)) 5172 if (ext4_has_unknown_ext3_incompat_features(sb))
5196 return 0; 5173 return 0;
5197 if (!EXT4_HAS_COMPAT_FEATURE(sb, EXT4_FEATURE_COMPAT_HAS_JOURNAL)) 5174 if (!ext4_has_feature_journal(sb))
5198 return 0; 5175 return 0;
5199 if (sb->s_flags & MS_RDONLY) 5176 if (sb->s_flags & MS_RDONLY)
5200 return 1; 5177 return 1;
5201 if (EXT4_HAS_RO_COMPAT_FEATURE(sb, ~EXT3_FEATURE_RO_COMPAT_SUPP)) 5178 if (ext4_has_unknown_ext3_ro_compat_features(sb))
5202 return 0; 5179 return 0;
5203 return 1; 5180 return 1;
5204} 5181}