]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd: avoid overflow of ios and clarify io-size limit for bench 42802/head
authorhaoyixing <haoyixing@kuaishou.com>
Mon, 16 Aug 2021 10:55:24 +0000 (18:55 +0800)
committerhaoyixing <haoyixing@kuaishou.com>
Tue, 24 Aug 2021 02:28:50 +0000 (10:28 +0800)
When doing rbd bench, we record done ios to print progress, current it's unsigned.
Suppose we do a bench of io-size 512B and io-total 4T, that means a total number of
8G ios which causes an overflow.
And we don't support io-size greater than 4G, so change help message.

Signed-off-by: haoyixing <haoyixing@kuaishou.com>
src/test/cli/rbd/help.t
src/tools/rbd/action/Bench.cc

index 3f4c54377873c1cb825fddfd402f30a847972cc3..22362eb806a1ed0cae38781f2ba35a6a38a06b19 100644 (file)
     -p [ --pool ] arg    pool name
     --namespace arg      namespace name
     --image arg          image name
-    --io-size arg        IO size (in B/K/M/G/T) [default: 4K]
+    --io-size arg        IO size (in B/K/M/G) (< 4G) [default: 4K]
     --io-threads arg     ios in flight [default: 16]
     --io-total arg       total size for IO (in B/K/M/G/T) [default: 1G]
     --io-pattern arg     IO pattern (rand, seq, or full-seq) [default: seq]
index 6d0e2cff8f33d006c2810b3fc2e16961b9636119..061a76d3332902a9a8310877311c06e3d0e306b7 100644 (file)
@@ -265,7 +265,7 @@ int do_bench(librbd::Image& image, io_type_t io_type,
 
   coarse_mono_time start = coarse_mono_clock::now();
   std::chrono::duration<double> last = std::chrono::duration<double>::zero();
-  unsigned ios = 0;
+  uint64_t ios = 0;
 
   std::vector<uint64_t> thread_offset;
   uint64_t i;
@@ -389,7 +389,7 @@ int do_bench(librbd::Image& image, io_type_t io_type,
       std::cout.width(5);
       std::cout << (int)elapsed.count();
       std::cout.width(10);
-      std::cout << (int)(ios - io_threads);
+      std::cout << ios - io_threads;
       std::cout.width(10);
       std::cout << boost::accumulators::rolling_sum(ios_acc) / time_sum;
       std::cout.width(10);
@@ -438,7 +438,7 @@ void add_bench_common_options(po::options_description *positional,
   at::add_image_spec_options(positional, options, at::ARGUMENT_MODIFIER_NONE);
 
   options->add_options()
-    ("io-size", po::value<Size>(), "IO size (in B/K/M/G/T) [default: 4K]")
+    ("io-size", po::value<Size>(), "IO size (in B/K/M/G) (< 4G) [default: 4K]")
     ("io-threads", po::value<uint32_t>(), "ios in flight [default: 16]")
     ("io-total", po::value<Size>(), "total size for IO (in B/K/M/G/T) [default: 1G]")
     ("io-pattern", po::value<IOPattern>(), "IO pattern (rand, seq, or full-seq) [default: seq]")