A big raft of changes to the unit-tests
This commit is contained in:
@@ -172,7 +172,7 @@ namespace persistent_data {
|
||||
buffer<BlockSize> const &data() const;
|
||||
|
||||
protected:
|
||||
block_manager<BlockSize> const &bm_;
|
||||
block_manager<BlockSize> const *bm_;
|
||||
block_ptr block_;
|
||||
unsigned *holders_;
|
||||
};
|
||||
|
@@ -154,7 +154,7 @@ block_manager<BlockSize>::block::flush()
|
||||
template <uint32_t BlockSize>
|
||||
block_manager<BlockSize>::read_ref::read_ref(block_manager<BlockSize> const &bm,
|
||||
block_ptr b)
|
||||
: bm_(bm),
|
||||
: bm_(&bm),
|
||||
block_(b),
|
||||
holders_(new unsigned)
|
||||
{
|
||||
@@ -175,13 +175,13 @@ block_manager<BlockSize>::read_ref::~read_ref()
|
||||
{
|
||||
if (!--(*holders_)) {
|
||||
if (block_->bt_ == BT_SUPERBLOCK) {
|
||||
bm_.flush();
|
||||
bm_.cache_.put(block_);
|
||||
bm_.flush();
|
||||
bm_->flush();
|
||||
bm_->cache_.put(block_);
|
||||
bm_->flush();
|
||||
} else
|
||||
bm_.cache_.put(block_);
|
||||
bm_->cache_.put(block_);
|
||||
|
||||
bm_.tracker_.unlock(block_->location_);
|
||||
bm_->tracker_.unlock(block_->location_);
|
||||
delete holders_;
|
||||
}
|
||||
}
|
||||
@@ -196,6 +196,8 @@ block_manager<BlockSize>::read_ref::operator =(read_ref const &rhs)
|
||||
holders_ = rhs.holders_;
|
||||
(*holders_)++;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <uint32_t BlockSize>
|
||||
|
@@ -323,8 +323,10 @@ namespace {
|
||||
index_entry ie = indexes_->find_ie(index);
|
||||
|
||||
bitmap bm(tm_, ie);
|
||||
optional<unsigned> maybe_b = bm.find_free((index == begin_index) ? (begin % ENTRIES_PER_BLOCK) : 0,
|
||||
(index == end_index - 1) ? (end % ENTRIES_PER_BLOCK) : ENTRIES_PER_BLOCK);
|
||||
unsigned bit_begin = (index == begin_index) ? (begin % ENTRIES_PER_BLOCK) : 0;
|
||||
unsigned bit_end = (index == end_index - 1) ? (end % ENTRIES_PER_BLOCK) : ENTRIES_PER_BLOCK;
|
||||
|
||||
optional<unsigned> maybe_b = bm.find_free(bit_begin, bit_end);
|
||||
if (maybe_b) {
|
||||
block_address b = *maybe_b;
|
||||
indexes_->save_ie(index, bm.get_ie());
|
||||
|
Reference in New Issue
Block a user