Merge pull request #66 from mingnus/v0.7-devel-fix

Minor fixes for new dev-tools
This commit is contained in:
Joe Thornber 2016-08-10 17:08:25 +01:00 committed by GitHub
commit bce4acf214
7 changed files with 34 additions and 16 deletions

View File

@ -37,6 +37,8 @@ base::check_output_file_requirements(string const &path)
explain_output_file_requirements(); explain_output_file_requirements();
} }
// We only really want these checks for regular files
if (S_ISREG(info.st_mode)) {
if (!info.st_size) { if (!info.st_size) {
cerr << "Zero size output file.\n\n"; cerr << "Zero size output file.\n\n";
explain_output_file_requirements(); explain_output_file_requirements();
@ -46,6 +48,7 @@ base::check_output_file_requirements(string const &path)
cerr << "Output file too small.\n\n"; cerr << "Output file too small.\n\n";
explain_output_file_requirements(); explain_output_file_requirements();
} }
}
} }
//---------------------------------------------------------------- //----------------------------------------------------------------

View File

@ -322,7 +322,7 @@ namespace persistent_data {
maybe_pair lookup_le(key const &key) const; maybe_pair lookup_le(key const &key) const;
maybe_pair lookup_ge(key const &key) const; maybe_pair lookup_ge(key const &key) const;
void insert(key const &key, typename ValueTraits::value_type const &value); bool insert(key const &key, typename ValueTraits::value_type const &value);
void remove(key const &key); void remove(key const &key);
void set_root(block_address root); void set_root(block_address root);

View File

@ -498,7 +498,7 @@ namespace persistent_data {
} }
template <unsigned Levels, typename ValueTraits> template <unsigned Levels, typename ValueTraits>
void bool
btree<Levels, ValueTraits>:: btree<Levels, ValueTraits>::
insert(key const &key, insert(key const &key,
typename ValueTraits::value_type const &value) typename ValueTraits::value_type const &value)
@ -531,6 +531,8 @@ namespace persistent_data {
n.set_value(index, value); n.set_value(index, value);
root_ = spine.get_root(); root_ = spine.get_root();
return need_insert;
} }
template <unsigned Levels, typename ValueTraits> template <unsigned Levels, typename ValueTraits>

View File

@ -136,10 +136,9 @@ namespace {
mapping_tree_detail::block_time bt; mapping_tree_detail::block_time bt;
bt.block_ = data_block; bt.block_ = data_block;
bt.time_ = time; bt.time_ = time;
current_mapping_->insert(key, bt); current_device_details_.mapped_blocks_ +=
static_cast<uint64_t>(current_mapping_->insert(key, bt));
md_->data_sm_->inc(data_block); md_->data_sm_->inc(data_block);
current_device_details_.mapped_blocks_ += 1;
} }
private: private:

View File

@ -14,6 +14,7 @@
// with thin-provisioning-tools. If not, see // with thin-provisioning-tools. If not, see
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
#include "base/output_file_requirements.h"
#include "base/xml_utils.h" #include "base/xml_utils.h"
#include "metadata_dumper.h" #include "metadata_dumper.h"
#include "metadata.h" #include "metadata.h"
@ -261,12 +262,25 @@ thin_ll_restore_cmd::run(int argc, char **argv) {
return 1; return 1;
} }
if (!input_metadata.length() || !input.length() || !output.length()) { if (!input.length()) {
cerr << "No input/output file provided." << endl; cerr << "No input file provided." << endl;
usage(cerr); usage(cerr);
return 1; return 1;
} }
if (!input_metadata.length()) {
cerr << "No input metadata provided." << endl;
usage(cerr);
return 1;
}
if (!output.length()) {
cerr << "No output file provided." << endl;
usage(cerr);
return 1;
} else
check_output_file_requirements(output);
return low_level_restore(input_metadata, input, output, f); return low_level_restore(input_metadata, input, output, f);
} }

View File

@ -50,7 +50,7 @@ thin::lookup(block_address thin_block)
return pool_->md_->mappings_->lookup(key); return pool_->md_->mappings_->lookup(key);
} }
void bool
thin::insert(block_address thin_block, block_address data_block) thin::insert(block_address thin_block, block_address data_block)
{ {
uint64_t key[2] = {dev_, thin_block}; uint64_t key[2] = {dev_, thin_block};

View File

@ -39,7 +39,7 @@ namespace thin_provisioning {
thin_dev_t get_dev_t() const; thin_dev_t get_dev_t() const;
maybe_address lookup(block_address thin_block); maybe_address lookup(block_address thin_block);
void insert(block_address thin_block, block_address data_block); bool insert(block_address thin_block, block_address data_block);
void remove(block_address thin_block); void remove(block_address thin_block);
void set_snapshot_time(uint32_t time); void set_snapshot_time(uint32_t time);