sbin/hammer: Remove vol_alloc from volume_info
authorTomohiro Kusumi <kusumi.tomohiro@gmail.com>
Mon, 21 Dec 2015 13:14:08 +0000 (22:14 +0900)
committerTomohiro Kusumi <kusumi.tomohiro@gmail.com>
Wed, 23 Dec 2015 09:14:58 +0000 (18:14 +0900)
vol_alloc is a fixed sized space before boot/mem/buf area
that the filesystem doesn't recognize once initialized.
(This area is currently used for nothing)

sbin/hammer/hammer_util.h
sbin/hammer/ondisk.c
sbin/newfs_hammer/newfs_hammer.c

index d0c06c9..48469ee 100644 (file)
@@ -96,7 +96,6 @@ struct volume_info {
        struct cache_info       cache;
        TAILQ_ENTRY(volume_info) entry;
        int                     vol_no;
-       hammer_off_t            vol_alloc;      /* volume-relative offset */
        hammer_off_t            vol_free_off;   /* zone-2 offset */
        hammer_off_t            vol_free_end;   /* zone-2 offset */
 
index cc02cd9..cf2f922 100644 (file)
@@ -209,12 +209,6 @@ check_volume(struct volume_info *vol)
                vol->device_offset = pinfo.media_offset;
                vol->type = "DEVICE";
        }
-
-       /*
-        * Reserve space for (future) header junk, setup our poor-man's
-        * big-block allocator.
-        */
-       vol->vol_alloc = HAMMER_BUFSIZE * 16;
 }
 
 struct volume_info *
index 1256e21..63adbcf 100644 (file)
@@ -456,6 +456,7 @@ format_volume(struct volume_info *vol, int nvols, const char *label)
        struct hammer_volume_ondisk *ondisk;
        int64_t freeblks;
        int64_t freebytes;
+       hammer_off_t vol_alloc;
        int i;
 
        /*
@@ -470,15 +471,21 @@ format_volume(struct volume_info *vol, int nvols, const char *label)
        ondisk->vol_count = nvols;
        ondisk->vol_version = HammerVersion;
 
-       ondisk->vol_bot_beg = vol->vol_alloc;
-       vol->vol_alloc += BootAreaSize;
-       ondisk->vol_mem_beg = vol->vol_alloc;
-       vol->vol_alloc += MemAreaSize;
+       /*
+        * Reserve space for (future) header junk, setup our poor-man's
+        * big-block allocator.
+        */
+       vol_alloc = HAMMER_BUFSIZE * 16;  /* 262144 */
+
+       ondisk->vol_bot_beg = vol_alloc;
+       vol_alloc += BootAreaSize;
+       ondisk->vol_mem_beg = vol_alloc;
+       vol_alloc += MemAreaSize;
 
        /*
         * The remaining area is the zone 2 buffer allocation area.
         */
-       ondisk->vol_buf_beg = vol->vol_alloc;
+       ondisk->vol_buf_beg = vol_alloc;
        ondisk->vol_buf_end = vol->size & ~(int64_t)HAMMER_BUFMASK;
 
        if (ondisk->vol_buf_end < ondisk->vol_buf_beg) {