summaryrefslogtreecommitdiff
path: root/genext2fs
diff options
context:
space:
mode:
authorChris Larson <clarson@kergoth.com>2004-10-14 05:54:38 +0000
committerChris Larson <clarson@kergoth.com>2004-10-14 05:54:38 +0000
commitc5425588c7469347e8794b89f001e2439be000a8 (patch)
tree3e10326dce34e09468cf15e886d06955ea574f86 /genext2fs
parenta517e7b6b9e5c4f14e6103c2aed672532944ca5c (diff)
Update genext2fs autosize patch: use the default # of inodes if its sufficient, fall back to the automatic.
BKrev: 416e149eZNGbWAx82AoqdfbZOX3ZRw
Diffstat (limited to 'genext2fs')
-rw-r--r--genext2fs/genext2fs-1.3/autosize.patch30
1 files changed, 20 insertions, 10 deletions
diff --git a/genext2fs/genext2fs-1.3/autosize.patch b/genext2fs/genext2fs-1.3/autosize.patch
index a4318a6eee..a41b79b5ab 100644
--- a/genext2fs/genext2fs-1.3/autosize.patch
+++ b/genext2fs/genext2fs-1.3/autosize.patch
@@ -23,17 +23,17 @@
#include <fcntl.h>
+#include <sys/types.h>
+#include <getopt.h>
-+
+
+#define HASH_SIZE 311 /* Should be prime */
+#define hash_inode(i) ((i) % HASH_SIZE)
-+
+
+typedef struct ino_dev_hash_bucket_struct {
+ struct ino_dev_hash_bucket_struct *next;
+ ino_t ino;
+ dev_t dev;
+ char name[1];
+} ino_dev_hashtable_bucket_t;
-+
+
+static ino_dev_hashtable_bucket_t *ino_dev_hashtable[HASH_SIZE];
+
+struct stats {
@@ -92,12 +92,12 @@
+ }
+ }
+}
-
++
+static int count_ino_in_hashtable(void)
+{
+ long count = 0;
+ int i;
-
++
+ for (i = 0; i < HASH_SIZE; i++) {
+ ino_dev_hashtable_bucket_t *bucket = ino_dev_hashtable[i];
+ while (bucket != NULL) {
@@ -105,7 +105,7 @@
+ bucket = bucket->next;
+ }
+ }
-
++
+ return count;
+}
@@ -290,10 +290,17 @@
if(optind < (argc - 1))
error_msg_and_die("too many arguments");
if(optind == (argc - 1))
-@@ -2201,6 +2411,46 @@
+@@ -2201,12 +2411,54 @@
}
else
{
+- if(nbblocks == -1)
+- error_msg_and_die("filesystem size unspecified");
+ if(nbinodes == -1)
+ nbinodes = nbblocks * BLOCKSIZE / rndup(BYTES_PER_INODE, BLOCKSIZE);
+ if(nbresrvd == -1)
+ nbresrvd = nbblocks * RESERVED_INODES;
++
+ stats.ninodes = 0;
+ stats.nblocks = 0;
+ for(i = 0; i < didx; i++)
@@ -334,6 +341,9 @@
+ printf("Number of inodes too low, increasing to %d\n",tmp_nbinodes);
+ nbinodes = tmp_nbinodes;
+ }
- if(nbblocks == -1)
- error_msg_and_die("filesystem size unspecified");
- if(nbinodes == -1)
++
++ if(nbblocks == -1)
++ error_msg_and_die("filesystem size unspecified");
+ fs = init_fs(nbblocks, nbinodes, nbresrvd, holes);
+ }
+ for(i = 0; i < didx; i++)