Merge branch '2015-08-19-thin-show-duplicates' into merge-thin-ls

Conflicts:
	Makefile.in
	block-cache/block_cache.h
	main.cc
	thin-provisioning/commands.h
This commit is contained in:
Joe Thornber
2016-02-24 14:31:51 +00:00
25 changed files with 1477 additions and 25 deletions

View File

@ -223,6 +223,7 @@ namespace persistent_data {
unsigned max_concurrent_blocks,
mode m,
bool excl)
// FIXME: * BlockSize ?
: fd_(open_or_create_block_file(path, nr_blocks * BlockSize, m, excl)),
bc_(fd_, BlockSize >> SECTOR_SHIFT, nr_blocks, 1024u * 1024u * 16),
superblock_ref_count_(0)

View File

@ -12,7 +12,7 @@ using namespace base;
//----------------------------------------------------------------
persistent_data::block_address
persistent_data::get_nr_blocks(string const &path)
persistent_data::get_nr_blocks(string const &path, sector_t block_size)
{
using namespace persistent_data;
@ -24,7 +24,7 @@ persistent_data::get_nr_blocks(string const &path)
throw runtime_error("Couldn't stat dev path");
if (S_ISREG(info.st_mode) && info.st_size)
nr_blocks = div_up<block_address>(info.st_size, MD_BLOCK_SIZE);
nr_blocks = div_up<block_address>(info.st_size, block_size);
else if (S_ISBLK(info.st_mode)) {
// To get the size of a block device we need to
@ -39,7 +39,7 @@ persistent_data::get_nr_blocks(string const &path)
throw runtime_error("ioctl BLKGETSIZE64 failed");
}
::close(fd);
nr_blocks = div_down<block_address>(nr_blocks, MD_BLOCK_SIZE);
nr_blocks = div_down<block_address>(nr_blocks, block_size);
} else
// FIXME: needs a better message
throw runtime_error("bad path");

View File

@ -9,7 +9,7 @@
// FIXME: move to a different unit
namespace persistent_data {
persistent_data::block_address get_nr_blocks(string const &path);
persistent_data::block_address get_nr_blocks(string const &path, sector_t block_size = MD_BLOCK_SIZE);
block_manager<>::ptr open_bm(std::string const &dev_path,
block_manager<>::mode m, bool excl = true);