Whamcloud - gitweb
mke2fs: warn if not enabling all the features that metadata_csum wants
authorDarrick J. Wong <djwong@us.ibm.com>
Fri, 3 Aug 2012 00:47:45 +0000 (20:47 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 3 Aug 2012 00:47:45 +0000 (20:47 -0400)
The metadata_csum feature works best when two features are enabled.
These features are "extents" (because the block map has no space for
checksums) and "64bit" (this enables storage of full 32-bit checksums
in certain fields).  Print a warning if the user tries to create a
filesystem without those features.

Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
misc/mke2fs.c

index b561ca6..072e656 100644 (file)
@@ -2314,6 +2314,25 @@ int main (int argc, char *argv[])
        }
        fs->progress_ops = &ext2fs_numeric_progress_ops;
 
+       /* Check the user's mkfs options for metadata checksumming */
+       if (!quiet &&
+           EXT2_HAS_RO_COMPAT_FEATURE(fs->super,
+                                      EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) {
+               if (!EXT2_HAS_INCOMPAT_FEATURE(fs->super,
+                               EXT3_FEATURE_INCOMPAT_EXTENTS))
+                       printf(_("Extents are not enabled.  The file extent "
+                                "tree can be checksummed, whereas block maps "
+                                "cannot.  Not enabling extents reduces the "
+                                "coverage of metadata checksumming.  "
+                                "Pass -O extents to rectify.\n"));
+               if (!EXT2_HAS_INCOMPAT_FEATURE(fs->super,
+                               EXT4_FEATURE_INCOMPAT_64BIT))
+                       printf(_("64-bit filesystem support is not "
+                                "enabled.  The larger fields afforded by "
+                                "this feature enable full-strength "
+                                "checksumming.  Pass -O 64bit to rectify.\n"));
+       }
+
        /* Can't undo discard ... */
        if (!noaction && discard && (io_ptr != undo_io_manager)) {
                retval = mke2fs_discard_device(fs);