[PATCH 4/4] randtrimwrite: fix corner case with variable block sizes

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

 



When we have variable block sizes it's possible to finish a trim + write
pair and then have the next (smaller length) trim operation have a
different start offset but the same end offset as the previous pair of
trim and write operations. This would fool fio into believing that it
had already completed a trim + write pair when it actually completed
only the trim.

Resolve this problem by comparing start offsets instead of end offsets.

Signed-off-by: Vincent Fu <vincent.fu@xxxxxxxxxxx>
---
 io_u.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/io_u.c b/io_u.c
index 0a70f72a..a9f0ad0f 100644
--- a/io_u.c
+++ b/io_u.c
@@ -529,7 +529,7 @@ static int get_next_offset(struct thread_data *td, struct io_u *io_u,
 	 */
 	if ((td_randtrimwrite(td) && ddir == DDIR_TRIM) &&
 	     fio_unlikely(f->last_start[DDIR_TRIM] == io_u->offset))
-		f->last_pos[DDIR_WRITE]--;
+		f->last_start[DDIR_WRITE]--;
 
 	io_u->verify_offset = io_u->offset;
 	return 0;
@@ -798,7 +798,7 @@ static void set_rw_ddir(struct thread_data *td, struct io_u *io_u)
 
 	if (td_trimwrite(td)) {
 		struct fio_file *f = io_u->file;
-		if (f->last_pos[DDIR_WRITE] == f->last_pos[DDIR_TRIM])
+		if (f->last_start[DDIR_WRITE] == f->last_start[DDIR_TRIM])
 			ddir = DDIR_TRIM;
 		else
 			ddir = DDIR_WRITE;
-- 
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