Cset exclude: kergoth@handhelds.org|ChangeSet|20041014055438|18481
authorChris Larson <clarson@kergoth.com>
Thu, 14 Oct 2004 06:07:16 +0000 (06:07 +0000)
committerChris Larson <clarson@kergoth.com>
Thu, 14 Oct 2004 06:07:16 +0000 (06:07 +0000)
Changed my mind wrt auto-inode-count in genext2fs.  In the name of
consistency, behave the same way as the blocks.  Default to having
only as many as we need, let the user specify a value if they want
to "pad" more than that.

BKrev: 416e1794VeVhUJHPjyvsiPIQqRTqwA

genext2fs/genext2fs-1.3/autosize.patch

index a41b79b..a4318a6 100644 (file)
  #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 {
 +              }
 +      }
 +}
-+
 +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) {
 +                      bucket = bucket->next;
 +              }
 +      }
-+
 +      return count;
 +}
  
        if(optind < (argc - 1))
                error_msg_and_die("too many arguments");
        if(optind == (argc - 1))
-@@ -2201,12 +2411,54 @@
+@@ -2201,6 +2411,46 @@
        }
        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++)
 +                      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");
-               fs = init_fs(nbblocks, nbinodes, nbresrvd, holes);
-       }
-       for(i = 0; i < didx; i++)
+               if(nbblocks == -1)
+                       error_msg_and_die("filesystem size unspecified");
+               if(nbinodes == -1)