[block-cache] Create just one noop_validator
No need to create a separate one for each block.
This commit is contained in:
parent
4799becb01
commit
b5a9cd6043
@ -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);
|
||||||
|
@ -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_;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user