Fix vitastor-disk prepare and param validation
This commit is contained in:
@@ -162,6 +162,8 @@ blockstore_heap_t::blockstore_heap_t(blockstore_disk_t *dsk, uint8_t *buffer_are
|
||||
{
|
||||
assert(target_block_free_space < dsk->meta_block_size);
|
||||
assert(dsk->meta_block_size < 32768);
|
||||
assert(dsk->meta_area_size > 0);
|
||||
assert(dsk->journal_len > 0);
|
||||
assert(sizeof(heap_object_t) < sizeof(heap_write_t));
|
||||
meta_alloc = new multilist_index_t(meta_block_count, 1 + dsk->meta_block_size/MIN_ALLOC, 0);
|
||||
block_info.resize(meta_block_count);
|
||||
|
||||
@@ -30,6 +30,10 @@ blockstore_impl_t::blockstore_impl_t(blockstore_config_t & config, ring_loop_i *
|
||||
}
|
||||
meta_superblock = (uint8_t*)memalign_or_die(MEM_ALIGNMENT, dsk.meta_block_size);
|
||||
memset(meta_superblock, 0, dsk.meta_block_size);
|
||||
}
|
||||
|
||||
void blockstore_impl_t::init()
|
||||
{
|
||||
flusher = new journal_flusher_t(this);
|
||||
if (dsk.inmemory_journal)
|
||||
{
|
||||
@@ -40,11 +44,12 @@ blockstore_impl_t::blockstore_impl_t(blockstore_config_t & config, ring_loop_i *
|
||||
|
||||
blockstore_impl_t::~blockstore_impl_t()
|
||||
{
|
||||
if (flusher)
|
||||
delete flusher;
|
||||
if (heap)
|
||||
delete heap;
|
||||
if (buffer_area)
|
||||
free(buffer_area);
|
||||
delete flusher;
|
||||
if (meta_superblock)
|
||||
free(meta_superblock);
|
||||
if (zero_object)
|
||||
|
||||
@@ -146,6 +146,7 @@ public:
|
||||
int metadata_buf_size;
|
||||
blockstore_init_meta* metadata_init_reader;
|
||||
|
||||
void init();
|
||||
void check_wait(blockstore_op_t *op);
|
||||
void init_op(blockstore_op_t *op);
|
||||
|
||||
|
||||
@@ -147,7 +147,6 @@ resume_1:
|
||||
);
|
||||
exit(1);
|
||||
}
|
||||
bs->heap->set_compacted_lsn(hdr->compacted_lsn);
|
||||
if (bs->dsk.meta_format != hdr->version)
|
||||
{
|
||||
bs->dsk.meta_format = hdr->version;
|
||||
@@ -155,6 +154,8 @@ resume_1:
|
||||
}
|
||||
bs->dsk.check_lengths();
|
||||
}
|
||||
bs->init();
|
||||
bs->heap->set_compacted_lsn(((blockstore_meta_header_v3_t *)bs->meta_superblock)->compacted_lsn);
|
||||
if (bs->dsk.inmemory_journal)
|
||||
{
|
||||
// Read buffer area
|
||||
|
||||
Reference in New Issue
Block a user