Commit 83982b6f47201c4c7767210d24d7d8c99567a0b3

Authored by Theodore Ts'o
1 parent 4d783b093c

ext4: Remove "extents" mount option

This mount option is largely superfluous, and in fact the way it was
implemented was buggy; if a filesystem which did not have the extents
feature flag was mounted -o extents, the filesystem would attempt to
create and use extents-based file even though the extents feature flag
was not eabled.  The simplest thing to do is to nuke the mount option
entirely.  It's not all that useful to force the non-creation of new
extent-based files if the filesystem can support it.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>

Showing 7 changed files with 14 additions and 64 deletions Side-by-side Diff

Documentation/filesystems/ext4.txt
... ... @@ -131,11 +131,6 @@
131 131 mount options "ro,noload" can be used to prevent
132 132 writes to the filesystem.
133 133  
134   -extents (*) ext4 will use extents to address file data. The
135   - file system will no longer be mountable by ext3.
136   -
137   -noextents ext4 will not use extents for newly created files
138   -
139 134 journal_checksum Enable checksumming of the journal transactions.
140 135 This will allow the recovery code in e2fsck and the
141 136 kernel to detect corruption in the kernel. It is a
... ... @@ -536,7 +536,6 @@
536 536 #define EXT4_MOUNT_QUOTA 0x80000 /* Some quota option set */
537 537 #define EXT4_MOUNT_USRQUOTA 0x100000 /* "old" user quota */
538 538 #define EXT4_MOUNT_GRPQUOTA 0x200000 /* "old" group quota */
539   -#define EXT4_MOUNT_EXTENTS 0x400000 /* Extents support */
540 539 #define EXT4_MOUNT_JOURNAL_CHECKSUM 0x800000 /* Journal checksums */
541 540 #define EXT4_MOUNT_JOURNAL_ASYNC_COMMIT 0x1000000 /* Journal Async Commit */
542 541 #define EXT4_MOUNT_I_VERSION 0x2000000 /* i_version support */
... ... @@ -32,8 +32,8 @@
32 32 * 5 levels of tree + root which are stored in the inode. */
33 33  
34 34 #define EXT4_SINGLEDATA_TRANS_BLOCKS(sb) \
35   - (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS) \
36   - || test_opt(sb, EXTENTS) ? 27U : 8U)
  35 + (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS) \
  36 + ? 27U : 8U)
