Commit e4079a11f5ed966b7d972cc69e8d337a0f095e32
Committed by
Theodore Ts'o
1 parent
c07651b556
Exists in
master
and in
7 other branches
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: Eric Sandeen <sandeen@redhat.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Showing 2 changed files with 18 additions and 9 deletions Side-by-side Diff
fs/ext4/ialloc.c
... | ... | @@ -836,14 +836,10 @@ |
836 | 836 | goto fail_free_drop; |
837 | 837 | |
838 | 838 | if (test_opt(sb, EXTENTS)) { |
839 | - /* set extent flag only for diretory, file and normal symlink*/ | |
839 | + /* set extent flag only for directory, file and normal symlink*/ | |
840 | 840 | if (S_ISDIR(mode) || S_ISREG(mode) || S_ISLNK(mode)) { |
841 | 841 | EXT4_I(inode)->i_flags |= EXT4_EXTENTS_FL; |
842 | 842 | ext4_ext_tree_init(handle, inode); |
843 | - err = ext4_update_incompat_feature(handle, sb, | |
844 | - EXT4_FEATURE_INCOMPAT_EXTENTS); | |
845 | - if (err) | |
846 | - goto fail_free_drop; | |
847 | 843 | } |
848 | 844 | } |
849 | 845 |
fs/ext4/super.c
... | ... | @@ -1324,6 +1324,13 @@ |
1324 | 1324 | clear_opt(sbi->s_mount_opt, NOBH); |
1325 | 1325 | break; |
1326 | 1326 | case Opt_extents: |
1327 | + if (!EXT4_HAS_INCOMPAT_FEATURE(sb, | |
1328 | + EXT4_FEATURE_INCOMPAT_EXTENTS)) { | |
1329 | + ext4_warning(sb, __func__, | |
1330 | + "extents feature not enabled " | |
1331 | + "on this filesystem, use tune2fs\n"); | |
1332 | + return 0; | |
1333 | + } | |
1327 | 1334 | set_opt (sbi->s_mount_opt, EXTENTS); |
1328 | 1335 | break; |
1329 | 1336 | case Opt_noextents: |
1330 | 1337 | |
1331 | 1338 | |
... | ... | @@ -1997,12 +2004,18 @@ |
1997 | 2004 | |
1998 | 2005 | /* |
1999 | 2006 | * turn on extents feature by default in ext4 filesystem |
2000 | - * User -o noextents to turn it off | |
2007 | + * only if feature flag already set by mkfs or tune2fs. | |
2008 | + * Use -o noextents to turn it off | |
2001 | 2009 | */ |
2002 | - set_opt(sbi->s_mount_opt, EXTENTS); | |
2010 | + if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS)) | |
2011 | + set_opt(sbi->s_mount_opt, EXTENTS); | |
2012 | + else | |
2013 | + ext4_warning(sb, __func__, | |
2014 | + "extents feature not enabled on this filesystem, " | |
2015 | + "use tune2fs.\n"); | |
2003 | 2016 | /* |
2004 | - * turn on mballoc feature by default in ext4 filesystem | |
2005 | - * User -o nomballoc to turn it off | |
2017 | + * turn on mballoc code by default in ext4 filesystem | |
2018 | + * Use -o nomballoc to turn it off | |
2006 | 2019 | */ |
2007 | 2020 | set_opt(sbi->s_mount_opt, MBALLOC); |
2008 | 2021 |