According to tune2fs(8), the uninit_bg and flex_bg features are only supported by ext4, so libparted should treat their presence as indicating ext4. Reported by C de-Avillez in https://bugs.launchpad.net/ubuntu/+source/parted/+bug/561599.
* libparted/fs/ext2/ext2_fs.h: Define EXT4_FEATURE_RO_COMPAT_GDT_CSUM and EXT4_FEATURE_INCOMPAT_FLEX_BG. * libparted/fs/ext2/interface.c (_ext2_generic_probe): Test for EXT4_FEATURE_RO_COMPAT_GDT_CSUM and EXT4_FEATURE_INCOMPAT_FLEX_BG when probing for ext4. * tests/t1700-ext-probe.sh: Test for this. --- libparted/fs/ext2/ext2_fs.h | 2 ++ libparted/fs/ext2/interface.c | 6 +++++- tests/t1700-ext-probe.sh | 14 ++++++++++++++ 3 files changed, 21 insertions(+), 1 deletions(-) diff --git a/libparted/fs/ext2/ext2_fs.h b/libparted/fs/ext2/ext2_fs.h index 11bb6d7..f9ecd85 100644 --- a/libparted/fs/ext2/ext2_fs.h +++ b/libparted/fs/ext2/ext2_fs.h @@ -57,12 +57,14 @@ #define EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001 #define EXT2_FEATURE_RO_COMPAT_LARGE_FILE 0x0002 #define EXT4_FEATURE_RO_COMPAT_HUGE_FILE 0x0008 +#define EXT4_FEATURE_RO_COMPAT_GDT_CSUM 0x0010 #define EXT4_FEATURE_RO_COMPAT_DIR_NLINK 0x0020 #define EXT2_FEATURE_INCOMPAT_FILETYPE 0x0002 #define EXT3_FEATURE_INCOMPAT_RECOVER 0x0004 #define EXT4_FEATURE_INCOMPAT_EXTENTS 0x0040 #define EXT4_FEATURE_INCOMPAT_64BIT 0x0080 +#define EXT4_FEATURE_INCOMPAT_FLEX_BG 0x0200 /* * Special inodes numbers diff --git a/libparted/fs/ext2/interface.c b/libparted/fs/ext2/interface.c index df771a9..95ef759 100644 --- a/libparted/fs/ext2/interface.c +++ b/libparted/fs/ext2/interface.c @@ -55,11 +55,15 @@ _ext2_generic_probe (PedGeometry* geom, int expect_ext_ver) is_ext4 = ((EXT2_SUPER_FEATURE_RO_COMPAT (*sb) & EXT4_FEATURE_RO_COMPAT_HUGE_FILE) || (EXT2_SUPER_FEATURE_RO_COMPAT (*sb) + & EXT4_FEATURE_RO_COMPAT_GDT_CSUM) + || (EXT2_SUPER_FEATURE_RO_COMPAT (*sb) & EXT4_FEATURE_RO_COMPAT_DIR_NLINK) || (EXT2_SUPER_FEATURE_INCOMPAT (*sb) & EXT4_FEATURE_INCOMPAT_EXTENTS) || (EXT2_SUPER_FEATURE_INCOMPAT (*sb) - & EXT4_FEATURE_INCOMPAT_64BIT)); + & EXT4_FEATURE_INCOMPAT_64BIT) + || (EXT2_SUPER_FEATURE_INCOMPAT (*sb) + & EXT4_FEATURE_INCOMPAT_FLEX_BG)); if (is_ext4) is_ext3 = 0; } diff --git a/tests/t1700-ext-probe.sh b/tests/t1700-ext-probe.sh index 4b3a5a4..726ba27 100755 --- a/tests/t1700-ext-probe.sh +++ b/tests/t1700-ext-probe.sh @@ -45,4 +45,18 @@ for type in ext2 ext3 ext4; do done +# Some features should indicate ext4 by themselves. +for feature in uninit_bg flex_bg; do + # create an ext3 file system + dd if=/dev/zero of=$dev bs=1024 count=4096 >/dev/null || fail=1 + mkfs.ext3 -F $dev >/dev/null || fail=1 + + # set the feature + tune2fs -O $feature $dev || fail=1 + + # probe the file system, which should now be ext4 + parted -s $dev print >out 2>1 || fail=1 + grep -w ext4 out || fail=1 +done + Exit $fail -- 1.7.0 _______________________________________________ parted-devel mailing list parted-devel@lists.alioth.debian.org http://lists.alioth.debian.org/mailman/listinfo/parted-devel