forked from vitalif/vitastor
Allow to specify data area size
parent
c9f3654905
commit
8e63995306
|
@ -177,7 +177,7 @@ class blockstore_impl_t
|
||||||
uint32_t block_size;
|
uint32_t block_size;
|
||||||
uint64_t meta_offset;
|
uint64_t meta_offset;
|
||||||
uint64_t data_offset;
|
uint64_t data_offset;
|
||||||
uint64_t cfg_journal_size;
|
uint64_t cfg_journal_size, cfg_data_size;
|
||||||
// Required write alignment and journal/metadata/data areas' location alignment
|
// Required write alignment and journal/metadata/data areas' location alignment
|
||||||
uint32_t disk_alignment = 512;
|
uint32_t disk_alignment = 512;
|
||||||
// Journal block size - minimum_io_size of the journal device is the best choice
|
// Journal block size - minimum_io_size of the journal device is the best choice
|
||||||
|
|
|
@ -38,6 +38,7 @@ void blockstore_impl_t::parse_config(blockstore_config_t & config)
|
||||||
cfg_journal_size = strtoull(config["journal_size"].c_str(), NULL, 10);
|
cfg_journal_size = strtoull(config["journal_size"].c_str(), NULL, 10);
|
||||||
data_device = config["data_device"];
|
data_device = config["data_device"];
|
||||||
data_offset = strtoull(config["data_offset"].c_str(), NULL, 10);
|
data_offset = strtoull(config["data_offset"].c_str(), NULL, 10);
|
||||||
|
cfg_data_size = strtoull(config["data_size"].c_str(), NULL, 10);
|
||||||
meta_device = config["meta_device"];
|
meta_device = config["meta_device"];
|
||||||
meta_offset = strtoull(config["meta_offset"].c_str(), NULL, 10);
|
meta_offset = strtoull(config["meta_offset"].c_str(), NULL, 10);
|
||||||
block_size = strtoull(config["block_size"].c_str(), NULL, 10);
|
block_size = strtoull(config["block_size"].c_str(), NULL, 10);
|
||||||
|
@ -151,6 +152,15 @@ void blockstore_impl_t::calc_lengths()
|
||||||
data_len = data_len < journal.offset-data_offset
|
data_len = data_len < journal.offset-data_offset
|
||||||
? data_len : journal.offset-data_offset;
|
? data_len : journal.offset-data_offset;
|
||||||
}
|
}
|
||||||
|
if (cfg_data_size != 0)
|
||||||
|
{
|
||||||
|
if (data_len < cfg_data_size)
|
||||||
|
{
|
||||||
|
throw std::runtime_error("Data area ("+std::to_string(data_len)+
|
||||||
|
" bytes) is less than configured size ("+std::to_string(cfg_data_size)+" bytes)");
|
||||||
|
}
|
||||||
|
data_len = cfg_data_size;
|
||||||
|
}
|
||||||
// meta
|
// meta
|
||||||
meta_area = (meta_fd == data_fd ? data_size : meta_size) - meta_offset;
|
meta_area = (meta_fd == data_fd ? data_size : meta_size) - meta_offset;
|
||||||
if (meta_fd == data_fd && meta_offset <= data_offset)
|
if (meta_fd == data_fd && meta_offset <= data_offset)
|
||||||
|
|
Loading…
Reference in New Issue