From f26af3ddd7becec1b296a67a4b80cf7d19e19928 Mon Sep 17 00:00:00 2001 From: Minwoo Im Date: Wed, 15 May 2024 14:46:04 +0900 Subject: [PATCH] options: Add support hex value to ignore_error The 'ignore_error=str' option expects either the name or the numeric value of the errno in string format. With recent additions like io_uring_cmd ioengine, it's been possible to check not only errno values but also the actual status values provided by the storage device. Given that most status codes in NVMe specs are represented in hexadecimal, specifying error values in hexadecimal is also useful to ignore some errors. For example, DULBE (Deallocated or Unwritten Logical Block Error) status code can be ignored: ignore_error=0x287 Signed-off-by: Minwoo Im --- options.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/options.c b/options.c index 61ea41cc..51686914 100644 --- a/options.c +++ b/options.c @@ -495,7 +495,11 @@ static int ignore_error_type(struct thread_data *td, enum error_type_bit etype, if (fname[0] == 'E') { error[i] = str2error(fname); } else { - error[i] = atoi(fname); + int base = 10; + if (!strncmp(fname, "0x", 2) || + !strncmp(fname, "0X", 2)) + base = 16; + error[i] = strtol(fname, NULL, base); if (error[i] < 0) error[i] = -error[i]; } -- 2.25.1