X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=engines%2Ffilecreate.c;h=39a2950293f70b8e74e57624dfea5e1fb050d3c6;hp=c6b659713c499a53ffb2d4312a99bafa94d1bc19;hb=ce4d13ca162df4127ec3b5911553802c53396705;hpb=cb9bf6471bc456e8d59255c37beea388264672bf diff --git a/engines/filecreate.c b/engines/filecreate.c index c6b65971..39a29502 100644 --- a/engines/filecreate.c +++ b/engines/filecreate.c @@ -5,12 +5,14 @@ * of the file creation. */ #include -#include #include #include #include "../fio.h" -#include "../filehash.h" + +struct fc_data { + enum fio_ddir stat_ddir; +}; static int open_file(struct thread_data *td, struct fio_file *f) { @@ -43,16 +45,18 @@ static int open_file(struct thread_data *td, struct fio_file *f) } if (do_lat) { + struct fc_data *data = td->io_ops_data; uint64_t nsec; nsec = ntime_since_now(&start); - add_clat_sample(td, DDIR_READ, nsec, 0, 0); + add_clat_sample(td, data->stat_ddir, nsec, 0, 0); } return 0; } -static int queue_io(struct thread_data *td, struct io_u fio_unused *io_u) +static enum fio_q_status queue_io(struct thread_data *td, + struct io_u fio_unused *io_u) { return FIO_Q_COMPLETED; } @@ -68,9 +72,33 @@ static int get_file_size(struct thread_data *td, struct fio_file *f) return 0; } +static int init(struct thread_data *td) +{ + struct fc_data *data; + + data = calloc(1, sizeof(*data)); + + if (td_read(td)) + data->stat_ddir = DDIR_READ; + else if (td_write(td)) + data->stat_ddir = DDIR_WRITE; + + td->io_ops_data = data; + return 0; +} + +static void cleanup(struct thread_data *td) +{ + struct fc_data *data = td->io_ops_data; + + free(data); +} + static struct ioengine_ops ioengine = { .name = "filecreate", .version = FIO_IOOPS_VERSION, + .init = init, + .cleanup = cleanup, .queue = queue_io, .get_file_size = get_file_size, .open_file = open_file,