Whamcloud - gitweb
create_inode: move debugfs internal state back to debugfs
[tools/e2fsprogs.git] / misc / mke2fs.c
index b76b07e..1422336 100644 (file)
@@ -1058,7 +1058,8 @@ static __u32 ok_features[3] = {
                EXT2_FEATURE_INCOMPAT_META_BG|
                EXT4_FEATURE_INCOMPAT_FLEX_BG|
                EXT4_FEATURE_INCOMPAT_MMP |
-               EXT4_FEATURE_INCOMPAT_64BIT,
+               EXT4_FEATURE_INCOMPAT_64BIT|
+               EXT4_FEATURE_INCOMPAT_INLINE_DATA,
        /* R/O compat */
        EXT2_FEATURE_RO_COMPAT_LARGE_FILE|
                EXT4_FEATURE_RO_COMPAT_HUGE_FILE|
@@ -1982,6 +1983,9 @@ profile_error:
         * 32-bit vs 64-bit block number support.
         */
        if ((fs_blocks_count > MAX_32_NUM) &&
+           (fs_param.s_feature_incompat & EXT4_FEATURE_INCOMPAT_64BIT))
+               fs_param.s_feature_compat &= ~EXT2_FEATURE_COMPAT_RESIZE_INODE;
+       if ((fs_blocks_count > MAX_32_NUM) &&
            !(fs_param.s_feature_incompat & EXT4_FEATURE_INCOMPAT_64BIT) &&
            get_bool_from_profile(fs_types, "auto_64-bit_support", 0)) {
                fs_param.s_feature_incompat |= EXT4_FEATURE_INCOMPAT_64BIT;
@@ -2221,7 +2225,8 @@ profile_error:
                                  "See https://ext4.wiki.kernel.org/"
                                  "index.php/Quota for more information\n\n"));
 
-       /* Since sparse_super is the default, we would only have a problem
+       /*
+        * Since sparse_super is the default, we would only have a problem
         * here if it was explicitly disabled.
         */
        if ((fs_param.s_feature_compat & EXT2_FEATURE_COMPAT_RESIZE_INODE) &&
@@ -2277,6 +2282,18 @@ profile_error:
                                blocksize);
                        exit(1);
                }
+               /*
+                * If inode size is 128 and inline data is enabled, we need
+                * to notify users that inline data will never be useful.
+                */
+               if ((fs_param.s_feature_incompat &
+                    EXT4_FEATURE_INCOMPAT_INLINE_DATA) &&
+                   inode_size == EXT2_GOOD_OLD_INODE_SIZE) {
+                       com_err(program_name, 0,
+                               _("inode size is %d, inline data is useless"),
+                               inode_size);
+                       exit(1);
+               }
                fs_param.s_inode_size = inode_size;
        }
 
@@ -2971,9 +2988,20 @@ no_journal:
                if (!quiet)
                        printf("%s", _("Copying files into the device: "));
 
-               current_fs = fs;
-               root = EXT2_ROOT_INO;
-               retval = populate_fs(root, root_dir);
+               /*
+                * Allocate memory for the hardlinks, we don't need free()
+                * since the lifespan will be over after the fs populated.
+                */
+               if ((hdlinks.hdl = (struct hdlink_s *)
+                               malloc(hdlink_cnt * sizeof(struct hdlink_s))) == NULL) {
+                       fprintf(stderr, "%s", _("\nNot enough memory\n"));
+                       retval = ext2fs_close(fs);
+                       return retval;
+               }
+
+               hdlinks.count = 0;
+               retval = populate_fs(fs, EXT2_ROOT_INO, root_dir,
+                                    EXT2_ROOT_INO);
                if (retval)
                        fprintf(stderr, "%s",
                                _("\nError while populating file system"));