Skip to content

Commit

Permalink
rbd: bench should flush prior to starting a test
Browse files Browse the repository at this point in the history
For the new read-based bench tests, flushing prior to the start of the test
will result in the exclusive lock being acquired and the object map being
utilized.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
  • Loading branch information
Jason Dillaman committed Oct 23, 2017
1 parent a878eca commit e215a82
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/tools/rbd/action/Bench.cc
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,12 @@ int do_bench(librbd::Image& image, io_type_t io_type,
return -EINVAL;
}

int r = image.flush();
if (r < 0 && (r != -EROFS || io_type != IO_TYPE_READ)) {
std::cerr << "rbd: failed to flush: " << cpp_strerror(r) << std::endl;
return r;
}

rbd_bencher b(&image, io_type, io_size);

std::cout << "bench "
Expand Down Expand Up @@ -316,10 +322,13 @@ int do_bench(librbd::Image& image, io_type_t io_type,
}
}
b.wait_for(0);
int r = image.flush();
if (r < 0) {
std::cerr << "Error flushing data at the end: " << cpp_strerror(r)
<< std::endl;

if (io_type != IO_TYPE_READ) {
r = image.flush();
if (r < 0) {
std::cerr << "rbd: failed to flush at the end: " << cpp_strerror(r)
<< std::endl;
}
}

utime_t now = ceph_clock_now();
Expand Down

0 comments on commit e215a82

Please sign in to comment.