From: Jens Axboe Date: Thu, 19 Oct 2006 06:48:32 +0000 (+0200) Subject: Merge branch 'master' of ssh://router/data/git/fio X-Git-Tag: fio-1.7~17 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=7313b48c3196b4750f4103e8622126039e2231c6;hp=e5b401d4bf67a1704f28872d3abe09eaf65cdabe Merge branch 'master' of ssh://router/data/git/fio --- diff --git a/Makefile b/Makefile index b9a72811..9dc4729f 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ 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 diff --git a/engines/Makefile b/engines/Makefile index bffaff44..ce55894d 100644 --- a/engines/Makefile +++ b/engines/Makefile @@ -1,5 +1,5 @@ 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 diff --git a/engines/fio-engine-libaio.c b/engines/fio-engine-libaio.c index 9197107c..c3fefdac 100644 --- a/engines/fio-engine-libaio.c +++ b/engines/fio-engine-libaio.c @@ -17,12 +17,13 @@ struct libaio_data { 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; diff --git a/engines/fio-engine-mmap.c b/engines/fio-engine-mmap.c index 0c79752f..d203d6af 100644 --- a/engines/fio-engine-mmap.c +++ b/engines/fio-engine-mmap.c @@ -67,7 +67,8 @@ static int fio_mmapio_queue(struct thread_data *td, struct io_u *io_u) 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); } diff --git a/engines/fio-engine-posixaio.c b/engines/fio-engine-posixaio.c index 8cd3cf46..260551a4 100644 --- a/engines/fio-engine-posixaio.c +++ b/engines/fio-engine-posixaio.c @@ -45,12 +45,14 @@ static unsigned long long ts_utime_since_now(struct timespec *t) 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); @@ -61,7 +63,8 @@ static int fio_posixaio_cancel(struct thread_data *td, struct io_u *io_u) 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; diff --git a/engines/fio-engine-sg.c b/engines/fio-engine-sg.c index 5337068b..01eba8d5 100644 --- a/engines/fio-engine-sg.c +++ b/engines/fio-engine-sg.c @@ -112,8 +112,8 @@ static int fio_sgio_getevents(struct thread_data *td, int min, int max, 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; @@ -123,8 +123,7 @@ static int fio_sgio_ioctl_doio(struct thread_data *td, struct fio_file *f, 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; @@ -149,10 +148,10 @@ static int fio_sgio_doio(struct thread_data *td, struct io_u *io_u, int sync) 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; diff --git a/engines/fio-engine-splice.c b/engines/fio-engine-splice.c index 4f5b86cd..cb39b722 100644 --- a/engines/fio-engine-splice.c +++ b/engines/fio-engine-splice.c @@ -16,7 +16,8 @@ struct spliceio_data { 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); } diff --git a/engines/fio-engine-sync.c b/engines/fio-engine-sync.c index 1806d4df..d5be4c82 100644 --- a/engines/fio-engine-sync.c +++ b/engines/fio-engine-sync.c @@ -14,7 +14,8 @@ struct syncio_data { 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); } diff --git a/filesetup.c b/filesetup.c index 4f3d6cdf..57735a96 100644 --- a/filesetup.c +++ b/filesetup.c @@ -374,11 +374,10 @@ int setup_files(struct thread_data *td) 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); diff --git a/fio.c b/fio.c index 5432e383..28be099a 100644 --- a/fio.c +++ b/fio.c @@ -277,7 +277,7 @@ static int get_rw_ddir(struct thread_data *td) * 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); @@ -422,7 +422,7 @@ static inline void td_set_runstate(struct thread_data *td, int runstate) 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 { diff --git a/fio.h b/fio.h index 6ecb11cf..142e6c9f 100644 --- a/fio.h +++ b/fio.h @@ -541,6 +541,6 @@ extern void close_ioengine(struct thread_data *); #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 diff --git a/init.c b/init.c index 91a1d507..fae35f3c 100644 --- a/init.c +++ b/init.c @@ -275,6 +275,7 @@ int init_random_state(struct thread_data *td) { unsigned long seeds[4]; int fd, num_maps, blocks, i; + struct fio_file *f; fd = open("/dev/urandom", O_RDONLY); if (fd == -1) { @@ -300,9 +301,7 @@ int init_random_state(struct thread_data *td) 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)); @@ -1056,7 +1055,7 @@ static int fill_def_thread(void) 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"); @@ -1099,7 +1098,7 @@ static int parse_cmd_line(int argc, char *argv[]) idx = optind; break; case 'h': - usage(argv[0]); + usage(); exit(0); case 'v': printf("%s\n", fio_version_string); @@ -1183,7 +1182,7 @@ int parse_options(int argc, char *argv[]) job_files = parse_cmd_line(argc, argv); if (!job_files) { log_err("Need job file(s)\n"); - usage(argv[0]); + usage(); return 1; }