X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=fio.h;h=b19101c20a4924892610bd78b0f6d645f3b93e9b;hb=cb21168269d746d80d82f28ed4db65c2750a8fd7;hp=c92629df5f280509cc4d43eb34db46ac3d37e67b;hpb=1621031e8a7cbb91afad124da405fc4eabda764f;p=fio.git diff --git a/fio.h b/fio.h index c92629df..b19101c2 100644 --- a/fio.h +++ b/fio.h @@ -111,6 +111,13 @@ struct thread_stat { unsigned long long io_bytes[2]; unsigned long runtime[2]; unsigned long total_run_time; + + /* + * IO Error related stats + */ + unsigned continue_on_error; + unsigned long total_err_count; + int first_error; }; struct bssplit { @@ -185,6 +192,7 @@ struct thread_options { unsigned int thinktime_spin; unsigned int thinktime_blocks; unsigned int fsync_blocks; + unsigned int fdatasync_blocks; unsigned int start_delay; unsigned long long timeout; unsigned long long ramp_time; @@ -194,6 +202,7 @@ struct thread_options { unsigned long long zone_size; unsigned long long zone_skip; enum fio_memtype mem_type; + unsigned int mem_align; unsigned int stonewall; unsigned int new_group; @@ -241,6 +250,11 @@ struct thread_options { */ unsigned int cpuload; unsigned int cpucycle; + + /* + * I/O Error handling + */ + unsigned int continue_on_error; }; #define FIO_VERROR_SIZE 128 @@ -369,6 +383,12 @@ struct thread_data { * For generating file sizes */ os_random_state_t file_size_state; + + /* + * Error counts + */ + unsigned int total_err_count; + int first_error; }; /* @@ -386,10 +406,13 @@ enum { break; \ int e = (err); \ (td)->error = e; \ - snprintf(td->verror, sizeof(td->verror) - 1, "file:%s:%d, func=%s, error=%s", __FILE__, __LINE__, (func), (msg)); \ + if (!(td)->first_error) \ + snprintf(td->verror, sizeof(td->verror) - 1, "file:%s:%d, func=%s, error=%s", __FILE__, __LINE__, (func), (msg)); \ } while (0) +#define td_clear_error(td) \ + (td)->error = 0; #define td_verror(td, err, func) \ __td_verror((td), (err), strerror((err)), (func)) #define td_vmsg(td, err, msg, func) \ @@ -425,6 +448,15 @@ static inline void fio_ro_check(struct thread_data *td, struct io_u *io_u) #define MAX_JOBS (1024) +#define td_non_fatal_error(e) ((e) == EIO || (e) == EILSEQ) + +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) @@ -448,7 +480,6 @@ extern unsigned long time_since_now(struct timeval *); extern unsigned long mtime_since_genesis(void); extern void usec_spin(unsigned int); extern void usec_sleep(struct thread_data *, unsigned long); -extern long rate_throttle(struct thread_data *, unsigned long, unsigned long, enum fio_ddir); extern void fill_start_time(struct timeval *); extern void fio_gettime(struct timeval *, void *); extern void fio_gtod_init(void); @@ -625,4 +656,9 @@ static inline int should_check_rate(struct thread_data *td, return ret; } +static inline int is_power_of_2(unsigned int val) +{ + return (val != 0 && ((val & (val - 1)) == 0)); +} + #endif