From: Alexey Dobriyan <adobriyan@gmail.com>
To: axboe@kernel.dk
Cc: adobriyan@gmail.com, damien.lemoal@wdc.com, fio@vger.kernel.org
Subject: [PATCH 7/7] verify: decouple seed generation from buffer fill
Date: Thu, 30 Apr 2020 15:40:50 +0300 [thread overview]
Message-ID: <20200430124050.20146-7-adobriyan@gmail.com> (raw)
In-Reply-To: <20200430124050.20146-1-adobriyan@gmail.com>
Nicer this way and less LOC.
Signed-off-by: Alexey Dobriyan (SK hynix) <adobriyan@gmail.com>
---
backend.c | 6 ------
verify.c | 20 +++++++-------------
2 files changed, 7 insertions(+), 19 deletions(-)
diff --git a/backend.c b/backend.c
index feb34e51..452975cf 100644
--- a/backend.c
+++ b/backend.c
@@ -1006,12 +1006,6 @@ static void do_io(struct thread_data *td, uint64_t *bytes_done)
if (td->o.verify != VERIFY_NONE && io_u->ddir == DDIR_READ &&
((io_u->flags & IO_U_F_VER_LIST) || !td_rw(td))) {
- if (!td->o.verify_pattern_bytes) {
- io_u->rand_seed = __rand(&td->verify_state);
- if (sizeof(int) != sizeof(long *))
- io_u->rand_seed *= __rand(&td->verify_state);
- }
-
if (verify_state_should_stop(td, io_u)) {
put_io_u(td, io_u);
break;
diff --git a/verify.c b/verify.c
index cf299ebf..b7fa6693 100644
--- a/verify.c
+++ b/verify.c
@@ -46,15 +46,6 @@ static void __fill_buffer(struct thread_options *o, uint64_t seed, void *p,
__fill_random_buf_percentage(seed, p, o->compress_percentage, len, len, o->buffer_pattern, o->buffer_pattern_bytes);
}
-static uint64_t fill_buffer(struct thread_data *td, void *p,
- unsigned int len)
-{
- struct frand_state *fs = &td->verify_state;
- struct thread_options *o = &td->o;
-
- return fill_random_buf_percentage(fs, p, o->compress_percentage, len, len, o->buffer_pattern, o->buffer_pattern_bytes);
-}
-
void fill_verify_pattern(struct thread_data *td, void *p, unsigned int len,
struct io_u *io_u, uint64_t seed, int use_seed)
{
@@ -63,10 +54,13 @@ void fill_verify_pattern(struct thread_data *td, void *p, unsigned int len,
if (!o->verify_pattern_bytes) {
dprint(FD_VERIFY, "fill random bytes len=%u\n", len);
- if (use_seed)
- __fill_buffer(o, seed, p, len);
- else
- io_u->rand_seed = fill_buffer(td, p, len);
+ if (!use_seed) {
+ seed = __rand(&td->verify_state);
+ if (sizeof(int) != sizeof(long *))
+ seed *= (unsigned long)__rand(&td->verify_state);
+ }
+ io_u->rand_seed = seed;
+ __fill_buffer(o, seed, p, len);
return;
}
--
2.26.2
next prev parent reply other threads:[~2020-04-30 12:40 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-30 12:40 [PATCH 1/7] zbd: bump ZBD_MAX_OPEN_ZONES Alexey Dobriyan
2020-04-30 12:40 ` [PATCH 2/7] zbd: don't lock zones outside working area Alexey Dobriyan
2020-05-01 1:27 ` Damien Le Moal
2020-04-30 12:40 ` [PATCH 3/7] zbd: introduce per-device "max_open_zones" limit Alexey Dobriyan
2020-05-01 1:34 ` Damien Le Moal
2020-05-01 18:52 ` Alexey Dobriyan
2020-05-04 1:41 ` Damien Le Moal
2020-05-04 12:15 ` Alexey Dobriyan
2020-04-30 12:40 ` [PATCH 4/7] zbd: make zbd_info->mutex non-recursive Alexey Dobriyan
2020-05-01 1:36 ` Damien Le Moal
2020-04-30 12:40 ` [PATCH 5/7] zbd: consolidate zone mutex initialisation Alexey Dobriyan
2020-05-01 1:44 ` Damien Le Moal
2020-05-01 18:37 ` Alexey Dobriyan
2020-05-02 4:39 ` Damien Le Moal
2020-04-30 12:40 ` [PATCH 6/7] fio: parse "io_size=1%" Alexey Dobriyan
2020-05-01 1:51 ` Damien Le Moal
2020-05-01 6:00 ` Sitsofe Wheeler
2020-04-30 12:40 ` Alexey Dobriyan [this message]
2020-05-01 1:59 ` [PATCH 7/7] verify: decouple seed generation from buffer fill Damien Le Moal
2020-05-01 1:19 ` [PATCH 1/7] zbd: bump ZBD_MAX_OPEN_ZONES Damien Le Moal
2020-05-01 14:47 ` Alexey Dobriyan
2020-05-02 4:37 ` Damien Le Moal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200430124050.20146-7-adobriyan@gmail.com \
--to=adobriyan@gmail.com \
--cc=axboe@kernel.dk \
--cc=damien.lemoal@wdc.com \
--cc=fio@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox