Merge branch 'master' of ssh://router/data/git/fio
authorJens Axboe <axboe@nelson.home.kernel.dk>
Thu, 19 Oct 2006 06:48:32 +0000 (08:48 +0200)
committerJens Axboe <axboe@nelson.home.kernel.dk>
Thu, 19 Oct 2006 06:48:32 +0000 (08:48 +0200)
12 files changed:
Makefile
engines/Makefile
engines/fio-engine-libaio.c
engines/fio-engine-mmap.c
engines/fio-engine-posixaio.c
engines/fio-engine-sg.c
engines/fio-engine-splice.c
engines/fio-engine-sync.c
filesetup.c
fio.c
fio.h
init.c

index b9a7281153c67dd54b97969ac96ef7aeb8a61976..9dc4729f75e6626b5b0361a988ba4ef25cf78011 100644 (file)
--- 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
 
index bffaff443bba0934ac5341b1cc5f1d263fd9a0d8..ce55894d171980f6ae62fde98e90cf8d391b1b72 100644 (file)
@@ -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
 
index 9197107cc65a8abfbfb1ab5b0e29ec4e4905f31f..c3fefdaccda7ea97cf660c0db4007b158807310e 100644 (file)
@@ -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;
 
index 0c79752ff17c3c61c33b2fc01a715b471f531566..d203d6afc40db3d4ccca1cbcdbdaff4f94c22aab 100644 (file)
@@ -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);
 }
index 8cd3cf465998cb6fca2c961130f3e09d56d5114c..260551a4ee8b506f9c1fa84cc30711bddf168255 100644 (file)
@@ -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;
index 5337068bbb992d828d3e30e9a1b2979fdb41e85f..01eba8d58391ebe957f4213452946a5cef09bf93 100644 (file)
@@ -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;
index 4f5b86cd220c182a84ae39fbd38bf49cd795bc2d..cb39b7225946fc55b618b8b65cf0bef8d2500de0 100644 (file)
@@ -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);
 }
index 1806d4dfda01f9157511f4fba66f430c215e1d7b..d5be4c8256ecda8415cbe438883d141758acfda7 100644 (file)
@@ -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);
 }
index 4f3d6cdf7ea4e4e62915343e00e2c5ede8bb52bd..57735a96dacffe0e798b733b64f7f2dd187d97b2 100644 (file)
@@ -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 5432e383d439319eb918b3dd4162c2df774b0337..28be099ab71d432174e1fd1560afd1bf4e596c00 100644 (file)
--- 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 6ecb11cf9cae333cee0c9fb4333e6ca27993a610..142e6c9f03316bdaf7b9f195acd1d436093e6333 100644 (file)
--- 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 91a1d507892e80f82dca9647c7be8eb0e266a7b6..fae35f3c8260fd140e0852d31d2f7abe1248e88a 100644 (file)
--- 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;
        }