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
14 static enum fio_q_status
15 fio_ftruncate_queue(struct thread_data *td, struct io_u *io_u)
17 struct fio_file *f = io_u->file;
19 fio_ro_check(td, io_u);
21 if (io_u->ddir != DDIR_WRITE) {
23 return FIO_Q_COMPLETED;
25 ret = ftruncate(f->fd, io_u->offset);
30 return FIO_Q_COMPLETED;
33 static struct ioengine_ops ioengine = {
35 .version = FIO_IOOPS_VERSION,
36 .queue = fio_ftruncate_queue,
37 .open_file = generic_open_file,
38 .close_file = generic_close_file,
39 .get_file_size = generic_get_file_size,
40 .flags = FIO_SYNCIO | FIO_FAKEIO
43 static void fio_init fio_syncio_register(void)
45 register_ioengine(&ioengine);
48 static void fio_exit fio_syncio_unregister(void)
50 unregister_ioengine(&ioengine);