sbin/hammer: Remove unnecessary blockmap argument
authorTomohiro Kusumi <kusumi.tomohiro@gmail.com>
Sat, 11 Jul 2015 10:50:59 +0000 (19:50 +0900)
committerTomohiro Kusumi <kusumi.tomohiro@gmail.com>
Sat, 11 Jul 2015 18:21:59 +0000 (03:21 +0900)
- format_freemap() does not need the second argument for blockmap.
  This function sets that blockmap pointer to
  &root_vol->ondisk->vol0_blockmap[4];
  right before it starts to initialize blockmap anyway.

- Also passing the freemap blockmap as an argument is redundant
  in terms of api since format_freemap() can access the freemap
  blockmap via the first argument (root volume, as mentioned above)
  given that the function knows it's looking for blockmaps[4].

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

index 3c9a24f..26837b4 100644 (file)
@@ -153,7 +153,7 @@ void hammer_key_beg_init(hammer_base_elm_t base);
 void hammer_key_end_init(hammer_base_elm_t base);
 int hammer_crc_test_leaf(void *data, hammer_btree_leaf_elm_t leaf);
 
-void format_freemap(struct volume_info *root_vol, hammer_blockmap_t blockmap);
+void format_freemap(struct volume_info *root_vol);
 int64_t initialize_freemap(struct volume_info *vol);
 int64_t count_freemap(struct volume_info *vol);
 
index ec8461e..d12fe80 100644 (file)
@@ -467,10 +467,11 @@ alloc_data_element(hammer_off_t *offp, int32_t data_len,
  * code will load each volume's freemap.
  */
 void
-format_freemap(struct volume_info *root_vol, hammer_blockmap_t blockmap)
+format_freemap(struct volume_info *root_vol)
 {
        struct buffer_info *buffer = NULL;
        hammer_off_t layer1_offset;
+       hammer_blockmap_t blockmap;
        struct hammer_blockmap_layer1 *layer1;
        int i, isnew;
 
index b68aa91..610b9a4 100644 (file)
@@ -576,8 +576,7 @@ format_volume(struct volume_info *vol, int nvols, const char *label,
                 */
                ondisk->vol0_next_tid = createtid();
 
-               format_freemap(vol,
-                       &ondisk->vol0_blockmap[HAMMER_ZONE_FREEMAP_INDEX]);
+               format_freemap(vol);
                ondisk->vol0_stat_freebigblocks = initialize_freemap(vol);
 
                /*