From: PCzhangPC Date: Tue, 29 Aug 2017 02:22:53 +0000 (+0800) Subject: rbd:use different logic to disturb thread's offset in bench seq test X-Git-Tag: v13.0.1~1012^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d34a683d71dc2224ae41bdff68b1ce7550efbbe0;p=ceph.git 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 --- 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); }