[thin_pool] Encapsulate metadata into the pool class

This commit is contained in:
Ming-Hung Tsai 2020-05-31 01:18:45 +08:00
parent 5810846409
commit 0b058a2850
2 changed files with 17 additions and 3 deletions

View File

@ -104,9 +104,20 @@ thin::set_mapped_blocks(block_address count)
//-------------------------------- //--------------------------------
thin_pool::thin_pool(metadata::ptr md) thin_pool::thin_pool(block_manager::ptr bm)
: md_(md)
{ {
md_ = metadata::ptr(new metadata(bm, true));
}
thin_pool::thin_pool(block_manager::ptr bm,
sector_t data_block_size,
block_address nr_data_blocks)
{
md_ = metadata::ptr(new metadata(bm,
metadata::CREATE,
data_block_size,
nr_data_blocks));
md_->commit();
} }
thin_pool::~thin_pool() thin_pool::~thin_pool()

View File

@ -58,7 +58,10 @@ namespace thin_provisioning {
public: public:
typedef std::shared_ptr<thin_pool> ptr; typedef std::shared_ptr<thin_pool> ptr;
thin_pool(metadata::ptr md); thin_pool(block_manager::ptr bm);
thin_pool(block_manager::ptr bm,
sector_t data_block_size,
block_address nr_data_blocks);
~thin_pool(); ~thin_pool();
void create_thin(thin_dev_t dev); void create_thin(thin_dev_t dev);