summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2013-04-17 19:27:46 +0200
committerJens Axboe <axboe@kernel.dk>2013-04-17 19:27:46 +0200
commit3c978125e2bc883a9e69f0bae0122f936f995f17 (patch)
tree3d5959213c25011e75012070e46b8b14be74b4ec
parentf0c48a70c5cb8e9f04d263999e0b8d9188f08562 (diff)
Split out td error handling code
Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--Makefile2
-rw-r--r--fio.h36
-rw-r--r--td_error.c41
-rw-r--r--td_error.h27
-rw-r--r--thread_options.h19
5 files changed, 70 insertions, 55 deletions
diff --git a/Makefile b/Makefile
index e93bf4d..c5cef31 100644
--- a/Makefile
+++ b/Makefile
@@ -32,7 +32,7 @@ SOURCE := gettime.c ioengines.c init.c stat.c log.c time.c filesetup.c \
memalign.c server.c client.c iolog.c backend.c libfio.c flow.c \
cconv.c lib/prio_tree.c json.c lib/zipf.c lib/axmap.c \
lib/lfsr.c gettime-thread.c helpers.c lib/flist_sort.c \
- lib/hweight.c lib/getrusage.c idletime.c
+ lib/hweight.c lib/getrusage.c idletime.c td_error.c
ifdef CONFIG_64BIT_LLP64
CFLAGS += -DBITS_PER_LONG=32
diff --git a/fio.h b/fio.h
index 47e711f..d5746dd 100644
--- a/fio.h
+++ b/fio.h
@@ -375,42 +375,6 @@ static inline void fio_ro_check(struct thread_data *td, struct io_u *io_u)
#define REAL_MAX_JOBS 2048
-static inline enum error_type_bit td_error_type(enum fio_ddir ddir, int err)
-{
- if (err == EILSEQ)
- return ERROR_TYPE_VERIFY_BIT;
- if (ddir == DDIR_READ)
- return ERROR_TYPE_READ_BIT;
- return ERROR_TYPE_WRITE_BIT;
-}
-
-static int __NON_FATAL_ERR[] = {EIO, EILSEQ};
-static inline int td_non_fatal_error(struct thread_data *td,
- enum error_type_bit etype, int err)
-{
- unsigned int i;
-
- 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);
- }
-
- if (!(td->o.continue_on_error & (1 << etype)))
- return 0;
- for (i = 0; i < td->o.ignore_error_nr[etype]; i++)
- if (td->o.ignore_error[etype][i] == err)
- return 1;
- return 0;
-}
-
-static inline void update_error_count(struct thread_data *td, int err)
-{
- td->total_err_count++;
- if (td->total_err_count == 1)
- td->first_error = err;
-}
-
static inline int should_fsync(struct thread_data *td)
{
if (td->last_was_sync)
diff --git a/td_error.c b/td_error.c
new file mode 100644
index 0000000..903f9ea
--- /dev/null
+++ b/td_error.c
@@ -0,0 +1,41 @@
+#include "fio.h"
+#include "io_ddir.h"
+#include "td_error.h"
+
+static int __NON_FATAL_ERR[] = { EIO, EILSEQ };
+
+enum error_type_bit td_error_type(enum fio_ddir ddir, int err)
+{
+ if (err == EILSEQ)
+ return ERROR_TYPE_VERIFY_BIT;
+ if (ddir == DDIR_READ)
+ return ERROR_TYPE_READ_BIT;
+ return ERROR_TYPE_WRITE_BIT;
+}
+
+int td_non_fatal_error(struct thread_data *td, enum error_type_bit etype,
+ int err)
+{
+ unsigned int i;
+
+ 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);
+ }
+
+ if (!(td->o.continue_on_error & (1 << etype)))
+ return 0;
+ for (i = 0; i < td->o.ignore_error_nr[etype]; i++)
+ if (td->o.ignore_error[etype][i] == err)
+ return 1;
+
+ return 0;
+}
+
+void update_error_count(struct thread_data *td, int err)
+{
+ td->total_err_count++;
+ if (td->total_err_count == 1)
+ td->first_error = err;
+}
diff --git a/td_error.h b/td_error.h
new file mode 100644
index 0000000..1133989
--- /dev/null
+++ b/td_error.h
@@ -0,0 +1,27 @@
+#ifndef FIO_TD_ERROR_H
+#define FIO_TD_ERROR_H
+
+/*
+ * What type of errors to continue on when continue_on_error is used
+ */
+enum error_type_bit {
+ ERROR_TYPE_READ_BIT = 0,
+ ERROR_TYPE_WRITE_BIT = 1,
+ ERROR_TYPE_VERIFY_BIT = 2,
+ ERROR_TYPE_CNT = 3,
+};
+
+enum error_type {
+ ERROR_TYPE_NONE = 0,
+ ERROR_TYPE_READ = 1 << ERROR_TYPE_READ_BIT,
+ ERROR_TYPE_WRITE = 1 << ERROR_TYPE_WRITE_BIT,
+ ERROR_TYPE_VERIFY = 1 << ERROR_TYPE_VERIFY_BIT,
+ ERROR_TYPE_ANY = 0xffff,
+};
+
+enum error_type_bit td_error_type(enum fio_ddir ddir, int err);
+int td_non_fatal_error(struct thread_data *td, enum error_type_bit etype,
+ int err);
+void update_error_count(struct thread_data *td, int err);
+
+#endif
diff --git a/thread_options.h b/thread_options.h
index 60a1b69..f25988a 100644
--- a/thread_options.h
+++ b/thread_options.h
@@ -6,6 +6,7 @@
#include "stat.h"
#include "gettime.h"
#include "lib/ieee754.h"
+#include "td_error.h"
/*
* What type of allocation to use for io buffers
@@ -18,26 +19,8 @@ enum fio_memtype {
MEM_MMAPHUGE, /* memory mapped huge file */
};
-/*
- * What type of errors to continue on when continue_on_error is used
- */
-enum error_type_bit {
- ERROR_TYPE_READ_BIT = 0,
- ERROR_TYPE_WRITE_BIT = 1,
- ERROR_TYPE_VERIFY_BIT = 2,
- ERROR_TYPE_CNT = 3,
-};
-
#define ERROR_STR_MAX 128
-enum error_type {
- ERROR_TYPE_NONE = 0,
- ERROR_TYPE_READ = 1 << ERROR_TYPE_READ_BIT,
- ERROR_TYPE_WRITE = 1 << ERROR_TYPE_WRITE_BIT,
- ERROR_TYPE_VERIFY = 1 << ERROR_TYPE_VERIFY_BIT,
- ERROR_TYPE_ANY = 0xffff,
-};
-
#define BSSPLIT_MAX 64
struct bssplit {