check reopening sm disk
This commit is contained in:
parent
20cf00c078
commit
0f3931bee0
@ -129,8 +129,8 @@ namespace persistent_data {
|
|||||||
: tm_(tm),
|
: tm_(tm),
|
||||||
nr_blocks_(root.nr_blocks_),
|
nr_blocks_(root.nr_blocks_),
|
||||||
nr_allocated_(root.nr_allocated_),
|
nr_allocated_(root.nr_allocated_),
|
||||||
bitmaps_(tm_, root.bitmap_root_, typename sm_disk::index_entry_traits::ref_counter()),
|
bitmaps_(tm_, root.bitmap_root_, typename sm_disk_detail::index_entry_traits::ref_counter()),
|
||||||
ref_counts_(tm_, root.ref_count_root_, typename ref_count_traits::ref_counter()) {
|
ref_counts_(tm_, root.ref_count_root_, ref_count_traits::ref_counter()) {
|
||||||
}
|
}
|
||||||
|
|
||||||
block_address get_nr_blocks() const {
|
block_address get_nr_blocks() const {
|
||||||
|
@ -119,4 +119,28 @@ BOOST_AUTO_TEST_CASE(test_set_effects_nr_allocated)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(test_reopen)
|
||||||
|
{
|
||||||
|
unsigned char buffer[128];
|
||||||
|
|
||||||
|
{
|
||||||
|
auto sm = create_sm_disk();
|
||||||
|
for (unsigned i = 0, step = 1; i < NR_BLOCKS; i += step, step++) {
|
||||||
|
sm->inc(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOST_CHECK(sm->root_size() <= sizeof(buffer));
|
||||||
|
|
||||||
|
sm->copy_root(buffer, sizeof(buffer));
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
auto tm = create_tm();
|
||||||
|
auto sm = persistent_data::open_disk_sm<BLOCK_SIZE>(tm, buffer);
|
||||||
|
|
||||||
|
for (unsigned i = 0, step = 1; i < NR_BLOCKS; i += step, step++)
|
||||||
|
BOOST_CHECK_EQUAL(sm->get_count(i), 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------
|
//----------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user