[thinp tools] move find_metadata_snap to superblock.cc
This commit is contained in:
parent
642ae6e7c2
commit
93fb540bd4
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------
|
||||
|
@ -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);
|
||||
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user