Skip to content

Commit

Permalink
Merge pull request #10100 from fullerdj/wip-djf-16144
Browse files Browse the repository at this point in the history
tools/cephfs: Remove cephfs-data-scan tmap_upgrade

Reviewed-by: John Spray <john.spray@redhat.com>
  • Loading branch information
John Spray committed Jul 6, 2016
2 parents 835fdca + ad6cc41 commit 47d3abe
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 87 deletions.
82 changes: 0 additions & 82 deletions src/tools/cephfs/DataScan.cc
Expand Up @@ -39,8 +39,6 @@ void DataScan::usage()
<< " --force-pool: use data pool even if it is not in FSMap\n"
<< "\n"
<< " cephfs-data-scan scan_frags [--force-corrupt]\n"
<< "\n"
<< " cephfs-data-scan tmap_upgrade <metadata_pool>\n"
<< std::endl;

generic_client_usage();
Expand Down Expand Up @@ -166,54 +164,11 @@ int DataScan::main(const std::vector<const char*> &args)
continue;
}

// Trailing positional argument
if (i + 1 == args.end() && (command == "tmap_upgrade")) {
metadata_pool_name = *i;
continue;
}

// Fall through: unhandled
std::cerr << "Unknown argument '" << *i << "'" << std::endl;
return -EINVAL;
}

if (command == "tmap_upgrade") {
// Special case tmap_upgrade away from other modes, as this is a
// specialized command that will only exist in the Jewel series,
// and doesn't require the initialization of the `driver` member
// that is done below.
r = rados.connect();
if (r < 0) {
std::cerr << "couldn't connect to cluster: " << cpp_strerror(r)
<< std::endl;
return r;
}

// Initialize metadata_io from pool on command line
if (metadata_pool_name.empty()) {
std::cerr << "Metadata pool not specified" << std::endl;
usage();
return -EINVAL;
}

long metadata_pool_id = rados.pool_lookup(metadata_pool_name.c_str());
if (metadata_pool_id < 0) {
std::cerr << "Pool '" << metadata_pool_name << "' not found!" << std::endl;
return -ENOENT;
} else {
dout(4) << "pool '" << metadata_pool_name
<< "' has ID " << metadata_pool_id << dendl;
}

r = rados.ioctx_create(metadata_pool_name.c_str(), metadata_io);
if (r != 0) {
return r;
}
std::cerr << "Created ioctx for " << metadata_pool_name << std::endl;

return tmap_upgrade();
}

// If caller didn't specify a namespace, try to pick
// one if only one exists
if (fscid == FS_CLUSTER_ID_NONE) {
Expand Down Expand Up @@ -866,43 +821,6 @@ bool DataScan::valid_ino(inodeno_t ino) const
|| ino == MDS_INO_CEPH;
}

int DataScan::tmap_upgrade()
{
librados::NObjectIterator i = metadata_io.nobjects_begin();
const librados::NObjectIterator i_end = metadata_io.nobjects_end();

int overall_r = 0;

for (; i != i_end; ++i) {
const std::string oid = i->get_oid();

uint64_t inode_no = 0;
uint64_t frag_id = 0;
int r = parse_oid(oid, &inode_no, &frag_id);
if (r == -EINVAL) {
dout(10) << "Not a dirfrag: '" << oid << "'" << dendl;
continue;
} else {
// parse_oid can only do 0 or -EINVAL
assert(r == 0);
}

if (!valid_ino(inode_no)) {
dout(10) << "Not a difrag (invalid ino): '" << oid << "'" << dendl;
continue;
}

r = metadata_io.tmap_to_omap(oid, true);
dout(20) << "tmap2omap(" << oid << "): " << r << dendl;
if (r < 0) {
derr << "Error converting '" << oid << "': " << cpp_strerror(r) << dendl;
overall_r = r;
}
}

return overall_r;
}

int DataScan::scan_frags()
{
bool roots_present;
Expand Down
5 changes: 0 additions & 5 deletions src/tools/cephfs/DataScan.h
Expand Up @@ -264,11 +264,6 @@ class DataScan : public MDSUtility, public MetadataTool
*/
bool valid_ino(inodeno_t ino) const;

/**
* Invoke tmap_to_omap on all metadata pool objects
*/
int tmap_upgrade();

// Accept pools which are not in the FSMap
bool force_pool;
// Respond to decode errors by overwriting
Expand Down

0 comments on commit 47d3abe

Please sign in to comment.