提交 e4079a11 编写于 作者: E Eric Sandeen 提交者: Theodore Ts'o

ext4: do not set extents feature from the kernel

We've talked for a while about getting rid of any feature-
setting from the kernel; this gets rid of the code which would
set the INCOMPAT_EXTENTS flag on the first file write when mounted
as ext4[dev].

With this patch, if the extents feature is not already set on disk,
then mounting as ext4 will fall back to noextents with a warning,
and if -o extents is explicitly requested, the mount will fail,
also with warning.
Signed-off-by: NEric Sandeen <sandeen@redhat.com>
Signed-off-by: N"Theodore Ts'o" <tytso@mit.edu>
上级 c07651b5
...@@ -836,14 +836,10 @@ struct inode *ext4_new_inode(handle_t *handle, struct inode * dir, int mode) ...@@ -836,14 +836,10 @@ struct inode *ext4_new_inode(handle_t *handle, struct inode * dir, int mode)
goto fail_free_drop; goto fail_free_drop;
if (test_opt(sb, EXTENTS)) { if (test_opt(sb, EXTENTS)) {
/* set extent flag only for diretory, file and normal symlink*/ /* set extent flag only for directory, file and normal symlink*/
if (S_ISDIR(mode) || S_ISREG(mode) || S_ISLNK(mode)) { if (S_ISDIR(mode) || S_ISREG(mode) || S_ISLNK(mode)) {
EXT4_I(inode)->i_flags |= EXT4_EXTENTS_FL; EXT4_I(inode)->i_flags |= EXT4_EXTENTS_FL;
ext4_ext_tree_init(handle, inode); ext4_ext_tree_init(handle, inode);
err = ext4_update_incompat_feature(handle, sb,
EXT4_FEATURE_INCOMPAT_EXTENTS);
if (err)
goto fail_free_drop;
} }
} }
......
...@@ -1324,6 +1324,13 @@ static int parse_options (char *options, struct super_block *sb, ...@@ -1324,6 +1324,13 @@ static int parse_options (char *options, struct super_block *sb,
clear_opt(sbi->s_mount_opt, NOBH); clear_opt(sbi->s_mount_opt, NOBH);
break; break;
case Opt_extents: case Opt_extents:
if (!EXT4_HAS_INCOMPAT_FEATURE(sb,
EXT4_FEATURE_INCOMPAT_EXTENTS)) {
ext4_warning(sb, __func__,
"extents feature not enabled "
"on this filesystem, use tune2fs\n");
return 0;
}
set_opt (sbi->s_mount_opt, EXTENTS); set_opt (sbi->s_mount_opt, EXTENTS);
break; break;
case Opt_noextents: case Opt_noextents:
...@@ -1997,12 +2004,18 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent) ...@@ -1997,12 +2004,18 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent)
/* /*
* turn on extents feature by default in ext4 filesystem * turn on extents feature by default in ext4 filesystem
* User -o noextents to turn it off * only if feature flag already set by mkfs or tune2fs.
* Use -o noextents to turn it off
*/ */
if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS))
set_opt(sbi->s_mount_opt, EXTENTS); set_opt(sbi->s_mount_opt, EXTENTS);
else
ext4_warning(sb, __func__,
"extents feature not enabled on this filesystem, "
"use tune2fs.\n");
/* /*
* turn on mballoc feature by default in ext4 filesystem * turn on mballoc code by default in ext4 filesystem
* User -o nomballoc to turn it off * Use -o nomballoc to turn it off
*/ */
set_opt(sbi->s_mount_opt, MBALLOC); set_opt(sbi->s_mount_opt, MBALLOC);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册