From: Zengran Zhang Date: Tue, 17 Jul 2018 03:20:21 +0000 (+0800) Subject: tools: rados load-gen add blockalign option X-Git-Tag: v14.1.0~910^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8465c38877cc58944a0d357c6717d752fe4cc897;p=ceph.git tools: rados load-gen add blockalign option Signed-off-by: Zengran Zhang --- diff --git a/src/tools/rados/rados.cc b/src/tools/rados/rados.cc index cb4eae2742a6..2a2d437cc37c 100644 --- a/src/tools/rados/rados.cc +++ b/src/tools/rados/rados.cc @@ -233,6 +233,7 @@ void usage(ostream& out) " --read-percent percent of operations that are read\n" " --target-throughput target throughput (in bytes)\n" " --run-length total time (in seconds)\n" +" --offset-align at what boundary to align random op offsets" "CACHE POOLS OPTIONS:\n" " --with-clones include clones when doing flush or evict\n" "OMAP OPTIONS:\n" @@ -566,6 +567,7 @@ public: size_t max_ops; size_t max_backlog; size_t target_throughput; + size_t offset_align = 0; int run_length; enum { @@ -771,6 +773,9 @@ void LoadGen::gen_op(LoadGenOp *op) if (off + len > info.len) off = info.len - len; + if (offset_align) + off = p2align(off, offset_align); + op->off = off; op->len = len; @@ -1703,6 +1708,7 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts, snap_t snapid = CEPH_NOSNAP; std::map::const_iterator i; + uint64_t offset_align = 0; uint64_t min_obj_len = 0; uint64_t max_obj_len = 0; uint64_t min_op_len = 0; @@ -1942,6 +1948,12 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts, omap_key_pretty = "(binary key)"; } } + i = opts.find("offset_align"); + if (i != opts.end()) { + if (rados_sistrtoll(i, &offset_align)) { + return -EINVAL; + } + } i = opts.find("with-reference"); if (i != opts.end()) { with_reference = true; @@ -3283,6 +3295,8 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts, lg.num_objs = num_objs; if (run_length) lg.run_length = run_length; + if (offset_align) + lg.offset_align = offset_align; cout << "run length " << run_length << " seconds" << std::endl; cout << "preparing " << lg.num_objs << " objects" << std::endl; @@ -3916,6 +3930,8 @@ int main(int argc, const char **argv) opts["max-backlog"] = val; } else if (ceph_argparse_witharg(args, i, &val, "--target-throughput", (char*)NULL)) { opts["target-throughput"] = val; + } else if (ceph_argparse_witharg(args, i, &val, "--offset-align", (char*)NULL)) { + opts["offset_align"] = val; } else if (ceph_argparse_witharg(args, i, &val, "--read-percent", (char*)NULL)) { opts["read-percent"] = val; } else if (ceph_argparse_witharg(args, i, &val, "--num-objects", (char*)NULL)) {