Fix Windows CPU count
[fio.git] / td_error.c
CommitLineData
3c978125
JA
1#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;
fdbc9102 23 td->o.ignore_error_nr[etype] = ARRAY_SIZE(__NON_FATAL_ERR);
3c978125
JA
24 }
25
26 if (!(td->o.continue_on_error & (1 << etype)))
27 return 0;
28 for (i = 0; i < td->o.ignore_error_nr[etype]; i++)
29 if (td->o.ignore_error[etype][i] == err)
30 return 1;
31
32 return 0;
33}
34
35void update_error_count(struct thread_data *td, int err)
36{
37 td->total_err_count++;
38 if (td->total_err_count == 1)
39 td->first_error = err;
40}