int MetaTool::show_fnode(string& ino, string& out)
{
if (ino != "0") {
- inodeno_t i_ino = conv2hexino(ino.c_str());
+ inodeno_t i_ino = std::stoull(ino.c_str(), nullptr, 0);
meta_op op(_debug, out);
meta_op::sub_op* nsop = new meta_op::sub_op(&op);
nsop->sub_op_t = meta_op::OP_SHOW_FN;
int MetaTool::amend_meta_info(string& ino, string& in, bool confirm)
{
if (ino != "0" && in != "") {
- inodeno_t i_ino = conv2hexino(ino.c_str());
+ inodeno_t i_ino = std::stoull(ino.c_str(), nullptr, 0);
meta_op op(_debug, "", in, confirm);
meta_op::sub_op* nsop = new meta_op::sub_op(&op);
nsop->sub_op_t = meta_op::OP_AMEND;
int MetaTool::list_meta_info(string& ino, string& out)
{
if (ino != "0") {
- inodeno_t i_ino = conv2hexino(ino.c_str());
+ inodeno_t i_ino = std::stoull(ino.c_str(), nullptr, 0);
meta_op op(_debug, out);
meta_op::sub_op* nsop = new meta_op::sub_op(&op);
nsop->sub_op_t = meta_op::OP_LIST;
int MetaTool::show_meta_info(string& ino, string& out)
{
if (ino != "0") {
- inodeno_t i_ino = conv2hexino(ino.c_str());
+ inodeno_t i_ino = std::stoull(ino.c_str(), nullptr, 0);
meta_op op(_debug, out);
meta_op::sub_op* nsop = new meta_op::sub_op(&op);
}
return 0;
}
-unsigned long long MetaTool::conv2hexino(const char* ino)
-{
- unsigned long long iino = 0;
- std::stringstream conv;
- conv << ino;
- conv >> iino;
- printf("convert to hexadecimal ino %s => %llx \n", ino, iino);
- return iino;
-}
int MetaTool::file_meta(meta_op &op)
{
int _amend_meta(string &k, inode_meta_t& i, const string& fn, meta_op& op);
int _show_fn(inode_meta_t& i, const string& fn);
int _amend_fn(const string& fn, bool confirm);
- static unsigned long long conv2hexino(const char* ino);
void usage();
MetaTool(bool debug=false):
_debug(debug) {}
("debug", "show debug info")
("rank,r", po::value<string>(&rank_str), "the rank of cephfs, default(0) (e.g. -r cephfs_a:0)")
("minfo", po::value<string>(&minfo), "specify metapool, datapools and rank (e.g. cephfs_metadata_a:cephfs_data_a:0)")
- ("ino,i", po::value<string>(&ino), "specify inode. e.g. 1099511627776, you can find it with cmd, 'ls -i'")
+ ("ino,i", po::value<string>(&ino), "specify inode. e.g. 1099511627776 or 0x10000000000, you can find it with cmd, 'ls -i'")
("out,o", po::value<string>(&out), "output file")
("in", po::value<string>(&in), "input file")
("yes-i-really-really-mean-it", "need by amend info")
po::options_description modeoptions("mode options");
modeoptions.add_options()
("mode", po::value<string>(&mode),
- "\tconv : convert decimal ino to hex\n" \
"\tlistc : list all obj of dir\n" \
"\tshowm : show the info of ino\n" \
"\tshowfn : show the fnode of dir\n" \
if (vm.count("help")) {
std::cout << version << std::endl;
std::cout << "usage : \n"
- << " cephfs-meta-injection <conv|listc|showm|showfn|amend|amendfn> -r <fsname:rank> -i <ino>"
+ << " cephfs-meta-injection <listc|showm|showfn|amend|amendfn> -r <fsname:rank> -i <ino>"
<< std::endl;
std::cout << "example : \n"
<< " amend info of inode(1099531628828)\n"
return 0;
}
- if (mode == "conv") {
- MetaTool::conv2hexino(ino.c_str());
- return 0;
- }
-
MetaTool mt(vm.count("debug"));
int rc = mt.init();
if (rc != 0) {