]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd:use different logic to disturb thread's offset in bench seq test 17218/head
authorPCzhangPC <pengcheng.zhang@easystack.cn>
Tue, 29 Aug 2017 02:22:53 +0000 (10:22 +0800)
committerPCzhangPC <pengcheng.zhang@easystack.cn>
Tue, 29 Aug 2017 02:22:53 +0000 (10:22 +0800)
if we do rbd bench seq test, it'better that we initial the thread's offset by dividing the image size in average, instead of using rand() function just like  what rbd bench rand test does

Signed-off-by: PCzhangPC <pengcheng.zhang@easystack.cn>
src/tools/rbd/action/Bench.cc

index 365593cde7ffa93d94ce20136640f8393c08a213..255aad032fe373aa9089460de07f47f2d16e7864 100644 (file)
@@ -221,9 +221,14 @@ int do_bench(librbd::Image& image, io_type_t io_type,
   uint64_t i;
   uint64_t start_pos;
 
-  // disturb all thread's offset, used by seq IO
+  uint64_t unit_len = size/io_size/io_threads;
+  // disturb all thread's offset
   for (i = 0; i < io_threads; i++) {
-    start_pos = (rand() % (size / io_size)) * io_size;
+    if (random) {
+      start_pos = (rand() % (size / io_size)) * io_size;
+    } else {
+      start_pos = unit_len * i * io_size;
+    }
     thread_offset.push_back(start_pos);
   }