]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd: fix bench-write 7183/head
authorSage Weil <sage@redhat.com>
Tue, 18 Aug 2015 20:05:29 +0000 (16:05 -0400)
committerLoic Dachary <ldachary@redhat.com>
Mon, 11 Jan 2016 11:03:35 +0000 (12:03 +0100)
Make each IO get a unique offset!

Signed-off-by: Sage Weil <sage@redhat.com>
(cherry picked from commit 333f3a01a9916c781f266078391c580efb81a0fc)

src/rbd.cc

index 6f5457d1461f94c9e6c942422d8e25b63d996679..e3e0e1ecb71ad2497677d03643f66aa491d07afa 100644 (file)
@@ -978,15 +978,7 @@ static int do_bench_write(librbd::Image& image, uint64_t io_size,
   for (off = 0; off < io_bytes; ) {
     b.wait_for(io_threads - 1);
     i = 0;
-    while (i < io_threads && off < io_bytes &&
-          b.start_write(io_threads, thread_offset[i], io_size, bl, op_flags)) {
-      ++i;
-      ++ios;
-      off += io_size;
-
-      ++cur_ios;
-      cur_off += io_size;
-
+    while (i < io_threads && off < io_bytes) {
       if (pattern == "rand") {
         thread_offset[i] = (rand() % (size / io_size)) * io_size;
       } else {
@@ -994,6 +986,16 @@ static int do_bench_write(librbd::Image& image, uint64_t io_size,
         if (thread_offset[i] + io_size > size)
           thread_offset[i] = 0;
       }
+
+      if (!b.start_write(io_threads, thread_offset[i], io_size, bl, op_flags))
+       break;
+
+      ++i;
+      ++ios;
+      off += io_size;
+
+      ++cur_ios;
+      cur_off += io_size;
     }
 
     utime_t now = ceph_clock_now(NULL);