Skip to contentSkip to conversation

fixes for ignore_error option

PATCH In review [email protected] 2 participants 7 messages Jun 7, 2017

lore
Share & tools
lore
#1 lore raw

PATCH 1/5 fix wrong malloc size for ignore_error buffer

In reply to [email protected]

From: Tomohiro Kusumi <[email protected]>

This is supposed to be allocating the initial buffer which consists of 4 integers to store errno values to ignore.
Also explicitly zero clear the buffer.

---
 options.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
options.c +1 -1
index 2daa983..864e778 100644
@@ -282,7 +282,7 @@ static int ignore_error_type(struct thread_data *td, int etype, char *str)
 	}
 
 	td->o.ignore_error_nr[etype] = 4;
-	error = malloc(4 * sizeof(struct bssplit));
+	error = calloc(4, sizeof(int));
 
 	i = 0;
 	while ((fname = strsep(&str, ":")) != NULL) {
Signature · 1 line
2.9.4
#2 lore raw

PATCH 2/5 don't leave ignore_error_nr[etype] with 4 on blank input or error

In reply to [email protected]

From: Tomohiro Kusumi <[email protected]>

This isn't a bug since td_non_fatal_error() checks errnos to ignore by td->o.ignore_error[etype] being NULL or not, but it's still strange to leave td->o.ignore_error_nr[etype] with 4 (or multiple of 4 on error) when there aren't any.

---
 options.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
options.c +5 -2
index 864e778..4214f24 100644
@@ -306,8 +306,9 @@ static int ignore_error_type(struct thread_data *td, int etype, char *str)
 				error[i] = -error[i];
 		}
 		if (!error[i]) {
-			log_err("Unknown error %s, please use number value \n",
+			log_err("Unknown error %s, please use number value\n",
 				  fname);
+			td->o.ignore_error_nr[etype] = 0;
 			free(error);
 			return 1;
 		}
@@ -317,8 +318,10 @@ static int ignore_error_type(struct thread_data *td, int etype, char *str)
 		td->o.continue_on_error |= 1 << etype;
 		td->o.ignore_error_nr[etype] = i;
 		td->o.ignore_error[etype] = error;
-	} else
+	} else {
+		td->o.ignore_error_nr[etype] = 0;
 		free(error);
+	}
 
 	return 0;
 
Signature · 1 line
2.9.4
#3 lore raw

PATCH 3/5 use enum error_type_bit for ignore_error index

In reply to [email protected]

From: Tomohiro Kusumi <[email protected]>

---
 options.c  | 6 ++++--
 td_error.h | 3 ++-
 2 files changed, 6 insertions(+), 3 deletions(-)
options.c +4 -2
index 4214f24..6d799bf 100644
@@ -270,7 +270,8 @@ static int str2error(char *str)
 	return 0;
 }
 
-static int ignore_error_type(struct thread_data *td, int etype, char *str)
+static int ignore_error_type(struct thread_data *td, enum error_type_bit etype,
+				char *str)
 {
 	unsigned int i;
 	int *error;
@@ -331,7 +332,8 @@ static int str_ignore_error_cb(void *data, const char *input)
 {
 	struct thread_data *td = cb_data_to_td(data);
 	char *str, *p, *n;
-	int type = 0, ret = 1;
+	int ret = 1;
+	enum error_type_bit type = 0;
 
 	if (parse_dryrun())
 		return 0;
td_error.h +2 -1
index 1133989..1b38a53 100644
@@ -2,7 +2,8 @@
 #define FIO_TD_ERROR_H
 
 /*
- * What type of errors to continue on when continue_on_error is used
+ * What type of errors to continue on when continue_on_error is used,
+ * and what type of errors to ignore when ignore_error is used.
  */
 enum error_type_bit {
 	ERROR_TYPE_READ_BIT = 0,
Signature · 1 line
2.9.4
#4 lore raw

PATCH 4/5 use ARRAY_SIZE() for ignore_error_nr[etype]

In reply to [email protected]

From: Tomohiro Kusumi <[email protected]>

---
 td_error.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
td_error.c +1 -2
index 903f9ea..9d58a31 100644
@@ -20,8 +20,7 @@ int td_non_fatal_error(struct thread_data *td, enum error_type_bit etype,
 
 	if (!td->o.ignore_error[etype]) {
 		td->o.ignore_error[etype] = __NON_FATAL_ERR;
-		td->o.ignore_error_nr[etype] = sizeof(__NON_FATAL_ERR)
-			/ sizeof(int);
+		td->o.ignore_error_nr[etype] = ARRAY_SIZE(__NON_FATAL_ERR);
 	}
 
 	if (!(td->o.continue_on_error & (1 << etype)))
Signature · 1 line
2.9.4
#5 lore raw

PATCH 5/5 HOWTO: mention some details of ignore_error= option

In reply to [email protected]

From: Tomohiro Kusumi <[email protected]>

ignore_error= and continue_on_error= are related in their implementation, and easier to understand how they differ by mentioning to it.

---
 HOWTO | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
HOWTO +4 -2
index ea9466a..289c518 100644
@@ -2836,7 +2836,8 @@ Error handling
 .. option:: ignore_error=str
 
 	Sometimes you want to ignore some errors during test in that case you can
-	specify error list for each error type.
+	specify error list for each error type, instead of only being able to
+	ignore the default 'non-fatal error' using :option:`continue_on_error`.
 	``ignore_error=READ_ERR_LIST,WRITE_ERR_LIST,VERIFY_ERR_LIST`` errors for
 	given error type is separated with ':'. Error may be symbol ('ENOSPC',
 	'ENOMEM') or integer.  Example::
@@ -2844,7 +2845,8 @@ Error handling
 		ignore_error=EAGAIN,ENOSPC:122
 
 	This option will ignore EAGAIN from READ, and ENOSPC and 122(EDQUOT) from
-	WRITE.
+	WRITE. This option works by overriding :option:`continue_on_error` with
+	the list of errors for each error type if any.
 
 .. option:: error_dump=bool
 
Signature · 1 line
2.9.4
#0 lore raw

cover fixes for ignore_error option

From: Tomohiro Kusumi <[email protected]>

Tomohiro Kusumi (5):
fix wrong malloc size for ignore_error buffer
don't leave ignore_error_nr[etype] with 4 on blank input or error use enum error_type_bit for ignore_error index
use ARRAY_SIZE() for ignore_error_nr[etype]
HOWTO: mention some details of ignore_error= option

 HOWTO      |  6 ++++--
 options.c  | 15 ++++++++++-----
 td_error.c |  3 +--
 td_error.h |  3 ++-
 4 files changed, 17 insertions(+), 10 deletions(-)
Signature · 1 line
2.9.4
#6 lore raw
Quoted 9 lines · On 06/07/2017 02:18 PM, [email protected] wrote:

From: Tomohiro Kusumi <[email protected]>

Tomohiro Kusumi (5):
fix wrong malloc size for ignore_error buffer
don't leave ignore_error_nr[etype] with 4 on blank input or error use enum error_type_bit for ignore_error index
use ARRAY_SIZE() for ignore_error_nr[etype]
HOWTO: mention some details of ignore_error= option

Looks good, applied all 5, thanks.

Signature · 1 line
Jens Axboe