[metadata space map] Restrict space map size
Previously it would crash with v. large metadata areas.
This commit is contained in:
parent
125cec0193
commit
c6844dc7e6
@ -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));
|
index_store::ptr store(new metadata_index_store(tm));
|
||||||
checked_space_map::ptr sm(new sm_disk(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->extend(nr_blocks);
|
||||||
sm->commit();
|
sm->commit();
|
||||||
return create_careful_alloc_sm(
|
return create_careful_alloc_sm(
|
||||||
|
@ -61,6 +61,7 @@ namespace persistent_data {
|
|||||||
};
|
};
|
||||||
|
|
||||||
unsigned const MAX_METADATA_BITMAPS = 255;
|
unsigned const MAX_METADATA_BITMAPS = 255;
|
||||||
|
unsigned const MAX_METADATA_BLOCKS = (255 * ((1 << 14) - 64));
|
||||||
unsigned const ENTRIES_PER_BYTE = 4;
|
unsigned const ENTRIES_PER_BYTE = 4;
|
||||||
|
|
||||||
struct metadata_index {
|
struct metadata_index {
|
||||||
|
Loading…
Reference in New Issue
Block a user