From 0dea11d90705e04a0bf049e6701984fc36f78264 Mon Sep 17 00:00:00 2001 From: Dmitry Yatsushkevich Date: Mon, 30 Mar 2015 16:48:33 -0700 Subject: [PATCH] rados cli: add preventing using --block-size with bench seq and rand Add handling of situation when '-b|--block-size' option is using with 'bench seq' or 'bench rand' which is erroneous according to the help message: -b op_size set the size of write ops for put or benchmarking Fixes: #10163 Signed-off-by: Dmitry Yatsushkevich --- src/tools/rados/rados.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/tools/rados/rados.cc b/src/tools/rados/rados.cc index 42ffa728f1316..86f0abe910757 100644 --- a/src/tools/rados/rados.cc +++ b/src/tools/rados/rados.cc @@ -1142,6 +1142,7 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts, string oloc, target_oloc, nspace, target_nspace; int concurrent_ios = 16; unsigned op_size = default_op_size; + bool block_size_specified = false; bool cleanup = true; const char *snapname = NULL; snap_t snapid = CEPH_NOSNAP; @@ -1213,6 +1214,7 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts, if (rados_sistrtoll(i, &op_size)) { return -EINVAL; } + block_size_specified = true; } i = opts.find("snap"); if (i != opts.end()) { @@ -2260,6 +2262,12 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts, operation = OP_RAND_READ; else usage_exit(); + if (block_size_specified && (operation != OP_WRITE)){ + cerr << "-b|--block_size option can be used only with `write' bench test" + << std::endl; + ret = -EINVAL; + goto out; + } RadosBencher bencher(g_ceph_context, rados, io_ctx); bencher.set_show_time(show_time); ret = bencher.aio_bench(operation, seconds, num_objs, -- 2.39.5