Skip to contentSkip to conversation

number_ios and io_size behave differently for trimwrite

PATCH Applied Ankit Kumar 3 participants 5 messages Sep 13, 2022 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): CGME20220913105531epcas5p3576d018441951d5555544a2d5ddefab7@epcas5p3.samsung.com

#1 lore raw

cover number_ios and io_size behave differently for trimwrite

Add changes for number_ios such that we actually do trim and then writes for those number of I/O's. This will make the behaviour similar to io_size.
Update the documentation to clarify the exact behaviour for trimwrite workloads.

Ankit Kumar (1):
backend: number of ios not as expected for trimwrite

 HOWTO.rst | 6 +++++-
 backend.c | 6 ++++--
 fio.1     | 5 ++++-
 3 files changed, 13 insertions(+), 4 deletions(-)
Signature · 1 line
2.17.1
#2 lore raw

PATCH 1/1 backend: number of ios not as expected for trimwrite

number_ios should be twice for trimwrite, just like size or io_size. Update the documentation for "rw=trimwrite" to explain the changes.

---
 HOWTO.rst | 6 +++++-
 backend.c | 6 ++++--
 fio.1     | 5 ++++-
 3 files changed, 13 insertions(+), 4 deletions(-)
HOWTO.rst +5 -1
index 2c6c6dbe..924f5ed9 100644
@@ -1129,7 +1129,11 @@ I/O type
 				Random mixed reads and writes.
 		**trimwrite**
 				Sequential trim+write sequences. Blocks will be trimmed first,
-				then the same blocks will be written to.
+				then the same blocks will be written to. So if ``io_size=64K``
+				is specified, Fio will trim a total of 64K bytes and also
+				write 64K bytes on the same trimmed blocks. This behaviour
+				will be consistent with ``number_ios`` or other Fio options
+				limiting the total bytes or number of I/O's.
 
 	Fio defaults to read if the option is not specified.  For the mixed I/O
 	types, the default is to split them 50/50.  For certain types of I/O the
