const char *vol_name, int vol_no, int vol_count,
int64_t vol_size, int64_t boot_area_size, int64_t mem_area_size);
-static int
+static uint64_t
hammer_format_freemap(struct hammer_mount *hmp,
hammer_transaction_t trans,
- hammer_volume_t volume,
- hammer_volume_t root_volume);
+ hammer_volume_t volume);
static uint64_t
hammer_format_layer2_chunk(struct hammer_mount *hmp,
volume = hammer_get_volume(hmp, free_vol_no, &error);
KKASSERT(volume != NULL && error == 0);
-
root_volume = hammer_get_root_volume(hmp, &error);
KKASSERT(root_volume != NULL && error == 0);
- error = hammer_format_freemap(hmp, trans, volume, root_volume);
+ uint64_t total_free_bigblocks =
+ hammer_format_freemap(hmp, trans, volume);
+
+ /*
+ * Increase the total number of bigblocks
+ */
+ hammer_modify_volume_field(trans, root_volume,
+ vol0_stat_bigblocks);
+ root_volume->ondisk->vol0_stat_bigblocks += total_free_bigblocks;
+ hammer_modify_volume_done(root_volume);
+
+ /*
+ * Increase the number of free bigblocks
+ * (including the copy in hmp)
+ */
+ hammer_modify_volume_field(trans, root_volume,
+ vol0_stat_freebigblocks);
+ root_volume->ondisk->vol0_stat_freebigblocks += total_free_bigblocks;
+ hmp->copy_stat_freebigblocks =
+ root_volume->ondisk->vol0_stat_freebigblocks;
+ hammer_modify_volume_done(root_volume);
hammer_rel_volume(root_volume, 0);
hammer_rel_volume(volume, 0);
return (error);
}
-static int
+static uint64_t
hammer_format_freemap(struct hammer_mount *hmp,
hammer_transaction_t trans,
- hammer_volume_t volume,
- hammer_volume_t root_volume)
+ hammer_volume_t volume)
{
hammer_off_t phys_offset;
hammer_buffer_t buffer = NULL;
total_free_bigblocks += free_bigblocks;
}
- /*
- * Increase the total number of bigblocks
- */
- hammer_modify_volume_field(trans, root_volume,
- vol0_stat_bigblocks);
- root_volume->ondisk->vol0_stat_bigblocks += total_free_bigblocks;
- hammer_modify_volume_done(root_volume);
-
- /*
- * Increase the number of free bigblocks
- * (including the copy in hmp)
- */
- hammer_modify_volume_field(trans, root_volume,
- vol0_stat_freebigblocks);
- root_volume->ondisk->vol0_stat_freebigblocks += total_free_bigblocks;
- hmp->copy_stat_freebigblocks =
- root_volume->ondisk->vol0_stat_freebigblocks;
- hammer_modify_volume_done(root_volume);
-
if (buffer) {
hammer_rel_buffer(buffer, 0);
buffer = NULL;
}
- return (error);
+ return total_free_bigblocks;
}
/*