]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
mke2fs: add support for cluster size in mke2fs.conf
authorTheodore Ts'o <tytso@mit.edu>
Tue, 14 Jun 2011 18:30:22 +0000 (14:30 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 14 Jun 2011 18:32:48 +0000 (14:32 -0400)
Add support for specifying the cluster size in mke2fs.conf

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

index 69f94f07c1f05afcfe16ee00819f05ccc91c17cf..cdf2281dff3a4748a01e19dcbc751b608fb80417 100644 (file)
@@ -1177,7 +1177,7 @@ out:
 static void PRS(int argc, char *argv[])
 {
        int             b, c;
-       int             size;
+       int             cluster_size = 0;
        char            *tmp, **cpp;
        int             blocksize = 0;
        int             inode_ratio = 0;
@@ -1305,16 +1305,14 @@ profile_error:
                        cflag++;
                        break;
                case 'C':
-                       size = strtoul(optarg, &tmp, 0);
-                       if (size < EXT2_MIN_CLUSTER_SIZE ||
-                           size > EXT2_MAX_CLUSTER_SIZE || *tmp) {
+                       cluster_size = strtoul(optarg, &tmp, 0);
+                       if (cluster_size < EXT2_MIN_CLUSTER_SIZE ||
+                           cluster_size > EXT2_MAX_CLUSTER_SIZE || *tmp) {
                                com_err(program_name, 0,
                                        _("invalid fragment size - %s"),
                                        optarg);
                                exit(1);
                        }
-                       fs_param.s_log_cluster_size =
-                               int_log2(size >> EXT2_MIN_CLUSTER_LOG_SIZE);
                        break;
                case 'g':
                        fs_param.s_blocks_per_group = strtoul(optarg, &tmp, 0);
@@ -1801,9 +1799,12 @@ profile_error:
        fs_param.s_log_block_size =
                int_log2(blocksize >> EXT2_MIN_BLOCK_LOG_SIZE);
        if (fs_param.s_feature_ro_compat & EXT4_FEATURE_RO_COMPAT_BIGALLOC) {
-               if (fs_param.s_log_cluster_size == 0)
-                       fs_param.s_log_cluster_size =
-                               fs_param.s_log_block_size + 4;
+               if (!cluster_size)
+                       cluster_size = get_int_from_profile(fs_types,
+                                                           "cluster_size",
+                                                           blocksize*4);
+               fs_param.s_log_cluster_size =
+                       int_log2(cluster_size >> EXT2_MIN_CLUSTER_LOG_SIZE);
        } else
                fs_param.s_log_cluster_size = fs_param.s_log_block_size;
 
index b0f1cccc24c43d4da6fc985f8128757302dc6439..b2c7a57b57cd106eab6b55917f4b5e7a59b58ada 100644 (file)
@@ -395,6 +395,13 @@ on a per-filesystem type basis.
 This relation is a boolean which specifies whether the
 .BR mke2fs (8)
 should attempt to discard device prior to filesystem creation.
+.TP
+.I cluster_size
+This relation specifies the default cluster size if the bigalloc file
+system feature is enabled.  It can be overridden via the
+.B \-C
+command line option to
+.BR mke2fs (8)
 .SH THE [devices] STANZA
 Each tag in the
 .I [devices]