backend.c +4 -2
index fe614f6e..ec535bcc 100644
@@ -971,9 +971,11 @@ static void do_io(struct thread_data *td, uint64_t *bytes_done)
 		total_bytes += td->o.size;
 
 	/* In trimwrite mode, each byte is trimmed and then written, so
-	 * allow total_bytes to be twice as big */
-	if (td_trimwrite(td))
+	 * allow total_bytes or number of ios to be twice as big */
+	if (td_trimwrite(td)) {
 		total_bytes += td->total_io_size;
+		td->o.number_ios *= 2;
+	}
 
 	while ((td->o.read_iolog_file && !flist_empty(&td->io_log_list)) ||
 		(!flist_empty(&td->trim_list)) || !io_issue_bytes_exceeded(td) ||
fio.1 +4 -1
index 67d7c710..c67bd464 100644
@@ -900,7 +900,10 @@ Random mixed reads and writes.
 .TP
 .B trimwrite
 Sequential trim+write sequences. Blocks will be trimmed first,
-then the same blocks will be written to.
+then the same blocks will be written to. So if `io_size=64K' is specified,
+Fio will trim a total of 64K bytes and also write 64K bytes on the same
+trimmed blocks. This behaviour will be consistent with `number_ios' or
+other Fio options limiting the total bytes or number of I/O's.
 .RE
 .P
 Fio defaults to read if the option is not specified. For the mixed I/O
Signature · 1 line
2.17.1
Reviewed-by on v1 1/1
#3 lore raw

Re: [PATCH 1/1] backend: number of ios not as expected for trimwrite

Quoted 52 lines · Ankit Kumar

number_ios should be twice for trimwrite, just like size or io_size. Update the documentation for "rw=trimwrite" to explain the changes.

---
  HOWTO.rst | 6 +++++-
  backend.c | 6 ++++--
  fio.1     | 5 ++++-
  3 files changed, 13 insertions(+), 4 deletions(-)
HOWTO.rst +5 -1
index 2c6c6dbe..924f5ed9 100644
@@ -1129,7 +1129,11 @@ I/O type
  				Random mixed reads and writes.
  		**trimwrite**
  				Sequential trim+write sequences. Blocks will be trimmed first,
-				then the same blocks will be written to.
+				then the same blocks will be written to. So if ``io_size=64K``
+				is specified, Fio will trim a total of 64K bytes and also
+				write 64K bytes on the same trimmed blocks. This behaviour
+				will be consistent with ``number_ios`` or other Fio options
+				limiting the total bytes or number of I/O's.
 
  	Fio defaults to read if the option is not specified.  For the mixed I/O
  	types, the default is to split them 50/50.  For certain types of I/O the
backend.c +4 -2
index fe614f6e..ec535bcc 100644
@@ -971,9 +971,11 @@ static void do_io(struct thread_data *td, uint64_t *bytes_done)
  		total_bytes += td->o.size;
 
  	/* In trimwrite mode, each byte is trimmed and then written, so
-	 * allow total_bytes to be twice as big */
-	if (td_trimwrite(td))
+	 * allow total_bytes or number of ios to be twice as big */
+	if (td_trimwrite(td)) {
  		total_bytes += td->total_io_size;
+		td->o.number_ios *= 2;
+	}
 
  	while ((td->o.read_iolog_file && !flist_empty(&td->io_log_list)) ||
  		(!flist_empty(&td->trim_list)) || !io_issue_bytes_exceeded(td) ||
fio.1 +0 -0
index 67d7c710..c67bd464 100644
@@ -900,7 +900,10 @@ Random mixed reads and writes.
  .TP

fio.1 Random mixed reads and writes. · line 909

Quoted 10 lines
fio.1 +4 -1
  .B trimwrite
  Sequential trim+write sequences. Blocks will be trimmed first,
-then the same blocks will be written to.
+then the same blocks will be written to. So if `io_size=64K' is specified,
+Fio will trim a total of 64K bytes and also write 64K bytes on the same
+trimmed blocks. This behaviour will be consistent with `number_ios' or
+other Fio options limiting the total bytes or number of I/O's.
  .RE
  .P
  Fio defaults to read if the option is not specified. For the mixed I/O

This is the right behavior because io_size and number_ios should be consistent. But this will require folks who have worked around the inconsistent behavior to adjust. I'll let Jens make the final call on this one.

#4 lore raw

Re: [PATCH 1/1] backend: number of ios not as expected for trimwrite

Quoted 63 lines · Vincent Fu
Quoted 56 lines · Ankit Kumar

number_ios should be twice for trimwrite, just like size or io_size. Update the documentation for "rw=trimwrite" to explain the changes.

---
  HOWTO.rst | 6 +++++-
  backend.c | 6 ++++--
  fio.1     | 5 ++++-

  3 files changed, 13 insertions(+), 4 deletions(-)
HOWTO.rst +0 -0
index 2c6c6dbe..924f5ed9 100644
@@ -1129,7 +1129,11 @@ I/O type

                  Random mixed reads and writes.
          **trimwrite**
                  Sequential trim+write sequences. Blocks will be trimmed first, -                then the same blocks will be written to.
+                then the same blocks will be written to. So if ``io_size=64K`` +                is specified, Fio will trim a total of 64K bytes and also +                write 64K bytes on the same trimmed blocks. This behaviour +                will be consistent with ``number_ios`` or other Fio options +                limiting the total bytes or number of I/O's.
        Fio defaults to read if the option is not specified.  For the mixed I/O types, the default is to split them 50/50.  For certain types of I/O the

backend.c +4 -2
index fe614f6e..ec535bcc 100644
@@ -971,9 +971,11 @@ static void do_io(struct thread_data *td, uint64_t *bytes_done)
           total_bytes += td->o.size;
         /* In trimwrite mode, each byte is trimmed and then written, so
-     * allow total_bytes to be twice as big */
-    if (td_trimwrite(td))
+     * allow total_bytes or number of ios to be twice as big */
+    if (td_trimwrite(td)) {
           total_bytes += td->total_io_size;
+        td->o.number_ios *= 2;
+    }

        while ((td->o.read_iolog_file && !flist_empty(&td->io_log_list)) || (!flist_empty(&td->trim_list)) || !io_issue_bytes_exceeded(td) ||

fio.1 +0 -0
index 67d7c710..c67bd464 100644
@@ -900,7 +900,10 @@ Random mixed reads and writes.

  .TP
  .B trimwrite
  Sequential trim+write sequences. Blocks will be trimmed first,

fio.1 +4 -1
-then the same blocks will be written to.
+then the same blocks will be written to. So if `io_size=64K' is specified,
+Fio will trim a total of 64K bytes and also write 64K bytes on the same
+trimmed blocks. This behaviour will be consistent with `number_ios' or
+other Fio options limiting the total bytes or number of I/O's.
Quoted 3 lines

  .RE
  .P
  Fio defaults to read if the option is not specified. For the mixed I/O

This is the right behavior because io_size and number_ios should be consistent. But this will require folks who have worked around the inconsistent behavior to adjust. I'll let Jens make the final call on this one.

Quoted 1 line

For cases like this, I do still prefer to fix it up so that it's consistent.

Signature · 1 line
Jens Axboe
Applied
#5 lore raw
In reply to Ankit Kumar
Quoted 10 lines · Ankit Kumar

Add changes for number_ios such that we actually do trim and then writes for those number of I/O's. This will make the behaviour similar to io_size.
Update the documentation to clarify the exact behaviour for trimwrite workloads.

Ankit Kumar (1):
backend: number of ios not as expected for trimwrite

[...]

Applied, thanks!

[1/1] backend: number of ios not as expected for trimwrite

      commit: 08996af41b2566565cbcdee71766030a2c8ba377

Best regards,

Signature · 1 line
Jens Axboe