diff --git a/persistent-data/space-maps/disk.cc b/persistent-data/space-maps/disk.cc index e641c89..e915eb4 100644 --- a/persistent-data/space-maps/disk.cc +++ b/persistent-data/space-maps/disk.cc @@ -747,6 +747,11 @@ persistent_data::create_metadata_sm(transaction_manager &tm, block_address nr_bl { index_store::ptr store(new metadata_index_store(tm)); checked_space_map::ptr sm(new sm_disk(store, tm)); + + if (nr_blocks > MAX_METADATA_BLOCKS) { + cerr << "truncating metadata device to " << MAX_METADATA_BLOCKS << " 4k blocks\n"; + nr_blocks = MAX_METADATA_BLOCKS; + } sm->extend(nr_blocks); sm->commit(); return create_careful_alloc_sm( diff --git a/persistent-data/space-maps/disk_structures.h b/persistent-data/space-maps/disk_structures.h index 1429d36..0a57e61 100644 --- a/persistent-data/space-maps/disk_structures.h +++ b/persistent-data/space-maps/disk_structures.h @@ -61,6 +61,7 @@ namespace persistent_data { }; unsigned const MAX_METADATA_BITMAPS = 255; + unsigned const MAX_METADATA_BLOCKS = (255 * ((1 << 14) - 64)); unsigned const ENTRIES_PER_BYTE = 4; struct metadata_index {