Verify checksums during journal reads

This commit is contained in:
Vitaliy Filippov
2023-07-29 12:17:18 +03:00
parent a166147110
commit 213a9ccb4d
10 changed files with 295 additions and 195 deletions
+2
View File
@@ -191,6 +191,7 @@ void blockstore_disk_t::calc_lengths(bool skip_meta_check)
// required metadata size
block_count = data_len / data_block_size;
meta_len = (1 + (block_count - 1 + meta_block_size / clean_entry_size) / (meta_block_size / clean_entry_size)) * meta_block_size;
meta_version = BLOCKSTORE_META_VERSION_V2;
if (!skip_meta_check && meta_area_size < meta_len)
{
if (!data_csum_type && !meta_version)
@@ -201,6 +202,7 @@ void blockstore_disk_t::calc_lengths(bool skip_meta_check)
if (meta_area_size >= meta_v0_len)
{
// Old metadata fits.
printf("Warning: Forcing metadata format without checksums because the new format doesn't fit into provided area\n");
clean_entry_size = clean_entry_v0_size;
meta_len = meta_v0_len;
meta_version = BLOCKSTORE_META_VERSION_V1;