diff options
author | Simon Rettberg | 2019-08-29 14:48:12 +0200 |
---|---|---|
committer | Simon Rettberg | 2019-08-29 14:48:12 +0200 |
commit | 8d2c5cae4bd68d7015a438ca6f1c23a02f2f8203 (patch) | |
tree | f70356d8552fd02c19c10687f69a73fc600021e6 /src/bench | |
parent | [SERVER] Speed up shutdown of integrity checker (diff) | |
download | dnbd3-8d2c5cae4bd68d7015a438ca6f1c23a02f2f8203.tar.gz dnbd3-8d2c5cae4bd68d7015a438ca6f1c23a02f2f8203.tar.xz dnbd3-8d2c5cae4bd68d7015a438ca6f1c23a02f2f8203.zip |
[BENCH] Request random blocks
Diffstat (limited to 'src/bench')
-rw-r--r-- | src/bench/connection.c | 5 | ||||
-rw-r--r-- | 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); |