From 8d2c5cae4bd68d7015a438ca6f1c23a02f2f8203 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Thu, 29 Aug 2019 14:48:12 +0200 Subject: [BENCH] Request random blocks --- src/bench/connection.c | 5 +++-- src/bench/connection.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/bench/connection.c b/src/bench/connection.c index 498bc62..26be440 100644 --- a/src/bench/connection.c +++ b/src/bench/connection.c @@ -41,7 +41,7 @@ bool connection_init_n_times( const char *lowerImage, const uint16_t rid, int ntimes, - int blockSize, + uint64_t blockSize, BenchCounters* counters ) { for (int run_i = 0; run_i < ntimes; ++run_i) { @@ -96,7 +96,8 @@ bool connection_init_n_times( } else if ( rid != 0 && rid != remoteRid ) { counters->fails++; logadd( LOG_ERROR, "rid mismatch" ); - } else if ( !dnbd3_get_block( sock, run_i * blockSize, blockSize, 0, 0 ) ) { + //} else if ( !dnbd3_get_block( sock, run_i * blockSize, blockSize, 0, 0 ) ) { + } else if ( !dnbd3_get_block( sock, (((uint64_t)rand()) << 16 + rand()) % (remoteSize - blockSize), blockSize, 0, 0 ) ) { counters->fails++; logadd( LOG_ERROR, "send: get block failed" ); } else if ( !dnbd3_get_reply( sock, &reply ) ) { diff --git a/src/bench/connection.h b/src/bench/connection.h index 69207ff..770bf0d 100644 --- a/src/bench/connection.h +++ b/src/bench/connection.h @@ -19,7 +19,7 @@ typedef struct _dnbd3_async { } dnbd3_async_t; -bool connection_init_n_times(const char *hosts, const char *image, const uint16_t rid, int ntimes, int blockSize, BenchCounters* counters); +bool connection_init_n_times(const char *hosts, const char *image, const uint16_t rid, int ntimes, uint64_t blockSize, BenchCounters* counters); bool connection_init(const char *hosts, const char *image, const uint16_t rid); -- cgit v1.2.3-55-g7522