Skip to contentSkip to conversation

ext4: Remove "extents" mount option

PATCH In review Theodore Ts'o 3 participants 5 messages Jan 6, 2009 – Jan 7, 2009

Subsystems (2)
lore
Share & tools
lore

Theodore Ts'o

author maintainer
#0 lore raw

PATCH 1/1 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.

---
 Documentation/filesystems/ext4.txt |    5 ---
 fs/ext4/ext4.h                     |    1 -
 fs/ext4/ext4_jbd2.h                |    4 +-
 fs/ext4/extents.c                  |    4 +-
 fs/ext4/ialloc.c                   |    2 +-
 fs/ext4/migrate.c                  |   14 +++++-----
 fs/ext4/super.c                    |   48 +----------------------------------
 7 files changed, 14 insertions(+), 64 deletions(-)
Documentation/filesystems/ext4.txt +0 -5
index 8938949..cec829b 100644
@@ -131,11 +131,6 @@ ro                   	Mount filesystem read only. Note that ext4 will
                      	mount options "ro,noload" can be used to prevent
 		     	writes to the filesystem.
 
-extents		(*)	ext4 will use extents to address file data.  The
-			file system will no longer be mountable by ext3.
-
-noextents		ext4 will not use extents for newly created files
-
 journal_checksum	Enable checksumming of the journal transactions.
 			This will allow the recovery code in e2fsck and the
 			kernel to detect corruption in the kernel.  It is a
fs/ext4/ext4.h +0 -1
index 695b45c..db17188 100644
@@ -536,7 +536,6 @@ do {									       \
 #define EXT4_MOUNT_QUOTA		0x80000 /* Some quota option set */
 #define EXT4_MOUNT_USRQUOTA		0x100000 /* "old" user quota */
 #define EXT4_MOUNT_GRPQUOTA		0x200000 /* "old" group quota */
-#define EXT4_MOUNT_EXTENTS		0x400000 /* Extents support */
 #define EXT4_MOUNT_JOURNAL_CHECKSUM	0x800000 /* Journal checksums */
 #define EXT4_MOUNT_JOURNAL_ASYNC_COMMIT	0x1000000 /* Journal Async Commit */
 #define EXT4_MOUNT_I_VERSION            0x2000000 /* i_version support */
fs/ext4/ext4_jbd2.h +2 -2
index 663197a..be2f426 100644
@@ -32,8 +32,8 @@
  * 5 levels of tree + root which are stored in the inode. */
 
 #define EXT4_SINGLEDATA_TRANS_BLOCKS(sb)				\
-	(EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS)	\
-		|| test_opt(sb, EXTENTS) ? 27U : 8U)
+	(EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS)   \
+	 ? 27U : 8U)
 
 /* Extended attribute operations touch at most two data buffers,
  * two bitmap buffers, and two group summaries, in addition to the inode
fs/ext4/extents.c +2 -2
index c64080e..240cf0d 100644
@@ -2247,7 +2247,7 @@ void ext4_ext_init(struct super_block *sb)
 	 * possible initialization would be here
 	 */
 
-	if (test_opt(sb, EXTENTS)) {
+	if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS)) {
 		printk(KERN_INFO "EXT4-fs: file extents enabled");
 #ifdef AGGRESSIVE_TEST
 		printk(", aggressive tests");
@@ -2272,7 +2272,7 @@ void ext4_ext_init(struct super_block *sb)
  */
 void ext4_ext_release(struct super_block *sb)
 {
-	if (!test_opt(sb, EXTENTS))
+	if (!EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS))
 		return;
 
 #ifdef EXTENTS_STATS
fs/ext4/ialloc.c +1 -1
index 17483ad..4ed2c04 100644
@@ -914,7 +914,7 @@ got:
 	if (err)
 		goto fail_free_drop;
 
-	if (test_opt(sb, EXTENTS)) {
+	if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS)) {
 		/* set extent flag only for directory, file and normal symlink*/
 		if (S_ISDIR(mode) || S_ISREG(mode) || S_ISLNK(mode)) {
 			EXT4_I(inode)->i_flags |= EXT4_EXTENTS_FL;
fs/ext4/migrate.c +7 -7
index e7cd488..734abca 100644
@@ -459,13 +459,13 @@ int ext4_ext_migrate(struct inode *inode)
 	struct list_blocks_struct lb;
 	unsigned long max_entries;
 
-	if (!test_opt(inode->i_sb, EXTENTS))
-		/*
-		 * if mounted with noextents we don't allow the migrate
-		 */
-		return -EINVAL;
-
-	if ((EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL))
+	/*
+	 * If the filesystem does not support extents, or the inode
+	 * already is extent-based, error out.
+	 */
+	if (!EXT4_HAS_INCOMPAT_FEATURE(inode->i_sb,
+				       EXT4_FEATURE_INCOMPAT_EXTENTS) ||
+	    (EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL))
 		return -EINVAL;
 
 	if (S_ISLNK(inode->i_mode) && inode->i_blocks == 0)
fs/ext4/super.c +1 -43

77 lines not on this page · raw message

#1 lore raw
Quoted 8 lines · Theodore Ts'o

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.

Ext4 -> Ext3 migration story is to mount the filesystem with -o noextents and copy the file around. If we remove the -o noextents options how do we force the creation of non extent format files ?

-aneesh

author maintainer
#2 lore raw
Quoted 10 lines · Aneesh Kumar K.V
Quoted 8 lines · Theodore Ts'o

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.

Quoted 3 lines

Ext4 -> Ext3 migration story is to mount the filesystem with -o noextents and copy the file around. If we remove the -o noextents options how do we force the creation of non extent format files ?

1) How much do we care about ext4->ext3 migration?

2) That only deals with extent-based files; it doesn't deal with any of the other ext4-specific features.

What's the scenario you're thinking about here? When would it be useful for users to be able to downgrade extent-based files to indirect block files by copying files around?

- Ted

#3 lore raw
Quoted 5 lines · Theodore Tso

What's the scenario you're thinking about here? When would it be useful for users to be able to downgrade extent-based files to indirect block files by copying files around?

- Ted

We have said in the past that this is a path back out of ext4 if you regret your decision to migrate.

And if you have simply tune2fs -O extent'd your old ext3 fs, then the above *is* a (cumbersome) way back out in most cases I think...

-Eric

#4 lore raw
In reply to Theodore Tso
Quoted 15 lines · Theodore Tso
Quoted 10 lines · Aneesh Kumar K.V
Quoted 8 lines · Theodore Ts'o

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.

Quoted 3 lines

Ext4 -> Ext3 migration story is to mount the filesystem with -o noextents and copy the file around. If we remove the -o noextents options how do we force the creation of non extent format files ?

Quoted 9 lines

1) How much do we care about ext4->ext3 migration?

2) That only deals with extent-based files; it doesn't deal with any of the other ext4-specific features.

What's the scenario you're thinking about here? When would it be useful for users to be able to downgrade extent-based files to indirect block files by copying files around?

The user migrate from ext3 to ext4 and later wants to move back. So with ext3 to ext4 migration he use tune2fs to enable the extent feature. Now later he wants to move back to ext3. The only way is mount the filesystem with -o noextents and copy the new files created in extent format back. Then mount it using ext3.

-aneesh