From d34a683d71dc2224ae41bdff68b1ce7550efbbe0 Mon Sep 17 00:00:00 2001 From: PCzhangPC Date: Tue, 29 Aug 2017 10:22:53 +0800 Subject: [PATCH] rbd:use different logic to disturb thread's offset in bench seq test 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 --- src/tools/rbd/action/Bench.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/tools/rbd/action/Bench.cc b/src/tools/rbd/action/Bench.cc index 365593cde7ff..255aad032fe3 100644 --- a/src/tools/rbd/action/Bench.cc +++ b/src/tools/rbd/action/Bench.cc @@ -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); } -- 2.47.3