HAMMER - Formalize the maximum number of volumes (256).
authorMatthew Dillon <dillon@apollo.backplane.com>
Fri, 3 Jul 2009 16:43:11 +0000 (09:43 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Fri, 3 Jul 2009 16:43:11 +0000 (09:43 -0700)
Formalize the maximum number of volumes (256) by adding a define in
hammer_disk.h and then using it.

Submitted-by: Antonio Huete Jimenez <ahuete.devel@gmail.com>

sbin/newfs_hammer/newfs_hammer.c
sys/vfs/hammer/hammer_disk.h

index 9758dd9..731847a 100644 (file)
@@ -173,6 +173,12 @@ main(int ac, char **av)
                 exit(1);
         }
 
+       if (NumVolumes > HAMMER_MAX_VOLUMES) {
+                fprintf(stderr,
+                        "newfs_hammer: The maximum number of volumes is %d\n", HAMMER_MAX_VOLUMES);
+               exit(1);
+       }
+
        total = 0;
        for (i = 0; i < NumVolumes; ++i) {
                vol = setup_volume(i, av[i], 1, O_RDWR);
@@ -190,7 +196,7 @@ main(int ac, char **av)
         */
        if (BootAreaSize == 0) {
                BootAreaSize = HAMMER_BOOT_NOMBYTES;
-               while (BootAreaSize > total / NumVolumes / 256)
+               while (BootAreaSize > total / NumVolumes / HAMMER_MAX_VOLUMES)
                        BootAreaSize >>= 1;
                if (BootAreaSize < HAMMER_BOOT_MINBYTES)
                        BootAreaSize = 0;
@@ -199,7 +205,7 @@ main(int ac, char **av)
        }
        if (MemAreaSize == 0) {
                MemAreaSize = HAMMER_MEM_NOMBYTES;
-               while (MemAreaSize > total / NumVolumes / 256)
+               while (MemAreaSize > total / NumVolumes / HAMMER_MAX_VOLUMES)
                        MemAreaSize >>= 1;
                if (MemAreaSize < HAMMER_MEM_MINBYTES)
                        MemAreaSize = 0;
index 97243f1..262cbac 100644 (file)
 #define HAMMER_RECOVERY_BND    0x0000000001000000ULL
 
 /*
+ * The current limit of volumes that can make up a HAMMER FS
+ */
+#define HAMMER_MAX_VOLUMES     256
+
+/*
  * Hammer transction ids are 64 bit unsigned integers and are usually
  * synchronized with the time of day in nanoseconds.
  *