2 * ftruncate: ioengine for git://git.kernel.dk/fio.git
4 * IO engine that does regular truncates to simulate data transfer
6 * DDIR_WRITE does ftruncate
18 #include "../filehash.h"
20 static int fio_ftruncate_queue(struct thread_data *td, struct io_u *io_u)
22 struct fio_file *f = io_u->file;
24 fio_ro_check(td, io_u);
26 if (io_u->ddir != DDIR_WRITE) {
28 return FIO_Q_COMPLETED;
30 ret = ftruncate(f->fd, io_u->offset);
35 return FIO_Q_COMPLETED;
38 static struct ioengine_ops ioengine = {
40 .version = FIO_IOOPS_VERSION,
41 .queue = fio_ftruncate_queue,
42 .open_file = generic_open_file,
43 .close_file = generic_close_file,
44 .get_file_size = generic_get_file_size,
45 .flags = FIO_SYNCIO | FIO_FAKEIO
48 static void fio_init fio_syncio_register(void)
50 register_ioengine(&ioengine);
53 static void fio_exit fio_syncio_unregister(void)
55 unregister_ioengine(&ioengine);