summaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2011-06-14 14:30:22 -0400
committerTheodore Ts'o <tytso@mit.edu>2011-06-14 14:32:48 -0400
commit2d34a25f81d6868387c2b21e8d6d25291c1069db (patch)
tree254b65bc034ee8ccf1158e3490a28ca5ec7a04ee /misc
parent4c2b28ab67dec1e1c4173a0e7e785dae09d161d2 (diff)
downloade2fsprogs-2d34a25f81d6868387c2b21e8d6d25291c1069db.tar.gz
mke2fs: add support for cluster size in mke2fs.conf
Add support for specifying the cluster size in mke2fs.conf Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'misc')
-rw-r--r--misc/mke2fs.c19
-rw-r--r--misc/mke2fs.conf.5.in7
2 files changed, 17 insertions, 9 deletions
diff --git a/misc/mke2fs.c b/misc/mke2fs.c
index 69f94f07..cdf2281d 100644
--- a/misc/mke2fs.c
+++ b/misc/mke2fs.c
@@ -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;
diff --git a/misc/mke2fs.conf.5.in b/misc/mke2fs.conf.5.in
index b0f1cccc..b2c7a57b 100644
--- a/misc/mke2fs.conf.5.in
+++ b/misc/mke2fs.conf.5.in
@@ -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]