[block-cache] Create just one noop_validator

No need to create a separate one for each block.
This commit is contained in:
Joe Thornber 2014-08-21 14:20:36 +01:00
parent 4799becb01
commit b5a9cd6043
2 changed files with 5 additions and 2 deletions

View File

@ -403,7 +403,7 @@ block_cache::new_block(block_address index)
b->error_ = 0; b->error_ = 0;
b->flags_ = 0; b->flags_ = 0;
b->v_ = validator::ptr(new noop_validator); b->v_ = noop_validator_;
b->index_ = index; b->index_ = index;
setup_control_block(*b); setup_control_block(*b);
@ -450,7 +450,8 @@ block_cache::block_cache(int fd, sector_t block_size, uint64_t on_disk_blocks, s
write_zeroes_(0), write_zeroes_(0),
write_hits_(0), write_hits_(0),
write_misses_(0), write_misses_(0),
prefetches_(0) prefetches_(0),
noop_validator_(new noop_validator())
{ {
int r; int r;
unsigned nr_cache_blocks = calc_nr_cache_blocks(mem, block_size); unsigned nr_cache_blocks = calc_nr_cache_blocks(mem, block_size);

View File

@ -214,6 +214,8 @@ namespace bcache {
unsigned write_hits_; unsigned write_hits_;
unsigned write_misses_; unsigned write_misses_;
unsigned prefetches_; unsigned prefetches_;
validator::ptr noop_validator_;
}; };
} }