Skip to content

Commit b02ee38

Browse files
committed
verify: add --trim_verify_errror to mask trimmed error
For example, in io_uring_cmd with nvme cmd_type, trimmed offset might return NVMe status code to represent the given offsets are unmapped. In this case, failure might be expected. This patch added a new option just like the other trim_verify_* series to maskd the expected error value from the ioengine. Signed-off-by: Minwoo Im <minwoo.im@samsung.com>
1 parent 904f718 commit b02ee38

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

options.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3529,6 +3529,16 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
35293529
.category = FIO_OPT_C_IO,
35303530
.group = FIO_OPT_G_TRIM,
35313531
},
3532+
{
3533+
.name = "trim_verify_error",
3534+
.lname = "Trim verify error",
3535+
.type = FIO_OPT_INT,
3536+
.off1 = offsetof(struct thread_options, trim_error),
3537+
.help = "Error value for trim verification",
3538+
.def = "0",
3539+
.category = FIO_OPT_C_IO,
3540+
.group = FIO_OPT_G_TRIM,
3541+
},
35323542
{
35333543
.name = "trim_backlog",
35343544
.lname = "Trim backlog",
@@ -3566,6 +3576,12 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
35663576
.type = FIO_OPT_UNSUPPORTED,
35673577
.help = "Fio does not support TRIM on your platform",
35683578
},
3579+
{
3580+
.name = "trim_verify_error",
3581+
.lname = "Trim verify error",
3582+
.type = FIO_OPT_UNSUPPORTED,
3583+
.help = "Fio does not support TRIM on your platform",
3584+
},
35693585
{
35703586
.name = "trim_backlog",
35713587
.lname = "Trim backlog",

thread_options.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,7 @@ struct thread_options {
287287
unsigned int trim_percentage;
288288
unsigned int trim_batch;
289289
unsigned int trim_zero;
290+
unsigned int trim_error;
290291
unsigned long long trim_backlog;
291292
unsigned int clat_percentiles;
292293
unsigned int slat_percentiles;
@@ -620,12 +621,14 @@ struct thread_options_pack {
620621
uint32_t trim_percentage;
621622
uint32_t trim_batch;
622623
uint32_t trim_zero;
624+
uint32_t trim_error;
623625
uint64_t trim_backlog;
624626
uint32_t clat_percentiles;
625627
uint32_t lat_percentiles;
626628
uint32_t slat_percentiles;
627629
uint32_t percentile_precision;
628630
uint32_t pad;
631+
uint32_t pad2;
629632
fio_fp64_t percentile_list[FIO_IO_U_LIST_MAX_LEN];
630633

631634
uint8_t read_iolog_file[FIO_TOP_STR_MAX];

verify.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -910,6 +910,12 @@ static int verify_zero(struct io_u *io_u)
910910

911911
static int verify_trimmed_io_u(struct thread_data *td, struct io_u *io_u)
912912
{
913+
if (td->o.trim_error) {
914+
if (td->o.trim_error == io_u->error)
915+
return 0;
916+
return EILSEQ;
917+
}
918+
913919
if (!td->o.trim_zero)
914920
return 0;
915921

0 commit comments

Comments
 (0)