[thinp_*] Make mtree_ref_counter derive from ref_counter.

Slight performance hit, but I'd rather everything was derived
from ref_counter.

Also implement it!  Not sure why this wasn't done before.
This commit is contained in:
Joe Thornber 2020-04-08 12:24:37 +01:00
parent ed22bfcdda
commit 0098803345
2 changed files with 14 additions and 5 deletions

View File

@ -70,13 +70,21 @@ namespace thin_provisioning {
}
void
mtree_ref_counter::inc(block_address b)
mtree_ref_counter::set(block_address const &b, uint32_t rc)
{
tm_.get_sm()->set_count(b, rc);
}
void
mtree_ref_counter::dec(block_address b)
mtree_ref_counter::inc(block_address const &b)
{
tm_.get_sm()->inc(b);
}
void
mtree_ref_counter::dec(block_address const &b)
{
tm_.get_sm()->dec(b);
}
//--------------------------------

View File

@ -43,12 +43,13 @@ namespace thin_provisioning {
static void pack(value_type const &value, disk_type &disk);
};
class mtree_ref_counter {
class mtree_ref_counter final : public ref_counter<block_address> {
public:
mtree_ref_counter(transaction_manager &tm);
void inc(block_address b);
void dec(block_address b);
void set(block_address const &b, uint32_t rc);
void inc(block_address const &b);
void dec(block_address const &b);
private:
transaction_manager &tm_;