" --read-percent percent of operations that are read\n"
" --target-throughput target throughput (in bytes)\n"
" --run-length total time (in seconds)\n"
+"CACHE POOLS OPTIONS:\n"
+" --with-clones include clones when doing flush or evict\n"
;
}
bool cleanup = true;
bool no_verify = false;
bool use_striper = false;
+ bool with_clones = false;
const char *snapname = NULL;
snap_t snapid = CEPH_NOSNAP;
std::map<std::string, std::string>::const_iterator i;
if (i != opts.end()) {
bench_write_dest |= static_cast<int>(OP_WRITE_DEST_XATTR);
}
+ i = opts.find("with-clones");
+ if (i != opts.end()) {
+ with_clones = true;
+ }
// open rados
ret = rados.init_with_context(g_ceph_context);
if (!pool_name || nargs.size() < 2)
usage_exit();
string oid(nargs[1]);
- ret = do_cache_flush(io_ctx, oid);
- if (ret < 0) {
- cerr << "error from cache-flush " << oid << ": "
- << cpp_strerror(ret) << std::endl;
- goto out;
+ if (with_clones) {
+ snap_set_t ls;
+ io_ctx.snap_set_read(LIBRADOS_SNAP_DIR);
+ ret = io_ctx.list_snaps(oid, &ls);
+ if (ret < 0) {
+ cerr << "error listing snapshots " << pool_name << "/" << oid << ": "
+ << cpp_strerror(ret) << std::endl;
+ goto out;
+ }
+ for (std::vector<clone_info_t>::iterator ci = ls.clones.begin();
+ ci != ls.clones.end(); ++ci) {
+ if (snapid != CEPH_NOSNAP && ci->cloneid > snapid)
+ break;
+ io_ctx.snap_set_read(ci->cloneid);
+ ret = do_cache_flush(io_ctx, oid);
+ if (ret < 0) {
+ cerr << "error from cache-flush " << oid << ": "
+ << cpp_strerror(ret) << std::endl;
+ goto out;
+ }
+ }
+ } else {
+ ret = do_cache_flush(io_ctx, oid);
+ if (ret < 0) {
+ cerr << "error from cache-flush " << oid << ": "
+ << cpp_strerror(ret) << std::endl;
+ goto out;
+ }
}
} else if (strcmp(nargs[0], "cache-try-flush") == 0) {
if (!pool_name || nargs.size() < 2)
usage_exit();
string oid(nargs[1]);
- ret = do_cache_try_flush(io_ctx, oid);
- if (ret < 0) {
- cerr << "error from cache-try-flush " << oid << ": "
- << cpp_strerror(ret) << std::endl;
- goto out;
+ if (with_clones) {
+ snap_set_t ls;
+ io_ctx.snap_set_read(LIBRADOS_SNAP_DIR);
+ ret = io_ctx.list_snaps(oid, &ls);
+ if (ret < 0) {
+ cerr << "error listing snapshots " << pool_name << "/" << oid << ": "
+ << cpp_strerror(ret) << std::endl;
+ goto out;
+ }
+ for (std::vector<clone_info_t>::iterator ci = ls.clones.begin();
+ ci != ls.clones.end(); ++ci) {
+ if (snapid != CEPH_NOSNAP && ci->cloneid > snapid)
+ break;
+ io_ctx.snap_set_read(ci->cloneid);
+ ret = do_cache_try_flush(io_ctx, oid);
+ if (ret < 0) {
+ cerr << "error from cache-flush " << oid << ": "
+ << cpp_strerror(ret) << std::endl;
+ goto out;
+ }
+ }
+ } else {
+ ret = do_cache_try_flush(io_ctx, oid);
+ if (ret < 0) {
+ cerr << "error from cache-flush " << oid << ": "
+ << cpp_strerror(ret) << std::endl;
+ goto out;
+ }
}
} else if (strcmp(nargs[0], "cache-evict") == 0) {
if (!pool_name || nargs.size() < 2)
usage_exit();
string oid(nargs[1]);
- ret = do_cache_evict(io_ctx, oid);
- if (ret < 0) {
- cerr << "error from cache-evict " << oid << ": "
- << cpp_strerror(ret) << std::endl;
- goto out;
+ if (with_clones) {
+ snap_set_t ls;
+ io_ctx.snap_set_read(LIBRADOS_SNAP_DIR);
+ ret = io_ctx.list_snaps(oid, &ls);
+ if (ret < 0) {
+ cerr << "error listing snapshots " << pool_name << "/" << oid << ": "
+ << cpp_strerror(ret) << std::endl;
+ goto out;
+ }
+ for (std::vector<clone_info_t>::iterator ci = ls.clones.begin();
+ ci != ls.clones.end(); ++ci) {
+ if (snapid != CEPH_NOSNAP && ci->cloneid > snapid)
+ break;
+ io_ctx.snap_set_read(ci->cloneid);
+ ret = do_cache_evict(io_ctx, oid);
+ if (ret < 0) {
+ cerr << "error from cache-flush " << oid << ": "
+ << cpp_strerror(ret) << std::endl;
+ goto out;
+ }
+ }
+ } else {
+ ret = do_cache_evict(io_ctx, oid);
+ if (ret < 0) {
+ cerr << "error from cache-flush " << oid << ": "
+ << cpp_strerror(ret) << std::endl;
+ goto out;
+ }
}
} else if (strcmp(nargs[0], "cache-flush-evict-all") == 0) {
if (!pool_name)
opts["write-dest-obj"] = "true";
} else if (ceph_argparse_flag(args, i, "--write-xattr", (char*)NULL)) {
opts["write-dest-xattr"] = "true";
+ } else if (ceph_argparse_flag(args, i, "--with-clones", (char*)NULL)) {
+ opts["with-clones"] = "true";
} else {
if (val[0] == '-')
usage_exit();