Home | History | Annotate | Download | only in fio
      1 #include "fio.h"
      2 #include "io_ddir.h"
      3 #include "td_error.h"
      4 
      5 static int __NON_FATAL_ERR[] = { EIO, EILSEQ };
      6 
      7 enum error_type_bit td_error_type(enum fio_ddir ddir, int err)
      8 {
      9 	if (err == EILSEQ)
     10 		return ERROR_TYPE_VERIFY_BIT;
     11 	if (ddir == DDIR_READ)
     12 		return ERROR_TYPE_READ_BIT;
     13 	return ERROR_TYPE_WRITE_BIT;
     14 }
     15 
     16 int td_non_fatal_error(struct thread_data *td, enum error_type_bit etype,
     17 		       int err)
     18 {
     19 	unsigned int i;
     20 
     21 	if (!td->o.ignore_error[etype]) {
     22 		td->o.ignore_error[etype] = __NON_FATAL_ERR;
     23 		td->o.ignore_error_nr[etype] = sizeof(__NON_FATAL_ERR)
     24 			/ sizeof(int);
     25 	}
     26 
     27 	if (!(td->o.continue_on_error & (1 << etype)))
     28 		return 0;
     29 	for (i = 0; i < td->o.ignore_error_nr[etype]; i++)
     30 		if (td->o.ignore_error[etype][i] == err)
     31 			return 1;
     32 
     33 	return 0;
     34 }
     35 
     36 void update_error_count(struct thread_data *td, int err)
     37 {
     38 	td->total_err_count++;
     39 	if (td->total_err_count == 1)
     40 		td->first_error = err;
     41 }
     42