From d4b876045bdcc87b1f2185fbb98c9c770a341f92 Mon Sep 17 00:00:00 2001 From: Dariusz Stojaczyk Date: Sun, 24 Jun 2018 22:10:51 +0200 Subject: [PATCH] ioat/verify: cleanup 8-byte alignment code Change-Id: I5ec70e895541ff63c369b85243fff9eeec9112d2 Signed-off-by: Dariusz Stojaczyk Reviewed-on: https://review.gerrithub.io/416657 Tested-by: SPDK Automated Test System Reviewed-by: Daniel Verkamp Reviewed-by: Ben Walker Reviewed-by: Shuhei Matsumoto --- examples/ioat/verify/verify.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/examples/ioat/verify/verify.c b/examples/ioat/verify/verify.c index cf32c0e3b..34122f3a3 100644 --- a/examples/ioat/verify/verify.c +++ b/examples/ioat/verify/verify.c @@ -37,6 +37,7 @@ #include "spdk/env.h" #include "spdk/queue.h" #include "spdk/string.h" +#include "spdk/util.h" #define SRC_BUFFER_SIZE (512*1024) @@ -127,7 +128,6 @@ static void prepare_ioat_task(struct thread_entry *thread_entry, struct ioat_tas int len; uintptr_t src_offset; uintptr_t dst_offset; - int num_ddwords; uint64_t fill_pattern; if (ioat_task->type == IOAT_FILL_TYPE) { @@ -135,11 +135,7 @@ static void prepare_ioat_task(struct thread_entry *thread_entry, struct ioat_tas fill_pattern = fill_pattern << 32 | rand_r(&seed); /* ensure that the length of memset block is 8 Bytes aligned */ - num_ddwords = (rand_r(&seed) % SRC_BUFFER_SIZE) / 8; - len = num_ddwords * 8; - if (len < 8) { - len = 8; - } + len = 8 + ((rand_r(&seed) % (SRC_BUFFER_SIZE - 8)) & ~0x7); dst_offset = rand_r(&seed) % (SRC_BUFFER_SIZE - len); ioat_task->fill_pattern = fill_pattern; } else {