[PATCH 1/2] Don break too early in readwrite mode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Chana-Zaks-wdc <chana.zaks@xxxxxxx>

In readwrite mode, when io-size > size, we break too early and start
looping the addresses too soon. Instead of reset the address when
reaching size, we start looping after size/2, e.g. in a 50/50 rw. This
wrong behavior is demonstrated in the example below.

Before the fix:
size is 0x140000, io-size is 0x280000, max-address = 0xa0000 = size / 2.

./fio --debug=io --name=global --filename=/dev/mmcblk0p3 --size=1280K
--io_size=2560k --bs=128K --offset=0   --name=test1 --rw=rw| grep "complete: io_u"

io 5646 complete: io_u 0x560337a20840: off=0x60000, len=0x20000, ddir=0, file=/dev/mmcblk0p3
io 5646 complete: io_u 0x560337a20840: off=0x80000, len=0x20000, ddir=0, file=/dev/mmcblk0p3
io 5646 complete: io_u 0x560337a20840: off=0x20000, len=0x20000, ddir=1, file=/dev/mmcblk0p3
io 5646 complete: io_u 0x560337a20840: off=0x40000, len=0x20000, ddir=1, file=/dev/mmcblk0p3
io 5646 complete: io_u 0x560337a20840: off=0x60000, len=0x20000, ddir=1, file=/dev/mmcblk0p3
io 5646 complete: io_u 0x560337a20840: off=0xa0000, len=0x20000, ddir=0, file=/dev/mmcblk0p3
io 5646 complete: io_u 0x560337a20840: off=0x0,	    len=0x20000, ddir=0, file=/dev/mmcblk0p3
io 5646 complete: io_u 0x560337a20840: off=0x20000, len=0x20000, ddir=0, file=/dev/mmcblk0p3
io 5646 complete: io_u 0x560337a20840: off=0x40000, len=0x20000, ddir=0, file=/dev/mmcblk0p3
io 5646 complete: io_u 0x560337a20840: off=0x0,     len=0x20000, ddir=1, file=/dev/mmcblk0p3
Io 5646 complete: io_u 0x560337a20840: off=0x60000, len=0x20000, ddir=0, file=/dev/mmcblk0p3
io 5646 complete: io_u 0x560337a20840: off=0x80000, len=0x20000, ddir=0, file=/dev/mmcblk0p3
io 5646 complete: io_u 0x560337a20840: off=0x20000, len=0x20000, ddir=1, file=/dev/mmcblk0p3
io 5646 complete: io_u 0x560337a20840: off=0x40000, len=0x20000, ddir=1, file=/dev/mmcblk0p3
io 5646 complete: io_u 0x560337a20840: off=0x60000, len=0x20000, ddir=1, file=/dev/mmcblk0p3
io 5646 complete: io_u 0x560337a20840: off=0xa0000, len=0x20000, ddir=0, file=/dev/mmcblk0p3

After the fix max-address = 0x120000 = size – len:

io 32594 complete: io_u 0x70fc000980: off=0x0,     len=0x20000, ddir=0, file=/dev/mmcblk0p3
io 32594 complete: io_u 0x70fc000980: off=0x20000, len=0x20000, ddir=0, file=/dev/mmcblk0p3
io 32594 complete: io_u 0x70fc000980: off=0x40000, len=0x20000, ddir=0, file=/dev/mmcblk0p3
io 32594 complete: io_u 0x70fc000980: off=0x0,     len=0x20000, ddir=1, file=/dev/mmcblk0p3
io 32594 complete: io_u 0x70fc000980: off=0x60000, len=0x20000, ddir=0, file=/dev/mmcblk0p3
io 32594 complete: io_u 0x70fc000980: off=0x80000, len=0x20000, ddir=0, file=/dev/mmcblk0p3
io 32594 complete: io_u 0x70fc000980: off=0x20000, len=0x20000, ddir=1, file=/dev/mmcblk0p3
io 32594 complete: io_u 0x70fc000980: off=0x40000, len=0x20000, ddir=1, file=/dev/mmcblk0p3
io 32594 complete: io_u 0x70fc000980: off=0x60000, len=0x20000, ddir=1, file=/dev/mmcblk0p3
io 32594 complete: io_u 0x70fc000980: off=0xa0000, len=0x20000, ddir=0, file=/dev/mmcblk0p3
io 32594 complete: io_u 0x70fc000980: off=0x80000, len=0x20000, ddir=1, file=/dev/mmcblk0p3
io 32594 complete: io_u 0x70fc000980: off=0xc0000, len=0x20000, ddir=0, file=/dev/mmcblk0p3
io 32594 complete: io_u 0x70fc000980: off=0xa0000, len=0x20000, ddir=1, file=/dev/mmcblk0p3
io 32594 complete: io_u 0x70fc000980: off=0xe0000, len=0x20000, ddir=0, file=/dev/mmcblk0p3
io 32594 complete: io_u 0x70fc000980: off=0x100000,len=0x20000, ddir=0, file=/dev/mmcblk0p3
io 32594 complete: io_u 0x70fc000980: off=0x120000,len=0x20000, ddir=0, file=/dev/mmcblk0p3
io 32594 complete: io_u 0x70fc000980: off=0xc0000, len=0x20000, ddir=1, file=/dev/mmcblk0p3
io 32594 complete: io_u 0x70fc000980: off=0xe0000, len=0x20000, ddir=1, file=/dev/mmcblk0p3
io 32594 complete: io_u 0x70fc000980: off=0x0,     len=0x20000, ddir=0, file=/dev/mmcblk0p3
io 32594 complete: io_u 0x70fc000980: off=0x20000, len=0x20000, ddir=0, file=/dev/mmcblk0p3

Fixes: ac002339c382 (Fix bug with rw sequence offset and io_limit)
Signed-off-by: Chana-Zaks-wdc <chana.zaks@xxxxxxx>
---
 backend.c |  5 +++++
 io_u.c    | 11 +++++++++++
 2 files changed, 16 insertions(+)

diff --git a/backend.c b/backend.c
index fb7dc68a..fe03eab3 100644
--- a/backend.c
+++ b/backend.c
@@ -977,6 +977,11 @@ static void do_io(struct thread_data *td, uint64_t *bytes_done)
 	*/
 	if (td_write(td) && td_random(td) && td->o.norandommap)
 		total_bytes = max(total_bytes, (uint64_t) td->o.io_size);
+
+	/* Don't break too early if io_size > size */
+	if (td_rw(td) && !td_random(td))
+		total_bytes = max(total_bytes, (uint64_t)td->o.io_size);
+
 	/*
 	 * If verify_backlog is enabled, we'll run the verify in this
 	 * handler as well. For that case, we may need up to twice the
diff --git a/io_u.c b/io_u.c
index 09e5f15a..83895893 100644
--- a/io_u.c
+++ b/io_u.c
@@ -360,6 +360,17 @@ static int get_next_seq_offset(struct thread_data *td, struct fio_file *f,
 		loop_cache_invalidate(td, f);
 	}
 
+	/*
+	 * If we reach the end for a rw-io-size based run, reset us back to 0
+	 * and invalidate the cache, if we need to.
+	 */
+	if (td_rw(td) && o->io_size > o->size) {
+		if (f->last_pos[ddir] >= f->io_size + get_start_offset(td, f)) {
+			f->last_pos[ddir] = f->file_offset;
+			loop_cache_invalidate(td, f);
+		}
+        }
+
 	if (f->last_pos[ddir] < f->real_file_size) {
 		uint64_t pos;
 
-- 
2.25.1





[Index of Archives]     [Linux Kernel]     [Linux SCSI]     [Linux IDE]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux