Fixes a segfault with rand* directions.
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
struct fio_file *f;
unsigned int i;
- for_each_file(td, f, i)
- f->real_file_size = -1ULL;
+ for_each_file(td, f, i) {
+ if (td->o.size)
+ f->real_file_size = td->o.size / td->o.nr_files;
+ else
+ f->real_file_size = -1ULL;
+ }
return 0;
}
return 0;
}
-static int fio_cpuio_open(struct thread_data fio_unused *td, struct fio_file *f)
+static int fio_cpuio_open(struct thread_data fio_unused *td,
+ struct fio_file fio_unused *f)
{
- f->fd = 0;
return 0;
}
nd->listenfd = -1;
td->io_ops->data = nd;
- for_each_file(td, f, i)
- f->real_file_size = -1ULL;
+ for_each_file(td, f, i) {
+ if (td->o.size)
+ f->real_file_size = td->o.size / td->o.nr_files;
+ else
+ f->real_file_size = -1ULL;
+ }
}
return 0;
struct fio_file *f;
unsigned int i;
- for_each_file(td, f, i)
- f->real_file_size = -1ULL;
+ for_each_file(td, f, i) {
+ if (td->o.size)
+ f->real_file_size = td->o.size / td->o.nr_files;
+ else
+ f->real_file_size = -1ULL;
+ }
return 0;
}
static int fio_null_open(struct thread_data fio_unused *td,
struct fio_file fio_unused *f)
{
- f->fd = 0;
return 0;
}