From 5dbaf8371ca8216cb223df6424af95e671f27ed6 Mon Sep 17 00:00:00 2001 From: Joe Thornber Date: Thu, 10 Oct 2013 13:08:04 +0100 Subject: [PATCH] [caching] start wiring up the discard bitset --- Makefile.in | 1 + caching/metadata.cc | 13 +++++++++++++ caching/metadata.h | 3 +++ 3 files changed, 17 insertions(+) diff --git a/Makefile.in b/Makefile.in index e8117a0..e0ce06f 100644 --- a/Makefile.in +++ b/Makefile.in @@ -239,6 +239,7 @@ CACHE_CHECK_SOURCE=\ persistent-data/hex_dump.cc \ persistent-data/lock_tracker.cc \ persistent-data/data-structures/btree.cc \ + persistent-data/data-structures/bitset.cc \ persistent-data/space_map.cc \ persistent-data/space-maps/disk.cc \ persistent-data/space-maps/recursive.cc \ diff --git a/caching/metadata.cc b/caching/metadata.cc index 49e7a4d..0f9b82f 100644 --- a/caching/metadata.cc +++ b/caching/metadata.cc @@ -52,6 +52,7 @@ metadata::commit() commit_space_map(); commit_mappings(); commit_hints(); + commit_discard_bits(); commit_superblock(); } @@ -94,6 +95,8 @@ metadata::create_metadata(block_manager<>::ptr bm) // We can't instantiate the hint array yet, since we don't know the // hint width. + + discard_bits_ = bitset::ptr(new bitset(tm_)); } void @@ -112,6 +115,10 @@ metadata::open_metadata(block_manager<>::ptr bm) hints_ = hint_array::ptr( new hint_array(tm_, sb_.policy_hint_size, sb_.hint_root, sb_.cache_blocks)); + + if (sb_.discard_root) + discard_bits_ = bitset::ptr( + new bitset(tm_, sb_.discard_root, sb_.cache_blocks)); } void @@ -133,6 +140,12 @@ metadata::commit_hints() sb_.hint_root = hints_->get_root(); } +void +metadata::commit_discard_bits() +{ + // FIXME: finish +} + void metadata::commit_superblock() { diff --git a/caching/metadata.h b/caching/metadata.h index 418d0e6..611b424 100644 --- a/caching/metadata.h +++ b/caching/metadata.h @@ -3,6 +3,7 @@ #include "persistent-data/block.h" #include "persistent-data/data-structures/array.h" +#include "persistent-data/data-structures/bitset.h" #include "persistent-data/endian_utils.h" #include "persistent-data/space-maps/disk.h" #include "persistent-data/transaction_manager.h" @@ -37,6 +38,7 @@ namespace caching { checked_space_map::ptr metadata_sm_; mapping_array::ptr mappings_; hint_array::ptr hints_; + bitset::ptr discard_bits_; private: void init_superblock(); @@ -47,6 +49,7 @@ namespace caching { void commit_space_map(); void commit_mappings(); void commit_hints(); + void commit_discard_bits(); void commit_superblock(); }; };