mirror of
https://github.com/ceph/ceph
synced 2025-01-03 17:42:36 +00:00
Merge remote branch 'origin/stable'
This commit is contained in:
commit
44ca5b3f55
@ -7,7 +7,7 @@ AC_PREREQ(2.59)
|
|||||||
# NOTE: This version is _only_ used for naming the tarball. The
|
# NOTE: This version is _only_ used for naming the tarball. The
|
||||||
# VERSION define is not used by the code. It gets a version string
|
# VERSION define is not used by the code. It gets a version string
|
||||||
# from 'git describe'; see src/ceph_ver.[ch]
|
# from 'git describe'; see src/ceph_ver.[ch]
|
||||||
AC_INIT([ceph], [0.30], [ceph-devel@vger.kernel.org])
|
AC_INIT([ceph], [0.31], [ceph-devel@vger.kernel.org])
|
||||||
|
|
||||||
AC_CONFIG_SUBDIRS([src/gtest])
|
AC_CONFIG_SUBDIRS([src/gtest])
|
||||||
|
|
||||||
|
@ -1178,7 +1178,7 @@ int main(int argc, const char **argv)
|
|||||||
for (unsigned i = 0; i < per.size(); i++)
|
for (unsigned i = 0; i < per.size(); i++)
|
||||||
cout << " device " << i << ":\t" << per[i] << std::endl;
|
cout << " device " << i << ":\t" << per[i] << std::endl;
|
||||||
for (map<int,int>::iterator p = sizes.begin(); p != sizes.end(); p++)
|
for (map<int,int>::iterator p = sizes.begin(); p != sizes.end(); p++)
|
||||||
cout << " num results " << p->first << ":\t" << p->second << std::endl;
|
cout << " result size " << p->first << "x:\t" << p->second << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,10 +169,13 @@ static int get_kernel_version(int *a, int *b, int *c)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (sscanf(buf, "Linux version %d.%d.%d", a, b, c) != 3) {
|
if (sscanf(buf, "Linux version %d.%d.%d", a, b, c) != 3) {
|
||||||
derr << "get_kernel_version: failed to parse string: '"
|
if (sscanf(buf, "Linux version %d.%d", a, b) != 2) {
|
||||||
<< buf << "'" << dendl;
|
derr << "get_kernel_version: failed to parse string: '"
|
||||||
ret = EIO;
|
<< buf << "'" << dendl;
|
||||||
goto close_fd;
|
ret = EIO;
|
||||||
|
goto close_fd;
|
||||||
|
}
|
||||||
|
*c = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
dout(0) << " kernel version is " << *a <<"." << *b << "." << *c << dendl;
|
dout(0) << " kernel version is " << *a <<"." << *b << "." << *c << dendl;
|
||||||
|
@ -1464,23 +1464,9 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops,
|
|||||||
} else {
|
} else {
|
||||||
t.touch(coll, soid);
|
t.touch(coll, soid);
|
||||||
}
|
}
|
||||||
if (ssc->snapset.clones.size()) {
|
write_update_size_and_usage(ctx->new_stats, oi, ssc->snapset,
|
||||||
snapid_t newest = *ssc->snapset.clones.rbegin();
|
op.extent.offset, op.extent.length, true);
|
||||||
interval_set<uint64_t> ch;
|
|
||||||
if (op.extent.length)
|
|
||||||
ch.insert(op.extent.offset, op.extent.length);
|
|
||||||
ch.intersection_of(ssc->snapset.clone_overlap[newest]);
|
|
||||||
ssc->snapset.clone_overlap[newest].subtract(ch);
|
|
||||||
add_interval_usage(ch, ctx->new_stats);
|
|
||||||
}
|
|
||||||
if (op.extent.length && (op.extent.offset + op.extent.length > oi.size)) {
|
|
||||||
uint64_t new_size = op.extent.offset + op.extent.length;
|
|
||||||
ctx->new_stats.num_bytes += new_size - oi.size;
|
|
||||||
ctx->new_stats.num_kb += SHIFT_ROUND_UP(new_size, 10) - SHIFT_ROUND_UP(oi.size, 10);
|
|
||||||
oi.size = new_size;
|
|
||||||
}
|
|
||||||
ctx->new_stats.num_wr++;
|
|
||||||
ctx->new_stats.num_wr_kb += SHIFT_ROUND_UP(op.extent.length, 10);
|
|
||||||
maybe_created = true;
|
maybe_created = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1610,21 +1596,15 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops,
|
|||||||
{
|
{
|
||||||
bufferlist::iterator p = osd_op.data.begin();
|
bufferlist::iterator p = osd_op.data.begin();
|
||||||
|
|
||||||
if (!obs.exists)
|
if (!obs.exists) {
|
||||||
t.touch(coll, obs.oi.soid);
|
t.touch(coll, obs.oi.soid);
|
||||||
|
maybe_created = true;
|
||||||
|
}
|
||||||
t.clone_range(coll, osd_op.soid, obs.oi.soid,
|
t.clone_range(coll, osd_op.soid, obs.oi.soid,
|
||||||
op.clonerange.src_offset, op.clonerange.length, op.clonerange.offset);
|
op.clonerange.src_offset, op.clonerange.length, op.clonerange.offset);
|
||||||
// fix up accounting
|
|
||||||
uint64_t endoff = op.clonerange.offset + op.clonerange.length;
|
write_update_size_and_usage(ctx->new_stats, oi, ssc->snapset,
|
||||||
if (endoff > oi.size) {
|
op.clonerange.offset, op.clonerange.length, false);
|
||||||
info.stats.num_bytes -= oi.size;
|
|
||||||
info.stats.num_kb -= SHIFT_ROUND_UP(oi.size, 10);
|
|
||||||
oi.size = endoff;
|
|
||||||
info.stats.num_bytes += oi.size;
|
|
||||||
info.stats.num_kb += SHIFT_ROUND_UP(oi.size, 10);
|
|
||||||
}
|
|
||||||
ssc->snapset.head_exists = true;
|
|
||||||
info.stats.num_wr++;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1684,8 +1664,6 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops,
|
|||||||
string name = "_" + aname;
|
string name = "_" + aname;
|
||||||
bufferlist bl;
|
bufferlist bl;
|
||||||
bp.copy(op.xattr.value_len, bl);
|
bp.copy(op.xattr.value_len, bl);
|
||||||
if (!obs.exists) // create object if it doesn't yet exist.
|
|
||||||
t.touch(coll, soid);
|
|
||||||
t.setattr(coll, soid, name, bl);
|
t.setattr(coll, soid, name, bl);
|
||||||
ctx->new_stats.num_wr++;
|
ctx->new_stats.num_wr++;
|
||||||
}
|
}
|
||||||
@ -2224,6 +2202,29 @@ void ReplicatedPG::make_writeable(OpContext *ctx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ReplicatedPG::write_update_size_and_usage(pg_stat_t& stats, object_info_t& oi, SnapSet& ss,
|
||||||
|
uint64_t offset, uint64_t length, bool count_bytes)
|
||||||
|
{
|
||||||
|
if (ss.clones.size()) {
|
||||||
|
snapid_t newest = *ss.clones.rbegin();
|
||||||
|
interval_set<uint64_t> ch;
|
||||||
|
if (length)
|
||||||
|
ch.insert(offset, length);
|
||||||
|
ch.intersection_of(ss.clone_overlap[newest]);
|
||||||
|
ss.clone_overlap[newest].subtract(ch);
|
||||||
|
add_interval_usage(ch, stats);
|
||||||
|
}
|
||||||
|
if (length && (offset + length > oi.size)) {
|
||||||
|
uint64_t new_size = offset + length;
|
||||||
|
stats.num_bytes += new_size - oi.size;
|
||||||
|
stats.num_kb += SHIFT_ROUND_UP(new_size, 10) - SHIFT_ROUND_UP(oi.size, 10);
|
||||||
|
oi.size = new_size;
|
||||||
|
}
|
||||||
|
stats.num_wr++;
|
||||||
|
if (count_bytes)
|
||||||
|
stats.num_wr_kb += SHIFT_ROUND_UP(length, 10);
|
||||||
|
}
|
||||||
|
|
||||||
void ReplicatedPG::add_interval_usage(interval_set<uint64_t>& s, pg_stat_t& stats)
|
void ReplicatedPG::add_interval_usage(interval_set<uint64_t>& s, pg_stat_t& stats)
|
||||||
{
|
{
|
||||||
for (interval_set<uint64_t>::const_iterator p = s.begin(); p != s.end(); ++p) {
|
for (interval_set<uint64_t>::const_iterator p = s.begin(); p != s.end(); ++p) {
|
||||||
|
@ -581,6 +581,9 @@ protected:
|
|||||||
object_info_t *poi);
|
object_info_t *poi);
|
||||||
void make_writeable(OpContext *ctx);
|
void make_writeable(OpContext *ctx);
|
||||||
void log_op_stats(OpContext *ctx);
|
void log_op_stats(OpContext *ctx);
|
||||||
|
|
||||||
|
void write_update_size_and_usage(pg_stat_t& stats, object_info_t& oi, SnapSet& ss,
|
||||||
|
uint64_t offset, uint64_t length, bool count_bytes);
|
||||||
void add_interval_usage(interval_set<uint64_t>& s, pg_stat_t& st);
|
void add_interval_usage(interval_set<uint64_t>& s, pg_stat_t& st);
|
||||||
|
|
||||||
int prepare_transaction(OpContext *ctx);
|
int prepare_transaction(OpContext *ctx);
|
||||||
|
68
src/rados.cc
68
src/rados.cc
@ -38,9 +38,9 @@ using namespace librados;
|
|||||||
int rados_tool_sync(const std::map < std::string, std::string > &opts,
|
int rados_tool_sync(const std::map < std::string, std::string > &opts,
|
||||||
std::vector<const char*> &args);
|
std::vector<const char*> &args);
|
||||||
|
|
||||||
void usage()
|
void usage(ostream& out)
|
||||||
{
|
{
|
||||||
cerr << \
|
out << \
|
||||||
"usage: rados [options] [commands]\n"
|
"usage: rados [options] [commands]\n"
|
||||||
"POOL COMMANDS\n"
|
"POOL COMMANDS\n"
|
||||||
" lspools list pools\n"
|
" lspools list pools\n"
|
||||||
@ -111,6 +111,12 @@ void usage()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void usage_exit()
|
||||||
|
{
|
||||||
|
usage(cerr);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
static int do_get(IoCtx& io_ctx, const char *objname, const char *outfile, bool check_stdio)
|
static int do_get(IoCtx& io_ctx, const char *objname, const char *outfile, bool check_stdio)
|
||||||
{
|
{
|
||||||
string oid(objname);
|
string oid(objname);
|
||||||
@ -645,7 +651,7 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts,
|
|||||||
|
|
||||||
if (create_pool && !pool_name) {
|
if (create_pool && !pool_name) {
|
||||||
cerr << "--create-pool requested but pool_name was not specified!" << std::endl;
|
cerr << "--create-pool requested but pool_name was not specified!" << std::endl;
|
||||||
usage();
|
usage_exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (create_pool) {
|
if (create_pool) {
|
||||||
@ -759,7 +765,7 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts,
|
|||||||
}
|
}
|
||||||
else if (strcmp(nargs[0], "chown") == 0) {
|
else if (strcmp(nargs[0], "chown") == 0) {
|
||||||
if (!pool_name || nargs.size() < 2)
|
if (!pool_name || nargs.size() < 2)
|
||||||
usage();
|
usage_exit();
|
||||||
|
|
||||||
uint64_t new_auid = strtol(nargs[1], 0, 10);
|
uint64_t new_auid = strtol(nargs[1], 0, 10);
|
||||||
ret = io_ctx.set_auid(new_auid);
|
ret = io_ctx.set_auid(new_auid);
|
||||||
@ -771,7 +777,7 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts,
|
|||||||
}
|
}
|
||||||
else if (strcmp(nargs[0], "mapext") == 0) {
|
else if (strcmp(nargs[0], "mapext") == 0) {
|
||||||
if (!pool_name || nargs.size() < 2)
|
if (!pool_name || nargs.size() < 2)
|
||||||
usage();
|
usage_exit();
|
||||||
string oid(nargs[1]);
|
string oid(nargs[1]);
|
||||||
std::map<uint64_t,uint64_t> m;
|
std::map<uint64_t,uint64_t> m;
|
||||||
ret = io_ctx.mapext(oid, 0, -1, m);
|
ret = io_ctx.mapext(oid, 0, -1, m);
|
||||||
@ -786,7 +792,7 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts,
|
|||||||
}
|
}
|
||||||
else if (strcmp(nargs[0], "stat") == 0) {
|
else if (strcmp(nargs[0], "stat") == 0) {
|
||||||
if (!pool_name || nargs.size() < 2)
|
if (!pool_name || nargs.size() < 2)
|
||||||
usage();
|
usage_exit();
|
||||||
string oid(nargs[1]);
|
string oid(nargs[1]);
|
||||||
uint64_t size;
|
uint64_t size;
|
||||||
time_t mtime;
|
time_t mtime;
|
||||||
@ -802,7 +808,7 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts,
|
|||||||
}
|
}
|
||||||
else if (strcmp(nargs[0], "get") == 0) {
|
else if (strcmp(nargs[0], "get") == 0) {
|
||||||
if (!pool_name || nargs.size() < 3)
|
if (!pool_name || nargs.size() < 3)
|
||||||
usage();
|
usage_exit();
|
||||||
ret = do_get(io_ctx, nargs[1], nargs[2], true);
|
ret = do_get(io_ctx, nargs[1], nargs[2], true);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
cerr << "error getting " << pool_name << "/" << nargs[1] << ": " << strerror_r(-ret, buf, sizeof(buf)) << std::endl;
|
cerr << "error getting " << pool_name << "/" << nargs[1] << ": " << strerror_r(-ret, buf, sizeof(buf)) << std::endl;
|
||||||
@ -811,7 +817,7 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts,
|
|||||||
}
|
}
|
||||||
else if (strcmp(nargs[0], "put") == 0) {
|
else if (strcmp(nargs[0], "put") == 0) {
|
||||||
if (!pool_name || nargs.size() < 3)
|
if (!pool_name || nargs.size() < 3)
|
||||||
usage();
|
usage_exit();
|
||||||
ret = do_put(io_ctx, nargs[1], nargs[2], op_size, true);
|
ret = do_put(io_ctx, nargs[1], nargs[2], op_size, true);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
cerr << "error putting " << pool_name << "/" << nargs[1] << ": " << strerror_r(-ret, buf, sizeof(buf)) << std::endl;
|
cerr << "error putting " << pool_name << "/" << nargs[1] << ": " << strerror_r(-ret, buf, sizeof(buf)) << std::endl;
|
||||||
@ -820,7 +826,7 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts,
|
|||||||
}
|
}
|
||||||
else if (strcmp(nargs[0], "setxattr") == 0) {
|
else if (strcmp(nargs[0], "setxattr") == 0) {
|
||||||
if (!pool_name || nargs.size() < 4)
|
if (!pool_name || nargs.size() < 4)
|
||||||
usage();
|
usage_exit();
|
||||||
|
|
||||||
string oid(nargs[1]);
|
string oid(nargs[1]);
|
||||||
string attr_name(nargs[2]);
|
string attr_name(nargs[2]);
|
||||||
@ -839,7 +845,7 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts,
|
|||||||
}
|
}
|
||||||
else if (strcmp(nargs[0], "getxattr") == 0) {
|
else if (strcmp(nargs[0], "getxattr") == 0) {
|
||||||
if (!pool_name || nargs.size() < 3)
|
if (!pool_name || nargs.size() < 3)
|
||||||
usage();
|
usage_exit();
|
||||||
|
|
||||||
string oid(nargs[1]);
|
string oid(nargs[1]);
|
||||||
string attr_name(nargs[2]);
|
string attr_name(nargs[2]);
|
||||||
@ -856,7 +862,7 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts,
|
|||||||
cout << s << std::endl;
|
cout << s << std::endl;
|
||||||
} else if (strcmp(nargs[0], "rmxattr") == 0) {
|
} else if (strcmp(nargs[0], "rmxattr") == 0) {
|
||||||
if (!pool_name || nargs.size() < 3)
|
if (!pool_name || nargs.size() < 3)
|
||||||
usage();
|
usage_exit();
|
||||||
|
|
||||||
string oid(nargs[1]);
|
string oid(nargs[1]);
|
||||||
string attr_name(nargs[2]);
|
string attr_name(nargs[2]);
|
||||||
@ -868,7 +874,7 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts,
|
|||||||
}
|
}
|
||||||
} else if (strcmp(nargs[0], "listxattr") == 0) {
|
} else if (strcmp(nargs[0], "listxattr") == 0) {
|
||||||
if (!pool_name || nargs.size() < 2)
|
if (!pool_name || nargs.size() < 2)
|
||||||
usage();
|
usage_exit();
|
||||||
|
|
||||||
string oid(nargs[1]);
|
string oid(nargs[1]);
|
||||||
map<std::string, bufferlist> attrset;
|
map<std::string, bufferlist> attrset;
|
||||||
@ -886,7 +892,7 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts,
|
|||||||
}
|
}
|
||||||
else if (strcmp(nargs[0], "rm") == 0) {
|
else if (strcmp(nargs[0], "rm") == 0) {
|
||||||
if (!pool_name || nargs.size() < 2)
|
if (!pool_name || nargs.size() < 2)
|
||||||
usage();
|
usage_exit();
|
||||||
string oid(nargs[1]);
|
string oid(nargs[1]);
|
||||||
ret = io_ctx.remove(oid);
|
ret = io_ctx.remove(oid);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
@ -896,7 +902,7 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts,
|
|||||||
}
|
}
|
||||||
else if (strcmp(nargs[0], "create") == 0) {
|
else if (strcmp(nargs[0], "create") == 0) {
|
||||||
if (!pool_name || nargs.size() < 2)
|
if (!pool_name || nargs.size() < 2)
|
||||||
usage();
|
usage_exit();
|
||||||
string oid(nargs[1]);
|
string oid(nargs[1]);
|
||||||
ret = io_ctx.create(oid, true);
|
ret = io_ctx.create(oid, true);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
@ -907,7 +913,7 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts,
|
|||||||
|
|
||||||
else if (strcmp(nargs[0], "tmap") == 0) {
|
else if (strcmp(nargs[0], "tmap") == 0) {
|
||||||
if (nargs.size() < 3)
|
if (nargs.size() < 3)
|
||||||
usage();
|
usage_exit();
|
||||||
if (strcmp(nargs[1], "dump") == 0) {
|
if (strcmp(nargs[1], "dump") == 0) {
|
||||||
bufferlist outdata;
|
bufferlist outdata;
|
||||||
string oid(nargs[2]);
|
string oid(nargs[2]);
|
||||||
@ -934,7 +940,7 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts,
|
|||||||
else if (strcmp(nargs[1], "set") == 0 ||
|
else if (strcmp(nargs[1], "set") == 0 ||
|
||||||
strcmp(nargs[1], "create") == 0) {
|
strcmp(nargs[1], "create") == 0) {
|
||||||
if (nargs.size() < 5)
|
if (nargs.size() < 5)
|
||||||
usage();
|
usage_exit();
|
||||||
string oid(nargs[2]);
|
string oid(nargs[2]);
|
||||||
string k(nargs[3]);
|
string k(nargs[3]);
|
||||||
string v(nargs[4]);
|
string v(nargs[4]);
|
||||||
@ -951,7 +957,7 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts,
|
|||||||
int auid = 0;
|
int auid = 0;
|
||||||
__u8 crush_rule = 0;
|
__u8 crush_rule = 0;
|
||||||
if (nargs.size() < 2)
|
if (nargs.size() < 2)
|
||||||
usage();
|
usage_exit();
|
||||||
if (nargs.size() > 2) {
|
if (nargs.size() > 2) {
|
||||||
auid = strtol(nargs[2], 0, 10);
|
auid = strtol(nargs[2], 0, 10);
|
||||||
cerr << "setting auid:" << auid << std::endl;
|
cerr << "setting auid:" << auid << std::endl;
|
||||||
@ -970,7 +976,7 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts,
|
|||||||
}
|
}
|
||||||
else if (strcmp(nargs[0], "rmpool") == 0) {
|
else if (strcmp(nargs[0], "rmpool") == 0) {
|
||||||
if (nargs.size() < 2)
|
if (nargs.size() < 2)
|
||||||
usage();
|
usage_exit();
|
||||||
ret = rados.pool_delete(nargs[1]);
|
ret = rados.pool_delete(nargs[1]);
|
||||||
if (ret >= 0) {
|
if (ret >= 0) {
|
||||||
cout << "successfully deleted pool " << nargs[1] << std::endl;
|
cout << "successfully deleted pool " << nargs[1] << std::endl;
|
||||||
@ -980,7 +986,7 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts,
|
|||||||
}
|
}
|
||||||
else if (strcmp(nargs[0], "lssnap") == 0) {
|
else if (strcmp(nargs[0], "lssnap") == 0) {
|
||||||
if (!pool_name || nargs.size() != 1)
|
if (!pool_name || nargs.size() != 1)
|
||||||
usage();
|
usage_exit();
|
||||||
|
|
||||||
vector<snap_t> snaps;
|
vector<snap_t> snaps;
|
||||||
io_ctx.snap_list(&snaps);
|
io_ctx.snap_list(&snaps);
|
||||||
@ -1014,7 +1020,7 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts,
|
|||||||
|
|
||||||
else if (strcmp(nargs[0], "mksnap") == 0) {
|
else if (strcmp(nargs[0], "mksnap") == 0) {
|
||||||
if (!pool_name || nargs.size() < 2)
|
if (!pool_name || nargs.size() < 2)
|
||||||
usage();
|
usage_exit();
|
||||||
|
|
||||||
ret = io_ctx.snap_create(nargs[1]);
|
ret = io_ctx.snap_create(nargs[1]);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
@ -1027,7 +1033,7 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts,
|
|||||||
|
|
||||||
else if (strcmp(nargs[0], "rmsnap") == 0) {
|
else if (strcmp(nargs[0], "rmsnap") == 0) {
|
||||||
if (!pool_name || nargs.size() < 2)
|
if (!pool_name || nargs.size() < 2)
|
||||||
usage();
|
usage_exit();
|
||||||
|
|
||||||
ret = io_ctx.snap_remove(nargs[1]);
|
ret = io_ctx.snap_remove(nargs[1]);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
@ -1040,7 +1046,7 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts,
|
|||||||
|
|
||||||
else if (strcmp(nargs[0], "rollback") == 0) {
|
else if (strcmp(nargs[0], "rollback") == 0) {
|
||||||
if (!pool_name || nargs.size() < 3)
|
if (!pool_name || nargs.size() < 3)
|
||||||
usage();
|
usage_exit();
|
||||||
|
|
||||||
ret = io_ctx.rollback(nargs[1], nargs[2]);
|
ret = io_ctx.rollback(nargs[1], nargs[2]);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
@ -1053,7 +1059,7 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts,
|
|||||||
}
|
}
|
||||||
else if (strcmp(nargs[0], "bench") == 0) {
|
else if (strcmp(nargs[0], "bench") == 0) {
|
||||||
if (!pool_name || nargs.size() < 3)
|
if (!pool_name || nargs.size() < 3)
|
||||||
usage();
|
usage_exit();
|
||||||
int seconds = atoi(nargs[1]);
|
int seconds = atoi(nargs[1]);
|
||||||
int operation = 0;
|
int operation = 0;
|
||||||
if (strcmp(nargs[2], "write") == 0)
|
if (strcmp(nargs[2], "write") == 0)
|
||||||
@ -1063,14 +1069,14 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts,
|
|||||||
else if (strcmp(nargs[2], "rand") == 0)
|
else if (strcmp(nargs[2], "rand") == 0)
|
||||||
operation = OP_RAND_READ;
|
operation = OP_RAND_READ;
|
||||||
else
|
else
|
||||||
usage();
|
usage_exit();
|
||||||
ret = aio_bench(rados, io_ctx, operation, seconds, concurrent_ios, op_size);
|
ret = aio_bench(rados, io_ctx, operation, seconds, concurrent_ios, op_size);
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
cerr << "error during benchmark: " << ret << std::endl;
|
cerr << "error during benchmark: " << ret << std::endl;
|
||||||
}
|
}
|
||||||
else if (strcmp(nargs[0], "watch") == 0) {
|
else if (strcmp(nargs[0], "watch") == 0) {
|
||||||
if (!pool_name || nargs.size() < 2)
|
if (!pool_name || nargs.size() < 2)
|
||||||
usage();
|
usage_exit();
|
||||||
string oid(nargs[1]);
|
string oid(nargs[1]);
|
||||||
RadosWatchCtx ctx(oid.c_str());
|
RadosWatchCtx ctx(oid.c_str());
|
||||||
uint64_t cookie;
|
uint64_t cookie;
|
||||||
@ -1084,7 +1090,7 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts,
|
|||||||
}
|
}
|
||||||
else if (strcmp(nargs[0], "notify") == 0) {
|
else if (strcmp(nargs[0], "notify") == 0) {
|
||||||
if (!pool_name || nargs.size() < 3)
|
if (!pool_name || nargs.size() < 3)
|
||||||
usage();
|
usage_exit();
|
||||||
string oid(nargs[1]);
|
string oid(nargs[1]);
|
||||||
string msg(nargs[2]);
|
string msg(nargs[2]);
|
||||||
bufferlist bl;
|
bufferlist bl;
|
||||||
@ -1094,7 +1100,7 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts,
|
|||||||
cerr << "error calling notify: " << ret << std::endl;
|
cerr << "error calling notify: " << ret << std::endl;
|
||||||
} else if (strcmp(nargs[0], "load-gen") == 0) {
|
} else if (strcmp(nargs[0], "load-gen") == 0) {
|
||||||
if (!pool_name)
|
if (!pool_name)
|
||||||
usage();
|
usage_exit();
|
||||||
LoadGen lg(&rados);
|
LoadGen lg(&rados);
|
||||||
if (min_obj_len)
|
if (min_obj_len)
|
||||||
lg.min_obj_len = min_obj_len;
|
lg.min_obj_len = min_obj_len;
|
||||||
@ -1126,7 +1132,7 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts,
|
|||||||
lg.cleanup();
|
lg.cleanup();
|
||||||
} else {
|
} else {
|
||||||
cerr << "unrecognized command " << nargs[0] << std::endl;
|
cerr << "unrecognized command " << nargs[0] << std::endl;
|
||||||
usage();
|
usage_exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret)
|
if (ret)
|
||||||
@ -1136,7 +1142,7 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts,
|
|||||||
|
|
||||||
int main(int argc, const char **argv)
|
int main(int argc, const char **argv)
|
||||||
{
|
{
|
||||||
DEFINE_CONF_VARS(usage);
|
DEFINE_CONF_VARS(usage_exit);
|
||||||
vector<const char*> args;
|
vector<const char*> args;
|
||||||
argv_to_vec(argc, argv, args);
|
argv_to_vec(argc, argv, args);
|
||||||
env_to_vec(args);
|
env_to_vec(args);
|
||||||
@ -1149,7 +1155,7 @@ int main(int argc, const char **argv)
|
|||||||
std::string val;
|
std::string val;
|
||||||
for (i = args.begin(); i != args.end(); ) {
|
for (i = args.begin(); i != args.end(); ) {
|
||||||
if (ceph_argparse_flag(args, i, "-h", "--help", (char*)NULL)) {
|
if (ceph_argparse_flag(args, i, "-h", "--help", (char*)NULL)) {
|
||||||
usage();
|
usage(cout);
|
||||||
exit(0);
|
exit(0);
|
||||||
} else if (ceph_argparse_flag(args, i, "-f", "--force", (char*)NULL)) {
|
} else if (ceph_argparse_flag(args, i, "-f", "--force", (char*)NULL)) {
|
||||||
opts["force"] = "true";
|
opts["force"] = "true";
|
||||||
@ -1184,7 +1190,7 @@ int main(int argc, const char **argv)
|
|||||||
opts["num-objects"] = val;
|
opts["num-objects"] = val;
|
||||||
} else {
|
} else {
|
||||||
if (val[0] == '-')
|
if (val[0] == '-')
|
||||||
usage();
|
usage_exit();
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user