[PATCH 28/31] mke2fs: Complain about creating 64bit filesystems without extents

Darrick J. Wong
2013-10-01T01:29:51Z

A 64bit filesystem without extents is not terribly useful, because the old
block map format does not support pointing to high block numbers. Warn the
user who tries to create such an animal.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
misc/mke2fs.c | 12 ++++++++++++
1 file changed, 12 insertions(+)

diff --git a/misc/mke2fs.c b/misc/mke2fs.c
index d8bd5ed..1e44a84 100644
--- a/misc/mke2fs.c
+++ b/misc/mke2fs.c
@@ -2460,6 +2460,18 @@ int main (int argc, char *argv[])
"checksumming. Pass -O 64bit to rectify.\n"));
}

+ /* Check the user's mkfs options for 64bit */
+ if (!quiet &&
+ EXT2_HAS_INCOMPAT_FEATURE(fs->super,
+ EXT4_FEATURE_INCOMPAT_64BIT) &&
+ !EXT2_HAS_INCOMPAT_FEATURE(fs->super,
+ EXT3_FEATURE_INCOMPAT_EXTENTS)) {
+ printf(_("Extents MUST be enabled for a 64-bit filesystem to "
+ "be able to access the entire disk space. Pass "
+ "-O extents to rectify.\n"));
+ exit(1);
+ }
+
/* Calculate journal blocks */
if (!journal_device && ((journal_size) ||
(fs_param.s_feature_compat &