Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rw=randread:N and rw_sequencer=sequential, do not generate random offset every N I/Os from the beginning #1223

Closed
1 task done
Stan-He opened this issue Apr 25, 2021 · 2 comments

Comments

@Stan-He
Copy link

Stan-He commented Apr 25, 2021

Please acknowledge the following before creating a ticket

Description of the bug:
when using the config rw=randread:8 and rw_sequencer=sequential
I expect fio will generate 8 sequential I/O s before switch to another random offset
but at first, fio will generate only 7 sequential I/Os then switch to new random offset

After study the source code,I think the root cause may be in this function : get_next_offset
and I attach the diff patch here, please check

diff --git a/io_u.c b/io_u.c
index b421a579..9c8cb0ad 100644
--- a/io_u.c
+++ b/io_u.c
@@ -484,9 +484,9 @@ static int get_next_offset(struct thread_data *td, struct io_u *io_u,

        assert(ddir_rw(ddir));

-       if (td->o.ddir_seq_nr && !--td->ddir_seq_nr) {
+       if (td->o.ddir_seq_nr && !td->ddir_seq_nr--) {
                rw_seq_hit = 1;
-               td->ddir_seq_nr = td->o.ddir_seq_nr;
+               td->ddir_seq_nr = td->o.ddir_seq_nr-1;
        }

        if (get_next_block(td, io_u, ddir, rw_seq_hit, is_random))

Environment:
CentOS Linux release 8.0.1905 (Core)
4.18.0-80.el8.x86_64

fio version:
fio version commit 14691a4

Reproduction steps

use the jobfile below and execute with option --debug=io,random

[global]
ioengine=libaio
iodepth=8
randrepeat=0
rw=randread:8
rw_sequencer=sequential

[test]
size=1G
bs=128k
filename=/dev/nvme0n1
@sitsofe
Copy link
Collaborator

sitsofe commented May 19, 2021

@Stan-He This fix looks correct - would you like to work up a pull request?

@ankit-sam
Copy link
Contributor

Hi @Stan-He, I was looking at this issue and saw that you mentioned

I expect fio will generate 8 sequential I/O s before switch to another random offset
but at first, fio will generate only 7 sequential I/Os then switch to new random offset

As per the fio man page for rw_sequencer=sequential (fio.1)

If you append e.g. 8 to randread, you would get a new random offset for every 8 I/Os. The result would be a seek for only every 8 I/Os, instead of for every I/O.

It seems to me that this behavior is correct, we are getting a random offset for every 8 I/O's i.e. 1 random offset and 7
sequential offset. It also mentions that fio will seek for random offset once in every 8 I/O's.
Perhaps we should phrase this in a better way to avoid any confusion.

fiotestbot pushed a commit to fiotestbot/fio that referenced this issue Jan 10, 2023
Update man page clarifying the usage of rw_sequencer=sequential

Fixes: axboe#1223

Signed-off-by: Ankit Kumar <ankit.kumar@samsung.com>
fiotestbot pushed a commit to fiotestbot/fio that referenced this issue Jan 11, 2023
Update man page clarifying the usage of rw_sequencer=sequential
Added few examples explaining the offset generation for rw_sequencer.

Fixes: axboe#1223

Signed-off-by: Ankit Kumar <ankit.kumar@samsung.com>
@axboe axboe closed this as completed in 537e0d2 Jan 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants