ChangeLog, mke2fs.8.in, mke2fs.c:
mke2fs.c (PRS): Allow the user to specify exactly how many inodes
he/she wishes.
diff --git a/misc/ChangeLog b/misc/ChangeLog
index b8becd7..3810ed7 100644
--- a/misc/ChangeLog
+++ b/misc/ChangeLog
@@ -1,5 +1,8 @@
1999-01-05 Theodore Ts'o <tytso@rsts-11.mit.edu>
+ * mke2fs.c (PRS): Allow the user to specify exactly how many
+ inodes he/she wishes.
+
* chattr.c, lsattr.c: Only print the version information for the
program if the -V option is given.
diff --git a/misc/mke2fs.8.in b/misc/mke2fs.8.in
index cad2540..df8cc99 100644
--- a/misc/mke2fs.8.in
+++ b/misc/mke2fs.8.in
@@ -29,6 +29,10 @@
.I bytes-per-inode
]
[
+.B \-N
+.I number-of-inodes
+]
+[
.B \-m
.I reserved-blocks-percentage
]
@@ -105,6 +109,12 @@
.I bytes-per-inode
must be at least 1024.
.TP
+.I -N number-of-inodes
+overrides the default calculation of the number of inodes that should be
+reserved for the filesystem (which is based on the number of blocks and
+the bytes-per-inode ratio). This allows the user to specify the number
+of desired inodes directly.
+.TP
.I -l filename
Read the bad blocks list from
.I filename.
diff --git a/misc/mke2fs.c b/misc/mke2fs.c
index abad201..1f02da8 100644
--- a/misc/mke2fs.c
+++ b/misc/mke2fs.c
@@ -88,10 +88,10 @@
{
fprintf(stderr, "Usage: %s [-c|-t|-l filename] [-b block-size] "
"[-f fragment-size]\n\t[-i bytes-per-inode] "
- "[-m reserved-blocks-percentage] [-qvSV]\n\t"
- "[-o creator-os] [-g blocks-per-group] [-L volume-label]\n\t"
- "[-M last-mounted-directory] [-r fs-revision] [-R raid_opts]\n\t"
- "[-s sparse-super-flag] device [blocks-count]\n",
+ " [-N number-of-inodes]\n\t[-m reserved-blocks-percentage] "
+ "[-o creator-os] [-g blocks-per-group]\n\t[-L volume-label] "
+ "[-M last-mounted-directory] [-r fs-revision]\n\t[-R raid_opts]"
+ "[-s sparse-super-flag] [-qvSV] device [blocks-count]\n",
program_name);
exit(1);
}
@@ -632,6 +632,7 @@
blk_t max = 8192;
int inode_ratio = 4096;
int reserved_ratio = 5;
+ ino_t num_inodes = 0;
errcode_t retval;
int sparse_option = -1;
char *oldpath = getenv("PATH");
@@ -662,7 +663,7 @@
if (argc && *argv)
program_name = *argv;
while ((c = getopt (argc, argv,
- "b:cf:g:i:l:m:o:qr:R:s:tvI:SFL:M:V")) != EOF)
+ "b:cf:g:i:l:m:o:qr:R:s:tvI:SFL:M:N:V")) != EOF)
switch (c) {
case 'b':
size = strtoul(optarg, &tmp, 0);
@@ -745,6 +746,9 @@
param.s_inode_size = atoi(optarg);
break;
#endif
+ case 'N':
+ num_inodes = atoi(optarg);
+ break;
case 'v':
verbose = 1;
break;
@@ -833,7 +837,7 @@
/*
* Calculate number of inodes based on the inode ratio
*/
- param.s_inodes_count =
+ param.s_inodes_count = num_inodes ? num_inodes :
((long long) param.s_blocks_count * EXT2_BLOCK_SIZE(¶m))
/ inode_ratio;