From b5a9cd6043477cecb7d2521e0eefaa61de084e5d Mon Sep 17 00:00:00 2001 From: Joe Thornber Date: Thu, 21 Aug 2014 14:20:36 +0100 Subject: [PATCH] [block-cache] Create just one noop_validator No need to create a separate one for each block. --- block-cache/block_cache.cc | 5 +++-- block-cache/block_cache.h | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/block-cache/block_cache.cc b/block-cache/block_cache.cc index 3b44601..5bb9bfe 100644 --- a/block-cache/block_cache.cc +++ b/block-cache/block_cache.cc @@ -403,7 +403,7 @@ block_cache::new_block(block_address index) b->error_ = 0; b->flags_ = 0; - b->v_ = validator::ptr(new noop_validator); + b->v_ = noop_validator_; b->index_ = index; 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_hits_(0), write_misses_(0), - prefetches_(0) + prefetches_(0), + noop_validator_(new noop_validator()) { int r; unsigned nr_cache_blocks = calc_nr_cache_blocks(mem, block_size); diff --git a/block-cache/block_cache.h b/block-cache/block_cache.h index 5cf9b27..4bc6667 100644 --- a/block-cache/block_cache.h +++ b/block-cache/block_cache.h @@ -214,6 +214,8 @@ namespace bcache { unsigned write_hits_; unsigned write_misses_; unsigned prefetches_; + + validator::ptr noop_validator_; }; }