CC = gcc
-CFLAGS = -Wall -O2 -g -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
+CFLAGS = -W -Wall -O2 -g -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
PROGS = fio
SCRIPTS = fio_generate_plots
CC = gcc
-CFLAGS = -Wall -O2 -g -shared -rdynamic -fPIC
+CFLAGS = -W -Wall -O2 -g -shared -rdynamic -fPIC
ALL_CFLAGS = $(CFLAGS) -I.. -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
OBJS = fio-engine-sync.o fio-engine-splice.o fio-engine-mmap.o fio-engine-libaio.o fio-engine-posixaio.o fio-engine-sg.o fio-engine-cpu.o
struct io_event *aio_events;
};
-static int fio_libaio_sync(struct thread_data *td, struct fio_file *f)
+static int fio_libaio_sync(struct thread_data fio_unused *td,
+ struct fio_file *f)
{
return fsync(f->fd);
}
-static int fio_libaio_prep(struct thread_data *td, struct io_u *io_u)
+static int fio_libaio_prep(struct thread_data fio_unused *td, struct io_u *io_u)
{
struct fio_file *f = io_u->file;
return io_u->error;
}
-static int fio_mmapio_sync(struct thread_data *td, struct fio_file *f)
+static int fio_mmapio_sync(struct thread_data fio_unused *td,
+ struct fio_file *f)
{
return msync(f->mmap, f->file_size, MS_SYNC);
}
return sec + nsec;
}
-static int fio_posixaio_sync(struct thread_data *td, struct fio_file *f)
+static int fio_posixaio_sync(struct thread_data fio_unused *td,
+ struct fio_file *f)
{
return fsync(f->fd);
}
-static int fio_posixaio_cancel(struct thread_data *td, struct io_u *io_u)
+static int fio_posixaio_cancel(struct thread_data fio_unused *td,
+ struct io_u *io_u)
{
struct fio_file *f = io_u->file;
int r = aio_cancel(f->fd, &io_u->aiocb);
return 1;
}
-static int fio_posixaio_prep(struct thread_data *td, struct io_u *io_u)
+static int fio_posixaio_prep(struct thread_data fio_unused *td,
+ struct io_u *io_u)
{
struct aiocb *aiocb = &io_u->aiocb;
struct fio_file *f = io_u->file;
return r;
}
-static int fio_sgio_ioctl_doio(struct thread_data *td, struct fio_file *f,
- struct io_u *io_u)
+static int fio_sgio_ioctl_doio(struct thread_data *td,
+ struct fio_file *f, struct io_u *io_u)
{
struct sgio_data *sd = td->io_ops->data;
struct sg_io_hdr *hdr = &io_u->hdr;
return ioctl(f->fd, SG_IO, hdr);
}
-static int fio_sgio_rw_doio(struct thread_data *td, struct fio_file *f,
- struct io_u *io_u, int sync)
+static int fio_sgio_rw_doio(struct fio_file *f, struct io_u *io_u, int sync)
{
struct sg_io_hdr *hdr = &io_u->hdr;
int ret;
if (td->filetype == FIO_TYPE_BD)
return fio_sgio_ioctl_doio(td, f, io_u);
- return fio_sgio_rw_doio(td, f, io_u, sync);
+ return fio_sgio_rw_doio(f, io_u, sync);
}
-static int fio_sgio_sync(struct thread_data *td, struct fio_file *f)
+static int fio_sgio_sync(struct thread_data *td, struct fio_file fio_unused *f)
{
struct sgio_data *sd = td->io_ops->data;
struct sg_io_hdr *hdr;
int pipe[2];
};
-static int fio_spliceio_sync(struct thread_data *td, struct fio_file *f)
+static int fio_spliceio_sync(struct thread_data fio_unused *td,
+ struct fio_file *f)
{
return fsync(f->fd);
}
struct io_u *last_io_u;
};
-static int fio_syncio_sync(struct thread_data *td, struct fio_file *f)
+static int fio_syncio_sync(struct thread_data fio_unused *td,
+ struct fio_file *f)
{
return fsync(f->fd);
}
void close_files(struct thread_data *td)
{
+ struct fio_file *f;
int i;
- for (i = 0; i < td->nr_files; i++) {
- struct fio_file *f = &td->files[i];
-
+ for_each_file(td, f, i) {
if (f->fd != -1) {
if (td->unlink && td->filetype == FIO_TYPE_FILE)
unlink(f->file_name);
* Check if it's time to seed a new data direction.
*/
if (elapsed >= td->rwmixcycle) {
- int v;
+ unsigned int v;
long r;
r = os_random_long(&td->rwmix_state);
static struct fio_file *get_next_file(struct thread_data *td)
{
- int old_next_file = td->next_file;
+ unsigned int old_next_file = td->next_file;
struct fio_file *f;
do {
#define fio_unused __attribute((__unused__))
#define for_each_file(td, f, i) \
- for ((i) = 0, (f) = &(td)->files[0]; (i) < (td)->nr_files; (i)++, (f) = &(td)->files[(i)])
+ for ((i) = 0, (f) = &(td)->files[0]; (i) < (int) (td)->nr_files; (i)++, (f) = &(td)->files[(i)])
#endif
{
unsigned long seeds[4];
int fd, num_maps, blocks, i;
+ struct fio_file *f;
fd = open("/dev/urandom", O_RDONLY);
if (fd == -1) {
if (td->rand_repeatable)
seeds[3] = DEF_RANDSEED;
- for (i = 0; i < td->nr_files; i++) {
- struct fio_file *f = &td->files[i];
-
+ for_each_file(td, f, i) {
blocks = (f->file_size + td->min_bs - 1) / td->min_bs;
num_maps = blocks / BLOCKS_PER_MAP;
f->file_map = malloc(num_maps * sizeof(long));
return 0;
}
-static void usage(char *name)
+static void usage(void)
{
printf("%s\n", fio_version_string);
printf("\t-o Write output to file\n");
idx = optind;
break;
case 'h':
- usage(argv[0]);
+ usage();
exit(0);
case 'v':
printf("%s\n", fio_version_string);
job_files = parse_cmd_line(argc, argv);
if (!job_files) {
log_err("Need job file(s)\n");
- usage(argv[0]);
+ usage();
return 1;
}