diff --git a/VERSION b/VERSION index cb0c939..be14282 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.5.2 +0.5.3 diff --git a/thin-provisioning/superblock.cc b/thin-provisioning/superblock.cc index 1f54b64..32f32de 100644 --- a/thin-provisioning/superblock.cc +++ b/thin-provisioning/superblock.cc @@ -1,6 +1,7 @@ #include "persistent-data/checksum.h" #include "persistent-data/errors.h" #include "thin-provisioning/superblock.h" +#include "persistent-data/file_utils.h" using namespace thin_provisioning; using namespace superblock_detail; @@ -180,6 +181,20 @@ namespace thin_provisioning { visitor.visit(superblock_corruption(e.what())); } } + + block_address find_metadata_snap(string const &path) + { + superblock_detail::superblock sb = + read_superblock(open_bm(path, block_manager<>::READ_ONLY, false), 0); + uint64_t ms = sb.metadata_snap_; + + if (!ms) { + cerr << "no metadata snapshot found!" << endl; + exit(1); + } + + return ms; + } } //---------------------------------------------------------------- diff --git a/thin-provisioning/superblock.h b/thin-provisioning/superblock.h index f527a15..dbe733a 100644 --- a/thin-provisioning/superblock.h +++ b/thin-provisioning/superblock.h @@ -137,6 +137,9 @@ namespace thin_provisioning { void check_superblock(persistent_data::block_manager<>::ptr bm, superblock_detail::damage_visitor &visitor); + + persistent_data::block_address find_metadata_snap(string const &path); + } //---------------------------------------------------------------- diff --git a/thin-provisioning/thin_dump.cc b/thin-provisioning/thin_dump.cc index c302bd0..191acb5 100644 --- a/thin-provisioning/thin_dump.cc +++ b/thin-provisioning/thin_dump.cc @@ -39,19 +39,6 @@ struct flags { }; namespace { - block_address find_metadata_snap(string const &path) - { - superblock_detail::superblock sb = read_superblock(open_bm(path, block_manager<>::READ_ONLY, false), 0); - uint64_t ms = sb.metadata_snap_; - - if (!ms) { - cerr << "no metadata snapshot found!" << endl; - exit(1); - } - - return ms; - } - int dump_(string const &path, ostream &out, string const &format, struct flags &flags, block_address metadata_snap) { try {