Zero-fill new objects and write them to the main storage

This commit is contained in:
Vitaliy Filippov
2019-11-12 20:49:57 +03:00
parent 4afa95b0e3
commit bb55a7fbf4
4 changed files with 35 additions and 19 deletions
+2
View File
@@ -13,6 +13,7 @@ blockstore::blockstore(spp::sparse_hash_map<std::string, std::string> & config,
{
throw new std::runtime_error("Bad block size");
}
zero_object = (uint8_t*)memalign(DISK_ALIGNMENT, block_size);
data_fd = meta_fd = journal.fd = -1;
try
{
@@ -38,6 +39,7 @@ blockstore::blockstore(spp::sparse_hash_map<std::string, std::string> & config,
blockstore::~blockstore()
{
free(zero_object);
ringloop->unregister_consumer(ring_consumer.number);
if (data_fd >= 0)
close(data_fd);