blob: 903f9ea5163e95854043b942889d10f6185aa198 [file] [log] [blame]
Jens Axboe3c978122013-04-17 19:27:46 +02001#include "fio.h"
2#include "io_ddir.h"
3#include "td_error.h"
4
5static int __NON_FATAL_ERR[] = { EIO, EILSEQ };
6
7enum 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
16int 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
36void 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}