projects
/
fio.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Revamp file open/close handling
[fio.git]
/
engines
/
null.c
diff --git
a/engines/null.c
b/engines/null.c
index 7b4b217679bc1d950c02c8b3c5e8a5a03acd4ae2..7f45bd97ea4988ac84ce307d82715dfcf73e4d70 100644
(file)
--- a/
engines/null.c
+++ b/
engines/null.c
@@
-11,66
+11,49
@@
#include "../fio.h"
#include "../os.h"
#include "../fio.h"
#include "../os.h"
-struct null_data {
- struct io_u *last_io_u;
-};
-
-static int fio_null_getevents(struct thread_data *td, int fio_unused min,
- int max, struct timespec fio_unused *t)
+static int fio_null_queue(struct thread_data fio_unused *td, struct io_u *io_u)
{
{
- assert(max <= 1);
-
- if (list_empty(&td->io_u_busylist))
- return 0;
-
- return 1;
+ io_u->resid = 0;
+ io_u->error = 0;
+ return FIO_Q_COMPLETED;
}
}
-static
struct io_u *fio_null_event(struct thread_data *td, int event
)
+static
int fio_null_setup(struct thread_data *td
)
{
{
- struct null_data *nd = td->io_ops->data;
+ struct fio_file *f;
+ int i;
- assert(event == 0);
+ if (!td->total_file_size) {
+ log_err("fio: need size= set\n");
+ return 1;
+ }
-
return nd->last_io_u
;
-}
+
td->io_size = td->total_file_size
;
+ td->total_io_size = td->io_size;
-static int fio_null_queue(struct thread_data *td, struct io_u *io_u)
-{
- struct null_data *nd = td->io_ops->data;
+ for_each_file(td, f, i) {
+ f->fd = dup(STDOUT_FILENO);
+ f->real_file_size = td->total_io_size / td->nr_files;
+ f->file_size = f->real_file_size;
+ }
- io_u->resid = 0;
- io_u->error = 0;
- nd->last_io_u = io_u;
+ td->nr_open_files = td->nr_files;
return 0;
}
return 0;
}
-static void fio_null_cleanup(struct thread_data *td)
-{
- if (td->io_ops->data) {
- free(td->io_ops->data);
- td->io_ops->data = NULL;
- }
-}
-
-static int fio_null_init(struct thread_data *td)
+static int fio_null_open(struct thread_data fio_unused *td,
+ struct fio_file fio_unused *f)
{
{
- struct null_data *nd = malloc(sizeof(*nd));
-
- nd->last_io_u = NULL;
- td->io_ops->data = nd;
return 0;
}
static struct ioengine_ops ioengine = {
.name = "null",
.version = FIO_IOOPS_VERSION,
return 0;
}
static struct ioengine_ops ioengine = {
.name = "null",
.version = FIO_IOOPS_VERSION,
- .
init = fio_null_init
,
+ .
setup = fio_null_setup
,
.queue = fio_null_queue,
.queue = fio_null_queue,
- .getevents = fio_null_getevents,
- .event = fio_null_event,
- .cleanup = fio_null_cleanup,
- .flags = FIO_SYNCIO | FIO_NULLIO,
+ .open_file = fio_null_open,
+ .flags = FIO_SYNCIO | FIO_DISKLESSIO,
};
static void fio_init fio_null_register(void)
};
static void fio_init fio_null_register(void)