Whamcloud - gitweb
mke2fs: minor bugfixes for mk_hugefiles
authorTheodore Ts'o <tytso@mit.edu>
Thu, 6 Feb 2014 19:34:12 +0000 (14:34 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 6 Feb 2014 19:34:12 +0000 (14:34 -0500)
Interpret "zero_hugefiles" relation in mke2fs.conf as a boolean value,
as documented in the man page.

If the hugefile is larger than 2GB, set the large_file file system
feature so e2fsck doesn't complain.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
misc/mk_hugefiles.c

index eb91f0c..debc3fe 100644 (file)
@@ -349,8 +349,8 @@ errcode_t mk_hugefiles(ext2_filsys fs)
        align = parse_num_blocks2(t, fs->super->s_log_block_size);
        free(t);
        num_blocks = round_up_align(num_blocks, align);
-       zero_hugefile = get_int_from_profile(fs_types, "zero_hugefiles",
-                                            zero_hugefile);
+       zero_hugefile = get_bool_from_profile(fs_types, "zero_hugefiles",
+                                             zero_hugefile);
 
        t = get_string_from_profile(fs_types, "hugefiles_dir", "/");
        retval = create_directory(fs, t, &dir);
@@ -402,6 +402,11 @@ errcode_t mk_hugefiles(ext2_filsys fs)
        goal = get_start_block(fs, num_slack);
        goal = round_up_align(goal, align);
 
+       if ((num_blocks ? num_blocks : fs_blocks) >
+           (0x80000000UL / fs->blocksize))
+               fs->super->s_feature_ro_compat |=
+                       EXT2_FEATURE_RO_COMPAT_LARGE_FILE;
+
        if (!quiet) {
                if (zero_hugefile && verbose)
                        printf(_("Huge files will be zero'ed\n"));