37 37  
38 38 /* Extended attribute operations touch at most two data buffers,
39 39 * two bitmap buffers, and two group summaries, in addition to the inode
... ... @@ -2247,7 +2247,7 @@
2247 2247 * possible initialization would be here
2248 2248 */
2249 2249  
2250   - if (test_opt(sb, EXTENTS)) {
  2250 + if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS)) {
2251 2251 printk(KERN_INFO "EXT4-fs: file extents enabled");
2252 2252 #ifdef AGGRESSIVE_TEST
2253 2253 printk(", aggressive tests");
... ... @@ -2272,7 +2272,7 @@
2272 2272 */
2273 2273 void ext4_ext_release(struct super_block *sb)
2274 2274 {
2275   - if (!test_opt(sb, EXTENTS))
  2275 + if (!EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS))
2276 2276 return;
2277 2277  
2278 2278 #ifdef EXTENTS_STATS
... ... @@ -917,7 +917,7 @@
917 917 if (err)
918 918 goto fail_free_drop;
919 919  
920   - if (test_opt(sb, EXTENTS)) {
  920 + if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS)) {
921 921 /* set extent flag only for directory, file and normal symlink*/
922 922 if (S_ISDIR(mode) || S_ISREG(mode) || S_ISLNK(mode)) {
923 923 EXT4_I(inode)->i_flags |= EXT4_EXTENTS_FL;
... ... @@ -459,13 +459,13 @@
459 459 struct list_blocks_struct lb;
460 460 unsigned long max_entries;
461 461  
462   - if (!test_opt(inode->i_sb, EXTENTS))
463   - /*
464   - * if mounted with noextents we don't allow the migrate
465   - */
466   - return -EINVAL;
467   -
468   - if ((EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL))
  462 + /*
  463 + * If the filesystem does not support extents, or the inode
  464 + * already is extent-based, error out.
  465 + */
  466 + if (!EXT4_HAS_INCOMPAT_FEATURE(inode->i_sb,
  467 + EXT4_FEATURE_INCOMPAT_EXTENTS) ||
  468 + (EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL))
469 469 return -EINVAL;
470 470  
471 471 if (S_ISLNK(inode->i_mode) && inode->i_blocks == 0)
... ... @@ -829,8 +829,6 @@
829 829 seq_puts(seq, ",journal_async_commit");
830 830 if (test_opt(sb, NOBH))
831 831 seq_puts(seq, ",nobh");
832   - if (!test_opt(sb, EXTENTS))
833   - seq_puts(seq, ",noextents");
834 832 if (test_opt(sb, I_VERSION))
835 833 seq_puts(seq, ",i_version");
836 834 if (!test_opt(sb, DELALLOC))
... ... @@ -1011,7 +1009,7 @@
1011 1009 Opt_usrjquota, Opt_grpjquota, Opt_offusrjquota, Opt_offgrpjquota,
1012 1010 Opt_jqfmt_vfsold, Opt_jqfmt_vfsv0, Opt_quota, Opt_noquota,
1013 1011 Opt_ignore, Opt_barrier, Opt_err, Opt_resize, Opt_usrquota,
1014   - Opt_grpquota, Opt_extents, Opt_noextents, Opt_i_version,
  1012 + Opt_grpquota, Opt_i_version,
1015 1013 Opt_stripe, Opt_delalloc, Opt_nodelalloc,
1016 1014 Opt_inode_readahead_blks, Opt_journal_ioprio
1017 1015 };
... ... @@ -1066,8 +1064,6 @@
1066 1064 {Opt_quota, "quota"},
1067 1065 {Opt_usrquota, "usrquota"},
1068 1066 {Opt_barrier, "barrier=%u"},
1069   - {Opt_extents, "extents"},
1070   - {Opt_noextents, "noextents"},
1071 1067 {Opt_i_version, "i_version"},
1072 1068 {Opt_stripe, "stripe=%u"},
1073 1069 {Opt_resize, "resize"},
... ... @@ -1115,7 +1111,6 @@
1115 1111 int qtype, qfmt;
1116 1112 char *qname;
1117 1113 #endif
1118   - ext4_fsblk_t last_block;
1119 1114  
1120 1115 if (!options)
1121 1116 return 1;
... ... @@ -1445,33 +1440,6 @@
1445 1440 case Opt_bh:
1446 1441 clear_opt(sbi->s_mount_opt, NOBH);
1447 1442 break;
1448   - case Opt_extents:
1449   - if (!EXT4_HAS_INCOMPAT_FEATURE(sb,
1450   - EXT4_FEATURE_INCOMPAT_EXTENTS)) {
1451   - ext4_warning(sb, __func__,
1452   - "extents feature not enabled "
1453   - "on this filesystem, use tune2fs");
1454   - return 0;
1455   - }
1456   - set_opt(sbi->s_mount_opt, EXTENTS);
1457   - break;
1458   - case Opt_noextents:
1459   - /*
1460   - * When e2fsprogs support resizing an already existing
1461   - * ext3 file system to greater than 2**32 we need to
1462   - * add support to block allocator to handle growing
1463   - * already existing block mapped inode so that blocks
1464   - * allocated for them fall within 2**32
1465   - */
1466   - last_block = ext4_blocks_count(sbi->s_es) - 1;
1467   - if (last_block > 0xffffffffULL) {
1468   - printk(KERN_ERR "EXT4-fs: Filesystem too "
1469   - "large to mount with "
1470   - "-o noextents options\n");
1471   - return 0;
1472   - }
1473   - clear_opt(sbi->s_mount_opt, EXTENTS);
1474   - break;
1475 1443 case Opt_i_version:
1476 1444 set_opt(sbi->s_mount_opt, I_VERSION);
1477 1445 sb->s_flags |= MS_I_VERSION;
... ... @@ -2136,18 +2104,6 @@
2136 2104 set_opt(sbi->s_mount_opt, BARRIER);
2137 2105  
2138 2106 /*
2139   - * turn on extents feature by default in ext4 filesystem
2140   - * only if feature flag already set by mkfs or tune2fs.
2141   - * Use -o noextents to turn it off
2142   - */
2143   - if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS))
2144   - set_opt(sbi->s_mount_opt, EXTENTS);
2145   - else
2146   - ext4_warning(sb, __func__,
2147   - "extents feature not enabled on this filesystem, "
2148   - "use tune2fs.");
2149   -
2150   - /*
2151 2107 * enable delayed allocation by default
2152 2108 * Use -o nodelalloc to turn it off
2153 2109 */
... ... @@ -3825,7 +3781,7 @@
3825 3781 }
3826 3782  
3827 3783 MODULE_AUTHOR("Remy Card, Stephen Tweedie, Andrew Morton, Andreas Dilger, Theodore Ts'o and others");
3828   -MODULE_DESCRIPTION("Fourth Extended Filesystem with extents");
  3784 +MODULE_DESCRIPTION("Fourth Extended Filesystem");
3829 3785 MODULE_LICENSE("GPL");
3830 3786 module_init(init_ext4_fs)
3831 3787 module_exit(exit_ext4_fs)