Merge branch 'proc_group' of https://github.com/sitsofe/fio
authorJens Axboe <axboe@kernel.dk>
Fri, 13 Apr 2018 23:25:35 +0000 (17:25 -0600)
committerJens Axboe <axboe@kernel.dk>
Fri, 13 Apr 2018 23:25:35 +0000 (17:25 -0600)
* 'proc_group' of https://github.com/sitsofe/fio:
  doc: add cpus_allowed reference to log_compression_cpus
  appveyor: make 32 bit build target XP + minor fixes
  configure/Makefile: make Cygwin force less
  doc: add Windows processor group behaviour and Windows target option
  windows: target Windows 7 and add support for more than 64 CPUs
  windows: prepare for Windows build split
  windows: update EULA

31 files changed:
Makefile
arch/arch-aarch64.h
backend.c
client.c
configure
crc/crc32c-arm64.c
crc/crc32c-intel.c
crc/crc32c.h
engines/binject.c [deleted file]
engines/glusterfs_async.c
engines/sg.c
eta.c
filesetup.c
fio.h
init.c
io_u.c
io_u.h
iolog.c
lib/axmap.c
options.c
options.h
os/binject.h [deleted file]
os/os-android.h
os/os-dragonfly.h
os/os-linux.h
os/os.h
parse.c
parse.h
server.c
stat.c
steadystate.c

index 5ab79234afe52bf689220bc680452bf2bd8b1343..357ae983b843586b5bbb1f95f39ff1fb9583f80d 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -145,7 +145,7 @@ endif
 
 ifeq ($(CONFIG_TARGET_OS), Linux)
   SOURCE += diskutil.c fifo.c blktrace.c cgroup.c trim.c engines/sg.c \
-               engines/binject.c oslib/linux-dev-lookup.c
+               oslib/linux-dev-lookup.c
   LIBS += -lpthread -ldl
   LDFLAGS += -rdynamic
 endif
index 0912a86f63c4598ee9d673fe3a80da9f2d9d5065..2a86cc5ab4d9b9cb1bef2dcf5d0aab24bfc38fb8 100644 (file)
@@ -27,8 +27,4 @@ static inline int arch_ffz(unsigned long bitmask)
 
 #define ARCH_HAVE_FFZ
 
-#ifdef ARCH_HAVE_CRC_CRYPTO
-#define ARCH_HAVE_ARM64_CRC_CRYPTO
-#endif
-
 #endif
index fc83ed178a05eca587570d7de5495a0182930c3f..b28c3dbc4fd65fdf71b3ad4581a9b27e9aac7511 100644 (file)
--- a/backend.c
+++ b/backend.c
@@ -723,6 +723,7 @@ static void do_verify(struct thread_data *td, uint64_t verify_bytes)
                                        break;
                                } else if (io_u->ddir == DDIR_WRITE) {
                                        io_u->ddir = DDIR_READ;
+                                       populate_verify_io_u(td, io_u);
                                        break;
                                } else {
                                        put_io_u(td, io_u);
@@ -995,6 +996,9 @@ static void do_io(struct thread_data *td, uint64_t *bytes_done)
                        break;
                }
 
+               if (io_u->ddir == DDIR_WRITE && td->flags & TD_F_DO_VERIFY)
+                       populate_verify_io_u(td, io_u);
+
                ddir = io_u->ddir;
 
                /*
@@ -1328,7 +1332,7 @@ static int init_io_u(struct thread_data *td)
 static int switch_ioscheduler(struct thread_data *td)
 {
 #ifdef FIO_HAVE_IOSCHED_SWITCH
-       char tmp[256], tmp2[128];
+       char tmp[256], tmp2[128], *p;
        FILE *f;
        int ret;
 
@@ -1364,17 +1368,19 @@ static int switch_ioscheduler(struct thread_data *td)
        /*
         * Read back and check that the selected scheduler is now the default.
         */
-       memset(tmp, 0, sizeof(tmp));
-       ret = fread(tmp, sizeof(tmp), 1, f);
+       ret = fread(tmp, 1, sizeof(tmp) - 1, f);
        if (ferror(f) || ret < 0) {
                td_verror(td, errno, "fread");
                fclose(f);
                return 1;
        }
+       tmp[ret] = '\0';
        /*
-        * either a list of io schedulers or "none\n" is expected.
+        * either a list of io schedulers or "none\n" is expected. Strip the
+        * trailing newline.
         */
-       tmp[strlen(tmp) - 1] = '\0';
+       p = tmp;
+       strsep(&p, "\n");
 
        /*
         * Write to "none" entry doesn't fail, so check the result here.
index 970974a00f274ee6e1640c84c1145c13a146c54c..ea1a4d292d9899abf1b0bd9638673b020a08fbda 100644 (file)
--- a/client.c
+++ b/client.c
@@ -1339,7 +1339,7 @@ static int fio_client_handle_iolog(struct fio_client *client,
        sprintf(log_pathname, "%s.%s", pdu->name, client->hostname);
 
        if (store_direct) {
-               ssize_t ret;
+               ssize_t wrote;
                size_t sz;
                int fd;
 
@@ -1353,10 +1353,10 @@ static int fio_client_handle_iolog(struct fio_client *client,
                }
 
                sz = cmd->pdu_len - sizeof(*pdu);
-               ret = write(fd, pdu->samples, sz);
+               wrote = write(fd, pdu->samples, sz);
                close(fd);
 
-               if (ret != sz) {
+               if (wrote != sz) {
                        log_err("fio: short write on compressed log\n");
                        ret = 1;
                        goto out;
index a5c0f6ef84482d95fa0e7c2fbf45591a7921b134..32baec64097254a62503a6e8bdc928d8d90cd731 100755 (executable)
--- a/configure
+++ b/configure
@@ -609,7 +609,7 @@ int main(void)
 EOF
 if compile_prog "" "" "posixaio" ; then
   posix_aio="yes"
-elif compile_prog "" "-lrt" "posixaio"; then
+elif compile_prog "" "-lrt" "posixaio -lrt"; then
   posix_aio="yes"
   posix_aio_lrt="yes"
   LIBS="-lrt $LIBS"
@@ -2117,18 +2117,23 @@ if test "$march_armv8_a_crc_crypto" != "yes" ; then
 fi
 if test "$cpu" = "arm64" ; then
   cat > $TMPC <<EOF
-#include <sys/auxv.h>
 #include <arm_acle.h>
 #include <arm_neon.h>
+#include <sys/auxv.h>
 
 int main(void)
 {
-  return 0;
+  /* Can we also do a runtime probe? */
+#if __linux__
+  return getauxval(AT_HWCAP);
+#else
+# error "Don't know how to do runtime probe for ARM CRC32c"
+#endif
 }
 EOF
-  if compile_prog "-march=armv8-a+crc+crypto" "" ""; then
+  if compile_prog "-march=armv8-a+crc+crypto" "" "ARM CRC32c"; then
     march_armv8_a_crc_crypto="yes"
-    CFLAGS="$CFLAGS -march=armv8-a+crc+crypto -DARCH_HAVE_CRC_CRYPTO"
+    CFLAGS="$CFLAGS -march=armv8-a+crc+crypto"
     march_set="yes"
   fi
 fi
@@ -2430,6 +2435,9 @@ if test "$zlib" = "no" ; then
     echo "Note that some distros have separate packages for static libraries."
   fi
 fi
+if test "$march_armv8_a_crc_crypto" = "yes" ; then
+  output_sym "ARCH_HAVE_CRC_CRYPTO"
+fi
 if test "$cuda" = "yes" ; then
   output_sym "CONFIG_CUDA"
 fi
index 08177ba6cff66e78884eaed9148c6909a67097b8..11bfe5d5c0b212ee6548a4a473eaf00720fdf11b 100644 (file)
@@ -1,4 +1,9 @@
 #include "crc32c.h"
+#include "../os/os.h"
+
+bool crc32c_arm64_available = false;
+
+#ifdef ARCH_HAVE_CRC_CRYPTO
 
 #define CRC32C3X8(ITR) \
        crc1 = __crc32cd(crc1, *((const uint64_t *)data + 42*1 + (ITR)));\
        CRC32C3X8((ITR)*7+6) \
        } while(0)
 
-#ifndef HWCAP_CRC32
-#define HWCAP_CRC32             (1 << 7)
-#endif /* HWCAP_CRC32 */
-
-bool crc32c_arm64_available = false;
-
-#ifdef ARCH_HAVE_ARM64_CRC_CRYPTO
-
-#include <sys/auxv.h>
 #include <arm_acle.h>
 #include <arm_neon.h>
 
@@ -102,13 +98,10 @@ uint32_t crc32c_arm64(unsigned char const *data, unsigned long length)
 
 void crc32c_arm64_probe(void)
 {
-       unsigned long hwcap;
-
        if (!crc32c_probed) {
-               hwcap = getauxval(AT_HWCAP);
-               crc32c_arm64_available = (hwcap & HWCAP_CRC32) != 0;
+               crc32c_arm64_available = os_cpu_has(CPU_ARM64_CRC32C);
                crc32c_probed = true;
        }
 }
 
-#endif /* ARCH_HAVE_ARM64_CRC_CRYPTO */
+#endif /* ARCH_HAVE_CRC_CRYPTO */
index 9a2cefdedcaf288fa5a302c952f21410353b88ea..6e810a28f93608dfafcaac4bb6dec03bea526554 100644 (file)
@@ -84,4 +84,4 @@ void crc32c_intel_probe(void)
        }
 }
 
-#endif /* ARCH_HAVE_SSE */
+#endif /* ARCH_HAVE_SSE4_2 */
index 60f60141966e90211f277fc5ab6dec563145f83e..18f1161d0a7127cda69eb492574d7b4a8fd8fcb3 100644 (file)
@@ -27,7 +27,7 @@ extern uint32_t crc32c_sw(unsigned char const *, unsigned long);
 extern bool crc32c_arm64_available;
 extern bool crc32c_intel_available;
 
-#ifdef ARCH_HAVE_ARM64_CRC_CRYPTO
+#ifdef ARCH_HAVE_CRC_CRYPTO
 extern uint32_t crc32c_arm64(unsigned char const *, unsigned long);
 extern void crc32c_arm64_probe(void);
 #else
@@ -35,7 +35,7 @@ extern void crc32c_arm64_probe(void);
 static inline void crc32c_arm64_probe(void)
 {
 }
-#endif
+#endif /* ARCH_HAVE_CRC_CRYPTO */
 
 #ifdef ARCH_HAVE_SSE4_2
 extern uint32_t crc32c_intel(unsigned char const *, unsigned long);
@@ -45,7 +45,7 @@ extern void crc32c_intel_probe(void);
 static inline void crc32c_intel_probe(void)
 {
 }
-#endif
+#endif /* ARCH_HAVE_SSE4_2 */
 
 static inline uint32_t fio_crc32c(unsigned char const *buf, unsigned long len)
 {
diff --git a/engines/binject.c b/engines/binject.c
deleted file mode 100644 (file)
index 49042a3..0000000
+++ /dev/null
@@ -1,458 +0,0 @@
-/*
- * binject engine
- *
- * IO engine that uses the Linux binject interface to directly inject
- * bio's to block devices.
- *
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <errno.h>
-#include <assert.h>
-#include <string.h>
-#include <poll.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include "../fio.h"
-
-#ifdef FIO_HAVE_BINJECT
-
-struct binject_data {
-       struct b_user_cmd *cmds;
-       struct io_u **events;
-       struct pollfd *pfds;
-       int *fd_flags;
-};
-
-struct binject_file {
-       unsigned int bs;
-       int minor;
-       int fd;
-};
-
-static void binject_buc_init(struct binject_data *bd, struct io_u *io_u)
-{
-       struct b_user_cmd *buc = &io_u->buc;
-
-       memset(buc, 0, sizeof(*buc));
-       binject_buc_set_magic(buc);
-
-       buc->buf = (unsigned long) io_u->xfer_buf;
-       buc->len = io_u->xfer_buflen;
-       buc->offset = io_u->offset;
-       buc->usr_ptr = (unsigned long) io_u;
-
-       buc->flags = B_FLAG_NOIDLE | B_FLAG_UNPLUG;
-       assert(buc->buf);
-}
-
-static int pollin_events(struct pollfd *pfds, int fds)
-{
-       int i;
-
-       for (i = 0; i < fds; i++)
-               if (pfds[i].revents & POLLIN)
-                       return 1;
-
-       return 0;
-}
-
-static unsigned int binject_read_commands(struct thread_data *td, void *buf,
-                                         int left, int *err)
-{
-       struct fio_file *f;
-       int i, ret, events;
-       char *p = buf;
-
-one_more:
-       events = 0;
-       for_each_file(td, f, i) {
-               struct binject_file *bf = FILE_ENG_DATA(f);
-
-               ret = read(bf->fd, p, left * sizeof(struct b_user_cmd));
-               if (ret < 0) {
-                       if (errno == EAGAIN)
-                               continue;
-                       *err = -errno;
-                       td_verror(td, errno, "read");
-                       break;
-               } else if (ret) {
-                       p += ret;
-                       events += ret / sizeof(struct b_user_cmd);
-               }
-       }
-
-       if (*err || events)
-               return events;
-
-       usleep(1000);
-       goto one_more;
-}
-
-static int fio_binject_getevents(struct thread_data *td, unsigned int min,
-                                unsigned int max,
-                                const struct timespec fio_unused *t)
-{
-       struct binject_data *bd = td->io_ops_data;
-       int left = max, ret, r = 0, ev_index = 0;
-       void *buf = bd->cmds;
-       unsigned int i, events;
-       struct fio_file *f;
-
-       /*
-        * Fill in the file descriptors
-        */
-       for_each_file(td, f, i) {
-               struct binject_file *bf = FILE_ENG_DATA(f);
-
-               /*
-                * don't block for min events == 0
-                */
-               if (!min)
-                       bd->fd_flags[i] = fio_set_fd_nonblocking(bf->fd, "binject");
-               else
-                       bd->fd_flags[i] = -1;
-
-               bd->pfds[i].fd = bf->fd;
-               bd->pfds[i].events = POLLIN;
-       }
-
-       while (left) {
-               while (!min) {
-                       ret = poll(bd->pfds, td->o.nr_files, -1);
-                       if (ret < 0) {
-                               if (!r)
-                                       r = -errno;
-                               td_verror(td, errno, "poll");
-                               break;
-                       } else if (!ret)
-                               continue;
-
-                       if (pollin_events(bd->pfds, td->o.nr_files))
-                               break;
-               }
-
-               if (r < 0)
-                       break;
-
-               events = binject_read_commands(td, buf, left, &r);
-
-               if (r < 0)
-                       break;
-
-               left -= events;
-               r += events;
-
-               for (i = 0; i < events; i++) {
-                       struct b_user_cmd *buc = (struct b_user_cmd *) buf + i;
-
-                       bd->events[ev_index] = (struct io_u *) (unsigned long) buc->usr_ptr;
-                       ev_index++;
-               }
-       }
-
-       if (!min) {
-               for_each_file(td, f, i) {
-                       struct binject_file *bf = FILE_ENG_DATA(f);
-
-                       if (bd->fd_flags[i] == -1)
-                               continue;
-
-                       if (fcntl(bf->fd, F_SETFL, bd->fd_flags[i]) < 0)
-                               log_err("fio: binject failed to restore fcntl flags: %s\n", strerror(errno));
-               }
-       }
-
-       if (r > 0)
-               assert(ev_index == r);
-
-       return r;
-}
-
-static int fio_binject_doio(struct thread_data *td, struct io_u *io_u)
-{
-       struct b_user_cmd *buc = &io_u->buc;
-       struct binject_file *bf = FILE_ENG_DATA(io_u->file);
-       int ret;
-
-       ret = write(bf->fd, buc, sizeof(*buc));
-       if (ret < 0)
-               return ret;
-
-       return FIO_Q_QUEUED;
-}
-
-static int fio_binject_prep(struct thread_data *td, struct io_u *io_u)
-{
-       struct binject_data *bd = td->io_ops_data;
-       struct b_user_cmd *buc = &io_u->buc;
-       struct binject_file *bf = FILE_ENG_DATA(io_u->file);
-
-       if (io_u->xfer_buflen & (bf->bs - 1)) {
-               log_err("read/write not sector aligned\n");
-               return EINVAL;
-       }
-
-       if (io_u->ddir == DDIR_READ) {
-               binject_buc_init(bd, io_u);
-               buc->type = B_TYPE_READ;
-       } else if (io_u->ddir == DDIR_WRITE) {
-               binject_buc_init(bd, io_u);
-               if (io_u->flags & IO_U_F_BARRIER)
-                       buc->type = B_TYPE_WRITEBARRIER;
-               else
-                       buc->type = B_TYPE_WRITE;
-       } else if (io_u->ddir == DDIR_TRIM) {
-               binject_buc_init(bd, io_u);
-               buc->type = B_TYPE_DISCARD;
-       } else {
-               assert(0);
-       }
-
-       return 0;
-}
-
-static int fio_binject_queue(struct thread_data *td, struct io_u *io_u)
-{
-       int ret;
-
-       fio_ro_check(td, io_u);
-
-       ret = fio_binject_doio(td, io_u);
-
-       if (ret < 0)
-               io_u->error = errno;
-
-       if (io_u->error) {
-               td_verror(td, io_u->error, "xfer");
-               return FIO_Q_COMPLETED;
-       }
-
-       return ret;
-}
-
-static struct io_u *fio_binject_event(struct thread_data *td, int event)
-{
-       struct binject_data *bd = td->io_ops_data;
-
-       return bd->events[event];
-}
-
-static int binject_open_ctl(struct thread_data *td)
-{
-       int fd;
-
-       fd = open("/dev/binject-ctl", O_RDWR);
-       if (fd < 0)
-               td_verror(td, errno, "open binject-ctl");
-
-       return fd;
-}
-
-static void binject_unmap_dev(struct thread_data *td, struct binject_file *bf)
-{
-       struct b_ioctl_cmd bic;
-       int fdb;
-
-       if (bf->fd >= 0) {
-               close(bf->fd);
-               bf->fd = -1;
-       }
-
-       fdb = binject_open_ctl(td);
-       if (fdb < 0)
-               return;
-
-       bic.minor = bf->minor;
-
-       if (ioctl(fdb, B_IOCTL_DEL, &bic) < 0)
-               td_verror(td, errno, "binject dev unmap");
-
-       close(fdb);
-}
-
-static int binject_map_dev(struct thread_data *td, struct binject_file *bf,
-                          int fd)
-{
-       struct b_ioctl_cmd bic;
-       char name[80];
-       struct stat sb;
-       int fdb, dev_there, loops;
-
-       fdb = binject_open_ctl(td);
-       if (fdb < 0)
-               return 1;
-
-       bic.fd = fd;
-
-       if (ioctl(fdb, B_IOCTL_ADD, &bic) < 0) {
-               td_verror(td, errno, "binject dev map");
-               close(fdb);
-               return 1;
-       }
-
-       bf->minor = bic.minor;
-
-       sprintf(name, "/dev/binject%u", bf->minor);
-
-       /*
-        * Wait for udev to create the node...
-        */
-       dev_there = loops = 0;
-       do {
-               if (!stat(name, &sb)) {
-                       dev_there = 1;
-                       break;
-               }
-
-               usleep(10000);
-       } while (++loops < 100);
-
-       close(fdb);
-
-       if (!dev_there) {
-               log_err("fio: timed out waiting for binject dev\n");
-               goto err_unmap;
-       }
-
-       bf->fd = open(name, O_RDWR);
-       if (bf->fd < 0) {
-               td_verror(td, errno, "binject dev open");
-err_unmap:
-               binject_unmap_dev(td, bf);
-               return 1;
-       }
-
-       return 0;
-}
-
-static int fio_binject_close_file(struct thread_data *td, struct fio_file *f)
-{
-       struct binject_file *bf = FILE_ENG_DATA(f);
-
-       if (bf) {
-               binject_unmap_dev(td, bf);
-               free(bf);
-               FILE_SET_ENG_DATA(f, NULL);
-               return generic_close_file(td, f);
-       }
-
-       return 0;
-}
-
-static int fio_binject_open_file(struct thread_data *td, struct fio_file *f)
-{
-       struct binject_file *bf;
-       unsigned int bs;
-       int ret;
-
-       ret = generic_open_file(td, f);
-       if (ret)
-               return 1;
-
-       if (f->filetype != FIO_TYPE_BLOCK) {
-               log_err("fio: binject only works with block devices\n");
-               goto err_close;
-       }
-       if (ioctl(f->fd, BLKSSZGET, &bs) < 0) {
-               td_verror(td, errno, "BLKSSZGET");
-               goto err_close;
-       }
-
-       bf = malloc(sizeof(*bf));
-       bf->bs = bs;
-       bf->minor = bf->fd = -1;
-       FILE_SET_ENG_DATA(f, bf);
-
-       if (binject_map_dev(td, bf, f->fd)) {
-err_close:
-               ret = generic_close_file(td, f);
-               return 1;
-       }
-
-       return 0;
-}
-
-static void fio_binject_cleanup(struct thread_data *td)
-{
-       struct binject_data *bd = td->io_ops_data;
-
-       if (bd) {
-               free(bd->events);
-               free(bd->cmds);
-               free(bd->fd_flags);
-               free(bd->pfds);
-               free(bd);
-       }
-}
-
-static int fio_binject_init(struct thread_data *td)
-{
-       struct binject_data *bd;
-
-       bd = malloc(sizeof(*bd));
-       memset(bd, 0, sizeof(*bd));
-
-       bd->cmds = malloc(td->o.iodepth * sizeof(struct b_user_cmd));
-       memset(bd->cmds, 0, td->o.iodepth * sizeof(struct b_user_cmd));
-
-       bd->events = malloc(td->o.iodepth * sizeof(struct io_u *));
-       memset(bd->events, 0, td->o.iodepth * sizeof(struct io_u *));
-
-       bd->pfds = malloc(sizeof(struct pollfd) * td->o.nr_files);
-       memset(bd->pfds, 0, sizeof(struct pollfd) * td->o.nr_files);
-
-       bd->fd_flags = malloc(sizeof(int) * td->o.nr_files);
-       memset(bd->fd_flags, 0, sizeof(int) * td->o.nr_files);
-
-       td->io_ops_data = bd;
-       return 0;
-}
-
-static struct ioengine_ops ioengine = {
-       .name           = "binject",
-       .version        = FIO_IOOPS_VERSION,
-       .init           = fio_binject_init,
-       .prep           = fio_binject_prep,
-       .queue          = fio_binject_queue,
-       .getevents      = fio_binject_getevents,
-       .event          = fio_binject_event,
-       .cleanup        = fio_binject_cleanup,
-       .open_file      = fio_binject_open_file,
-       .close_file     = fio_binject_close_file,
-       .get_file_size  = generic_get_file_size,
-       .flags          = FIO_RAWIO | FIO_BARRIER | FIO_MEMALIGN,
-};
-
-#else /* FIO_HAVE_BINJECT */
-
-/*
- * When we have a proper configure system in place, we simply wont build
- * and install this io engine. For now install a crippled version that
- * just complains and fails to load.
- */
-static int fio_binject_init(struct thread_data fio_unused *td)
-{
-       log_err("fio: ioengine binject not available\n");
-       return 1;
-}
-
-static struct ioengine_ops ioengine = {
-       .name           = "binject",
-       .version        = FIO_IOOPS_VERSION,
-       .init           = fio_binject_init,
-};
-
-#endif
-
-static void fio_init fio_binject_register(void)
-{
-       register_ioengine(&ioengine);
-}
-
-static void fio_exit fio_binject_unregister(void)
-{
-       unregister_ioengine(&ioengine);
-}
index 97271d67f13927f7c95e7e814df42df662f20058..eb8df453524d7d5de7dfbc3d84f53ae5d5fa57d7 100644 (file)
@@ -70,20 +70,17 @@ static void fio_gf_io_u_free(struct thread_data *td, struct io_u *io_u)
 
 static int fio_gf_io_u_init(struct thread_data *td, struct io_u *io_u)
 {
+    struct fio_gf_iou *io;
        dprint(FD_FILE, "%s\n", __FUNCTION__);
-
-       if (!io_u->engine_data) {
-               struct fio_gf_iou *io;
-
-               io = malloc(sizeof(struct fio_gf_iou));
-               if (!io) {
-                       td_verror(td, errno, "malloc");
-                       return 1;
-               }
-               io->io_complete = 0;
-               io->io_u = io_u;
-               io_u->engine_data = io;
-       }
+    
+    io = malloc(sizeof(struct fio_gf_iou));
+    if (!io) {
+        td_verror(td, errno, "malloc");
+        return 1;
+    }
+    io->io_complete = 0;
+    io->io_u = io_u;
+    io_u->engine_data = io;
        return 0;
 }
 
index 72eed8b30741dcad3def977fbb929280f2debdfb..c2c0de39ef82903464f728f3e4ea489de993f538 100644 (file)
@@ -287,11 +287,11 @@ static int fio_sgio_doio(struct thread_data *td, struct io_u *io_u, int do_sync)
 
        if (f->filetype == FIO_TYPE_BLOCK) {
                ret = fio_sgio_ioctl_doio(td, f, io_u);
-               td->error = io_u->error;
+               td_verror(td, io_u->error, __func__);
        } else {
                ret = fio_sgio_rw_doio(f, io_u, do_sync);
                if (do_sync)
-                       td->error = io_u->error;
+                       td_verror(td, io_u->error, __func__);
        }
 
        return ret;
diff --git a/eta.c b/eta.c
index 2d549ee9c8f4798154a1f3f9e515b6762cab0ebf..9111f5ec1e670bfc4177c12e24601795be291efb 100644 (file)
--- a/eta.c
+++ b/eta.c
@@ -149,7 +149,7 @@ void eta_to_str(char *str, unsigned long eta_sec)
                str += sprintf(str, "%02uh:", h);
 
        str += sprintf(str, "%02um:", m);
-       str += sprintf(str, "%02us", s);
+       sprintf(str, "%02us", s);
 }
 
 /*
@@ -621,7 +621,7 @@ void display_thread_status(struct jobs_eta *je)
                        free(iops_str[ddir]);
                }
        }
-       p += sprintf(p, "\r");
+       sprintf(p, "\r");
 
        printf("%s", output);
 
index b246e0f951e99c6534ad201e960b5ba7262812ad..75694bd81825082516d9f1601de08a650ebe9aa1 100644 (file)
@@ -490,7 +490,6 @@ static int __file_invalidate_cache(struct thread_data *td, struct fio_file *f,
        } else if (td_ioengine_flagged(td, FIO_DISKLESSIO)) {
                dprint(FD_IO, "invalidate not supported by ioengine %s\n",
                       td->io_ops->name);
-               ret = 0;
        } else if (f->filetype == FIO_TYPE_FILE) {
                dprint(FD_IO, "declare unneeded cache %s: %llu/%llu\n",
                        f->file_name, off, len);
@@ -517,14 +516,12 @@ static int __file_invalidate_cache(struct thread_data *td, struct fio_file *f,
                                log_err("fio: only root may flush block "
                                        "devices. Cache flush bypassed!\n");
                        }
-                       ret = 0;
                }
                if (ret < 0)
                        errval = errno;
        } else if (f->filetype == FIO_TYPE_CHAR ||
                   f->filetype == FIO_TYPE_PIPE) {
                dprint(FD_IO, "invalidate not supported %s\n", f->file_name);
-               ret = 0;
        }
 
        /*
diff --git a/fio.h b/fio.h
index 488fa9a62e4e7e10cce59da7517d0a5890bda26f..2bfcac457c217693f1bce4aa6c855a2a67f6e014 100644 (file)
--- a/fio.h
+++ b/fio.h
@@ -79,7 +79,7 @@ enum {
        __TD_F_READ_IOLOG,
        __TD_F_REFILL_BUFFERS,
        __TD_F_SCRAMBLE_BUFFERS,
-       __TD_F_VER_NONE,
+       __TD_F_DO_VERIFY,
        __TD_F_PROFILE_OPS,
        __TD_F_COMPRESS,
        __TD_F_COMPRESS_LOG,
@@ -100,7 +100,7 @@ enum {
        TD_F_READ_IOLOG         = 1U << __TD_F_READ_IOLOG,
        TD_F_REFILL_BUFFERS     = 1U << __TD_F_REFILL_BUFFERS,
        TD_F_SCRAMBLE_BUFFERS   = 1U << __TD_F_SCRAMBLE_BUFFERS,
-       TD_F_VER_NONE           = 1U << __TD_F_VER_NONE,
+       TD_F_DO_VERIFY          = 1U << __TD_F_DO_VERIFY,
        TD_F_PROFILE_OPS        = 1U << __TD_F_PROFILE_OPS,
        TD_F_COMPRESS           = 1U << __TD_F_COMPRESS,
        TD_F_COMPRESS_LOG       = 1U << __TD_F_COMPRESS_LOG,
diff --git a/init.c b/init.c
index ab7e399752dbad7e763a0e727ad4ec4daa1ba7ef..f5ff73d067bb62229b3a45e4d9fe74ffc31f3bb0 100644 (file)
--- a/init.c
+++ b/init.c
@@ -1184,7 +1184,7 @@ static void init_flags(struct thread_data *td)
            fio_option_is_set(o, zero_buffers)))
                td->flags |= TD_F_SCRAMBLE_BUFFERS;
        if (o->verify != VERIFY_NONE)
-               td->flags |= TD_F_VER_NONE;
+               td->flags |= TD_F_DO_VERIFY;
 
        if (o->verify_async || o->io_submit_mode == IO_MODE_OFFLOAD)
                td->flags |= TD_F_NEED_LOCK;
@@ -1970,7 +1970,8 @@ static int __parse_jobs_ini(struct thread_data *td,
                        if (p[0] == '[') {
                                if (nested) {
                                        log_err("No new sections in included files\n");
-                                       return 1;
+                                       ret = 1;
+                                       goto out;
                                }
 
                                skip_fgets = 1;
diff --git a/io_u.c b/io_u.c
index 98a7dc560600ce7c7fc8cfa191e734e5cee29276..5fbb2386237de6ba8aa106917e9f222ae564e014 100644 (file)
--- a/io_u.c
+++ b/io_u.c
@@ -1699,7 +1699,7 @@ static void small_content_scramble(struct io_u *io_u)
 
 /*
  * Return an io_u to be processed. Gets a buflen and offset, sets direction,
- * etc. The returned io_u is fully ready to be prepped and submitted.
+ * etc. The returned io_u is fully ready to be prepped, populated and submitted.
  */
 struct io_u *get_io_u(struct thread_data *td)
 {
@@ -1760,12 +1760,9 @@ struct io_u *get_io_u(struct thread_data *td)
                                        td->o.min_bs[DDIR_WRITE],
                                        io_u->buflen);
                        } else if ((td->flags & TD_F_SCRAMBLE_BUFFERS) &&
-                                  !(td->flags & TD_F_COMPRESS))
+                                  !(td->flags & TD_F_COMPRESS) &&
+                                  !(td->flags & TD_F_DO_VERIFY))
                                do_scramble = 1;
-                       if (td->flags & TD_F_VER_NONE) {
-                               populate_verify_io_u(td, io_u);
-                               do_scramble = 0;
-                       }
                } else if (io_u->ddir == DDIR_READ) {
                        /*
                         * Reset the buf_filled parameters so next time if the
diff --git a/io_u.h b/io_u.h
index aaa7d9723ef68db6bedc9809483a59b3e3efcb39..4f433c3f314989758df380c32399210a86ed9572 100644 (file)
--- a/io_u.h
+++ b/io_u.h
@@ -113,9 +113,6 @@ struct io_u {
 #ifdef CONFIG_SOLARISAIO
                aio_result_t resultp;
 #endif
-#ifdef FIO_HAVE_BINJECT
-               struct b_user_cmd buc;
-#endif
 #ifdef CONFIG_RDMA
                struct ibv_mr *mr;
 #endif
diff --git a/iolog.c b/iolog.c
index 2b5eaf0c52dac715e971e26915d3015f9c274c2c..bfafc032f4bc63dc03964d4b050d2a0089723916 100644 (file)
--- a/iolog.c
+++ b/iolog.c
@@ -978,7 +978,7 @@ int iolog_file_inflate(const char *file)
        struct iolog_compress ic;
        z_stream stream;
        struct stat sb;
-       ssize_t ret;
+       size_t ret;
        size_t total;
        void *buf;
        FILE *f;
@@ -1000,12 +1000,12 @@ int iolog_file_inflate(const char *file)
        ic.seq = 1;
 
        ret = fread(ic.buf, ic.len, 1, f);
-       if (ret < 0) {
+       if (ret == 0 && ferror(f)) {
                perror("fread");
                fclose(f);
                free(buf);
                return 1;
-       } else if (ret != 1) {
+       } else if (ferror(f) || (!feof(f) && ret != 1)) {
                log_err("fio: short read on reading log\n");
                fclose(f);
                free(buf);
index bf203dfe7b2d0ba379ee09b06a6924c3bd00fd03..3c65308cde18e61c116a322fa0b2df6b740cfb16 100644 (file)
@@ -102,7 +102,7 @@ struct axmap *axmap_new(unsigned long nr_bits)
        }
 
        axmap->nr_levels = levels;
-       axmap->levels = malloc(axmap->nr_levels * sizeof(struct axmap_level));
+       axmap->levels = calloc(axmap->nr_levels, sizeof(struct axmap_level));
        axmap->nr_bits = nr_bits;
 
        for (i = 0; i < axmap->nr_levels; i++) {
index 45a5b82be4f2789629dd1f5a6d32a7e6c24938de..fae3943423e9c2d02d22e5ffa8c4b00c9fba128e 100644 (file)
--- a/options.c
+++ b/options.c
@@ -1517,7 +1517,7 @@ static int str_ioengine_external_cb(void *data, const char *str)
        return 0;
 }
 
-static int rw_verify(struct fio_option *o, void *data)
+static int rw_verify(const struct fio_option *o, void *data)
 {
        struct thread_data *td = cb_data_to_td(data);
 
@@ -1530,7 +1530,7 @@ static int rw_verify(struct fio_option *o, void *data)
        return 0;
 }
 
-static int gtod_cpu_verify(struct fio_option *o, void *data)
+static int gtod_cpu_verify(const struct fio_option *o, void *data)
 {
 #ifndef FIO_HAVE_CPU_AFFINITY
        struct thread_data *td = cb_data_to_td(data);
@@ -1816,11 +1816,6 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                            .help = "GUASI IO engine",
                          },
 #endif
-#ifdef FIO_HAVE_BINJECT
-                         { .ival = "binject",
-                           .help = "binject direct inject block engine",
-                         },
-#endif
 #ifdef CONFIG_RDMA
                          { .ival = "rdma",
                            .help = "RDMA IO engine",
@@ -4904,7 +4899,7 @@ int fio_options_parse(struct thread_data *td, char **opts, int num_opts)
        opts_copy = dup_and_sub_options(opts, num_opts);
 
        for (ret = 0, i = 0, unknown = 0; i < num_opts; i++) {
-               struct fio_option *o;
+               const struct fio_option *o;
                int newret = parse_option(opts_copy[i], opts[i], fio_options,
                                                &o, &td->o, &td->opt_list);
 
@@ -4930,7 +4925,7 @@ int fio_options_parse(struct thread_data *td, char **opts, int num_opts)
                        opts = opts_copy;
                }
                for (i = 0; i < num_opts; i++) {
-                       struct fio_option *o = NULL;
+                       const struct fio_option *o = NULL;
                        int newret = 1;
 
                        if (!opts_copy[i])
@@ -4961,9 +4956,9 @@ int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val)
 
        ret = parse_cmd_option(opt, val, fio_options, &td->o, &td->opt_list);
        if (!ret) {
-               struct fio_option *o;
+               const struct fio_option *o;
 
-               o = find_option(fio_options, opt);
+               o = find_option_c(fio_options, opt);
                if (o)
                        fio_option_mark_set(&td->o, o);
        }
@@ -5028,7 +5023,7 @@ unsigned int fio_get_kb_base(void *data)
        return kb_base;
 }
 
-int add_option(struct fio_option *o)
+int add_option(const struct fio_option *o)
 {
        struct fio_option *__o;
        int opt_index = 0;
@@ -5165,7 +5160,7 @@ bool __fio_option_is_set(struct thread_options *o, unsigned int off1)
        return false;
 }
 
-void fio_option_mark_set(struct thread_options *o, struct fio_option *opt)
+void fio_option_mark_set(struct thread_options *o, const struct fio_option *opt)
 {
        unsigned int opt_off, index, offset;
 
index 59024efc8af9a90bfa3f52e73f02de0c38214a58..e53eb1bc98155984e4f4990edd670d5ad5ebecf2 100644 (file)
--- a/options.h
+++ b/options.h
@@ -8,7 +8,7 @@
 #include "parse.h"
 #include "lib/types.h"
 
-int add_option(struct fio_option *);
+int add_option(const struct fio_option *);
 void invalidate_profile_options(const char *);
 extern char *exec_profile;
 
@@ -31,9 +31,10 @@ extern bool __fio_option_is_set(struct thread_options *, unsigned int off);
        __r;                                                            \
 })
 
-extern void fio_option_mark_set(struct thread_options *, struct fio_option *);
+extern void fio_option_mark_set(struct thread_options *,
+                               const struct fio_option *);
 
-static inline bool o_match(struct fio_option *o, const char *opt)
+static inline bool o_match(const struct fio_option *o, const char *opt)
 {
        if (!strcmp(o->name, opt))
                return true;
@@ -44,6 +45,8 @@ static inline bool o_match(struct fio_option *o, const char *opt)
 }
 
 extern struct fio_option *find_option(struct fio_option *, const char *);
+extern const struct fio_option *
+find_option_c(const struct fio_option *, const char *);
 extern struct fio_option *fio_option_find(const char *);
 extern unsigned int fio_get_kb_base(void *);
 
diff --git a/os/binject.h b/os/binject.h
deleted file mode 100644 (file)
index 1d862c8..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-#ifndef BINJECT_H
-#define BINJECT_H
-
-#include <linux/types.h>
-
-#define BINJECT_MAGIC          0x89
-#define BINJECT_VER            0x01
-#define BINJECT_MAGIC_SHIFT    8
-#define BINJECT_VER_MASK       ((1 << BINJECT_MAGIC_SHIFT) - 1)
-
-struct b_user_cmd {
-       __u16 magic;    /* INPUT */
-       __u16 type;     /* INPUT */
-       __u32 error;    /* OUTPUT */
-       __u32 flags;    /* INPUT */
-       __u32 len;      /* INPUT */
-       __u64 offset;   /* INPUT */
-       __u64 buf;      /* INPUT */
-       __u64 usr_ptr;  /* PASSED THROUGH */
-       __u64 nsec;     /* OUTPUT */
-};
-
-struct b_ioctl_cmd {
-       int fd;
-       int minor;
-};
-
-#define BINJECT_IOCTL_CHR      'J'
-#define B_IOCTL_ADD            _IOWR(BINJECT_IOCTL_CHR, 1, struct b_ioctl_cmd)
-#define B_IOCTL_DEL            _IOWR(BINJECT_IOCTL_CHR, 2, struct b_ioctl_cmd)
-
-enum {
-       B_TYPE_READ             = 0,
-       B_TYPE_WRITE,
-       B_TYPE_DISCARD,
-       B_TYPE_READVOID,
-       B_TYPE_WRITEZERO,
-       B_TYPE_READBARRIER,
-       B_TYPE_WRITEBARRIER,
-       B_TYPE_NR
-};
-
-enum {
-       __B_FLAG_SYNC   = 0,
-       __B_FLAG_UNPLUG,
-       __B_FLAG_NOIDLE,
-       __B_FLAG_BARRIER,
-       __B_FLAG_META,
-       __B_FLAG_RAHEAD,
-       __B_FLAG_FAILFAST_DEV,
-       __B_FLAG_FAILFAST_TRANSPORT,
-       __B_FLAG_FAILFAST_DRIVER,
-       __B_FLAG_NR,
-
-       B_FLAG_SYNC                     = 1 << __B_FLAG_SYNC,
-       B_FLAG_UNPLUG                   = 1 << __B_FLAG_UNPLUG,
-       B_FLAG_NOIDLE                   = 1 << __B_FLAG_NOIDLE,
-       B_FLAG_BARRIER                  = 1 << __B_FLAG_BARRIER,
-       B_FLAG_META                     = 1 << __B_FLAG_META,
-       B_FLAG_RAHEAD                   = 1 << __B_FLAG_RAHEAD,
-       B_FLAG_FAILFAST_DEV             = 1 << __B_FLAG_FAILFAST_DEV,
-       B_FLAG_FAILFAST_TRANSPORT       = 1 << __B_FLAG_FAILFAST_TRANSPORT,
-       B_FLAG_FAILFAST_DRIVER          = 1 << __B_FLAG_FAILFAST_DRIVER,
-};
-
-static inline void binject_buc_set_magic(struct b_user_cmd *buc)
-{
-       buc->magic = (BINJECT_MAGIC << BINJECT_MAGIC_SHIFT) | BINJECT_VER;
-}
-
-#endif
index bb590e4786fe3f713ed7e1a1914963ecc9dc1276..1483275e9e631aa751c690995308085a3a47fbca 100644 (file)
@@ -18,7 +18,6 @@
 #include <asm/byteorder.h>
 
 #include "./os-linux-syscall.h"
-#include "binject.h"
 #include "../file.h"
 
 #ifndef __has_builtin         // Optional of course.
index 713046f53543442a89d21c55ace2cbcd05839d4b..e80ad8cd906ea72b4bde0b66b7bc7f2a462487ba 100644 (file)
 #include <sys/sysctl.h>
 #include <sys/statvfs.h>
 #include <sys/diskslice.h>
-#include <sys/ioctl_compat.h>
 #include <sys/usched.h>
 #include <sys/resource.h>
 
+/* API changed during "5.3 development" */
+#if __DragonFly_version < 500302
+#include <sys/ioctl_compat.h>
+#define DAIOCTRIM      IOCTLTRIM
+#else
+#include <bus/cam/scsi/scsi_daio.h>
+#endif
+
 #include "../file.h"
 #include "../lib/types.h"
 
@@ -222,7 +229,7 @@ static inline int os_trim(struct fio_file *f, unsigned long long start,
        range[0] = start;
        range[1] = len;
 
-       if (!ioctl(f->fd, IOCTLTRIM, range))
+       if (!ioctl(f->fd, DAIOCTRIM, range))
                return 0;
 
        return errno;
index 894dc850904f0717d745ac61ce2805e349aff210..a550bba6e1b3d785d554564258840874c93e8104 100644 (file)
 #include <linux/fs.h>
 #include <scsi/sg.h>
 
+#ifdef ARCH_HAVE_CRC_CRYPTO
+#include <sys/auxv.h>
+#ifndef HWCAP_CRC32
+#define HWCAP_CRC32             (1 << 7)
+#endif /* HWCAP_CRC32 */
+#endif /* ARCH_HAVE_CRC_CRYPTO */
+
 #include "./os-linux-syscall.h"
-#include "binject.h"
 #include "../file.h"
 
 #ifndef __has_builtin         // Optional of course.
@@ -41,7 +47,6 @@
 #define FIO_HAVE_CGROUPS
 #define FIO_HAVE_FS_STAT
 #define FIO_HAVE_TRIM
-#define FIO_HAVE_BINJECT
 #define FIO_HAVE_GETTID
 #define FIO_USE_GENERIC_INIT_RANDOM_STATE
 #define FIO_HAVE_PWRITEV2
@@ -410,4 +415,24 @@ static inline bool fio_fallocate(struct fio_file *f, uint64_t offset,
 }
 #endif
 
+#define FIO_HAVE_CPU_HAS
+static inline bool os_cpu_has(cpu_features feature)
+{
+       bool have_feature;
+       unsigned long fio_unused hwcap;
+
+       switch (feature) {
+#ifdef ARCH_HAVE_CRC_CRYPTO
+       case CPU_ARM64_CRC32C:
+               hwcap = getauxval(AT_HWCAP);
+               have_feature = (hwcap & HWCAP_CRC32) != 0;
+               break;
+#endif
+       default:
+               have_feature = false;
+       }
+
+       return have_feature;
+}
+
 #endif
diff --git a/os/os.h b/os/os.h
index 95ed7cf2d7cd169c173d9dd971db01ac6b9d734b..becc41033e4a8c8db674abf78b2c9ed42f003c69 100644 (file)
--- a/os/os.h
+++ b/os/os.h
@@ -27,6 +27,10 @@ enum {
        os_nr,
 };
 
+typedef enum {
+        CPU_ARM64_CRC32C,
+} cpu_features;
+
 /* IWYU pragma: begin_exports */
 #if defined(__ANDROID__)
 #include "os-android.h"
@@ -387,4 +391,11 @@ static inline bool fio_fallocate(struct fio_file *f, uint64_t offset, uint64_t l
 # define FIO_HAVE_ANY_FALLOCATE
 #endif
 
+#ifndef FIO_HAVE_CPU_HAS
+static inline bool os_cpu_has(cpu_features feature)
+{
+       return false;
+}
+#endif
+
 #endif
diff --git a/parse.c b/parse.c
index 33fcf465ca5b9be90d670004604d6e51008ba27c..539c602865fbd3127c7dcdfb3ab06a4e758a50c0 100644 (file)
--- a/parse.c
+++ b/parse.c
@@ -39,7 +39,7 @@ static const char *opt_type_names[] = {
        "OPT_UNSUPPORTED",
 };
 
-static struct fio_option *__fio_options;
+static const struct fio_option *__fio_options;
 
 static int vp_cmp(const void *p1, const void *p2)
 {
@@ -49,7 +49,7 @@ static int vp_cmp(const void *p1, const void *p2)
        return strlen(vp2->ival) - strlen(vp1->ival);
 }
 
-static void posval_sort(struct fio_option *o, struct value_pair *vpmap)
+static void posval_sort(const struct fio_option *o, struct value_pair *vpmap)
 {
        const struct value_pair *vp;
        int entries;
@@ -67,16 +67,21 @@ static void posval_sort(struct fio_option *o, struct value_pair *vpmap)
        qsort(vpmap, entries, sizeof(struct value_pair), vp_cmp);
 }
 
-static void show_option_range(struct fio_option *o,
+static void show_option_range(const struct fio_option *o,
                              size_t (*logger)(const char *format, ...))
 {
        if (o->type == FIO_OPT_FLOAT_LIST) {
-               if (o->minfp == DBL_MIN && o->maxfp == DBL_MAX)
+               const char *sep = "";
+               if (!o->minfp && !o->maxfp)
                        return;
 
-               logger("%20s: min=%f", "range", o->minfp);
+               logger("%20s: ", "range");
+               if (o->minfp != DBL_MIN) {
+                       logger("min=%f", o->minfp);
+                       sep = ", ";
+               }
                if (o->maxfp != DBL_MAX)
-                       logger(", max=%f", o->maxfp);
+                       logger("%smax=%f", sep, o->maxfp);
                logger("\n");
        } else if (!o->posval[0].ival) {
                if (!o->minval && !o->maxval)
@@ -89,7 +94,7 @@ static void show_option_range(struct fio_option *o,
        }
 }
 
-static void show_option_values(struct fio_option *o)
+static void show_option_values(const struct fio_option *o)
 {
        int i;
 
@@ -109,7 +114,7 @@ static void show_option_values(struct fio_option *o)
                log_info("\n");
 }
 
-static void show_option_help(struct fio_option *o, int is_err)
+static void show_option_help(const struct fio_option *o, int is_err)
 {
        const char *typehelp[] = {
                "invalid",
@@ -484,7 +489,7 @@ static int str_match_len(const struct value_pair *vp, const char *str)
                        *ptr = (val);                   \
        } while (0)
 
-static const char *opt_type_name(struct fio_option *o)
+static const char *opt_type_name(const struct fio_option *o)
 {
        compiletime_assert(ARRAY_SIZE(opt_type_names) - 1 == FIO_OPT_UNSUPPORTED,
                                "opt_type_names[] index");
@@ -495,8 +500,8 @@ static const char *opt_type_name(struct fio_option *o)
        return "OPT_UNKNOWN?";
 }
 
-static int __handle_option(struct fio_option *o, const char *ptr, void *data,
-                          int first, int more, int curr)
+static int __handle_option(const struct fio_option *o, const char *ptr,
+                          void *data, int first, int more, int curr)
 {
        int il=0, *ilp;
        fio_fp64_t *flp;
@@ -668,15 +673,17 @@ static int __handle_option(struct fio_option *o, const char *ptr, void *data,
                        log_err("not a floating point value: %s\n", ptr);
                        return 1;
                }
-               if (uf > o->maxfp) {
-                       log_err("value out of range: %f"
-                               " (range max: %f)\n", uf, o->maxfp);
-                       return 1;
-               }
-               if (uf < o->minfp) {
-                       log_err("value out of range: %f"
-                               " (range min: %f)\n", uf, o->minfp);
-                       return 1;
+               if (o->minfp || o->maxfp) {
+                       if (uf > o->maxfp) {
+                               log_err("value out of range: %f"
+                                       " (range max: %f)\n", uf, o->maxfp);
+                               return 1;
+                       }
+                       if (uf < o->minfp) {
+                               log_err("value out of range: %f"
+                                       " (range min: %f)\n", uf, o->minfp);
+                               return 1;
+                       }
                }
 
                flp = td_var(data, o, o->off1);
@@ -892,7 +899,8 @@ static int __handle_option(struct fio_option *o, const char *ptr, void *data,
        return ret;
 }
 
-static int handle_option(struct fio_option *o, const char *__ptr, void *data)
+static int handle_option(const struct fio_option *o, const char *__ptr,
+                        void *data)
 {
        char *o_ptr, *ptr, *ptr2;
        int ret, done;
@@ -970,11 +978,16 @@ struct fio_option *find_option(struct fio_option *options, const char *opt)
        return NULL;
 }
 
+const struct fio_option *
+find_option_c(const struct fio_option *options, const char *opt)
+{
+       return find_option((struct fio_option *)options, opt);
+}
 
-static struct fio_option *get_option(char *opt,
-                                    struct fio_option *options, char **post)
+static const struct fio_option *
+get_option(char *opt, const struct fio_option *options, char **post)
 {
-       struct fio_option *o;
+       const struct fio_option *o;
        char *ret;
 
        ret = strchr(opt, '=');
@@ -984,9 +997,9 @@ static struct fio_option *get_option(char *opt,
                ret = opt;
                (*post)++;
                strip_blank_end(ret);
-               o = find_option(options, ret);
+               o = find_option_c(options, ret);
        } else {
-               o = find_option(options, opt);
+               o = find_option_c(options, opt);
                *post = NULL;
        }
 
@@ -995,7 +1008,7 @@ static struct fio_option *get_option(char *opt,
 
 static int opt_cmp(const void *p1, const void *p2)
 {
-       struct fio_option *o;
+       const struct fio_option *o;
        char *s, *foo;
        int prio1, prio2;
 
@@ -1019,15 +1032,15 @@ static int opt_cmp(const void *p1, const void *p2)
        return prio2 - prio1;
 }
 
-void sort_options(char **opts, struct fio_option *options, int num_opts)
+void sort_options(char **opts, const struct fio_option *options, int num_opts)
 {
        __fio_options = options;
        qsort(opts, num_opts, sizeof(char *), opt_cmp);
        __fio_options = NULL;
 }
 
-static void add_to_dump_list(struct fio_option *o, struct flist_head *dump_list,
-                            const char *post)
+static void add_to_dump_list(const struct fio_option *o,
+                            struct flist_head *dump_list, const char *post)
 {
        struct print_option *p;
 
@@ -1045,12 +1058,12 @@ static void add_to_dump_list(struct fio_option *o, struct flist_head *dump_list,
 }
 
 int parse_cmd_option(const char *opt, const char *val,
-                    struct fio_option *options, void *data,
+                    const struct fio_option *options, void *data,
                     struct flist_head *dump_list)
 {
-       struct fio_option *o;
+       const struct fio_option *o;
 
-       o = find_option(options, opt);
+       o = find_option_c(options, opt);
        if (!o) {
                log_err("Bad option <%s>\n", opt);
                return 1;
@@ -1065,8 +1078,8 @@ int parse_cmd_option(const char *opt, const char *val,
        return 0;
 }
 
-int parse_option(char *opt, const char *input,
-                struct fio_option *options, struct fio_option **o, void *data,
+int parse_option(char *opt, const char *input, const struct fio_option *options,
+                const struct fio_option **o, void *data,
                 struct flist_head *dump_list)
 {
        char *post;
@@ -1151,10 +1164,10 @@ int string_distance_ok(const char *opt, int distance)
        return distance <= len;
 }
 
-static struct fio_option *find_child(struct fio_option *options,
-                                    struct fio_option *o)
+static const struct fio_option *find_child(const struct fio_option *options,
+                                          const struct fio_option *o)
 {
-       struct fio_option *__o;
+       const struct fio_option *__o;
 
        for (__o = options + 1; __o->name; __o++)
                if (__o->parent && !strcmp(__o->parent, o->name))
@@ -1163,7 +1176,8 @@ static struct fio_option *find_child(struct fio_option *options,
        return NULL;
 }
 
-static void __print_option(struct fio_option *o, struct fio_option *org,
+static void __print_option(const struct fio_option *o,
+                          const struct fio_option *org,
                           int level)
 {
        char name[256], *p;
@@ -1171,8 +1185,6 @@ static void __print_option(struct fio_option *o, struct fio_option *org,
 
        if (!o)
                return;
-       if (!org)
-               org = o;
 
        p = name;
        depth = level;
@@ -1184,10 +1196,10 @@ static void __print_option(struct fio_option *o, struct fio_option *org,
        log_info("%-24s: %s\n", name, o->help);
 }
 
-static void print_option(struct fio_option *o)
+static void print_option(const struct fio_option *o)
 {
-       struct fio_option *parent;
-       struct fio_option *__o;
+       const struct fio_option *parent;
+       const struct fio_option *__o;
        unsigned int printed;
        unsigned int level;
 
@@ -1208,9 +1220,9 @@ static void print_option(struct fio_option *o)
        } while (printed);
 }
 
-int show_cmd_help(struct fio_option *options, const char *name)
+int show_cmd_help(const struct fio_option *options, const char *name)
 {
-       struct fio_option *o, *closest;
+       const struct fio_option *o, *closest;
        unsigned int best_dist = -1U;
        int found = 0;
        int show_all = 0;
@@ -1284,9 +1296,9 @@ int show_cmd_help(struct fio_option *options, const char *name)
 /*
  * Handle parsing of default parameters.
  */
-void fill_default_options(void *data, struct fio_option *options)
+void fill_default_options(void *data, const struct fio_option *options)
 {
-       struct fio_option *o;
+       const struct fio_option *o;
 
        dprint(FD_PARSE, "filling default options\n");
 
@@ -1309,10 +1321,6 @@ static void option_init(struct fio_option *o)
                if (!o->maxval)
                        o->maxval = UINT_MAX;
        }
-       if (o->type == FIO_OPT_FLOAT_LIST) {
-               o->minfp = DBL_MIN;
-               o->maxfp = DBL_MAX;
-       }
        if (o->type == FIO_OPT_STR_SET && o->def && !o->no_warn_def) {
                log_err("Option %s: string set option with"
                                " default will always be true\n", o->name);
@@ -1346,9 +1354,9 @@ void options_init(struct fio_option *options)
        }
 }
 
-void options_mem_dupe(struct fio_option *options, void *data)
+void options_mem_dupe(const struct fio_option *options, void *data)
 {
-       struct fio_option *o;
+       const struct fio_option *o;
        char **ptr;
 
        dprint(FD_PARSE, "dup options\n");
@@ -1363,9 +1371,9 @@ void options_mem_dupe(struct fio_option *options, void *data)
        }
 }
 
-void options_free(struct fio_option *options, void *data)
+void options_free(const struct fio_option *options, void *data)
 {
-       struct fio_option *o;
+       const struct fio_option *o;
        char **ptr;
 
        dprint(FD_PARSE, "free options\n");
diff --git a/parse.h b/parse.h
index d05236b07f96307ca92ead5e5d121c236e1ca07c..4ad92d9db274b9b75c04b0768795d33e98f39030 100644 (file)
--- a/parse.h
+++ b/parse.h
@@ -68,7 +68,7 @@ struct fio_option {
        int hide_on_set;                /* hide on set, not on unset */
        const char *inverse;            /* if set, apply opposite action to this option */
        struct fio_option *inv_opt;     /* cached lookup */
-       int (*verify)(struct fio_option *, void *);
+       int (*verify)(const struct fio_option *, void *);
        const char *prof_name;          /* only valid for specific profile */
        void *prof_opts;
        uint64_t category;              /* what type of option */
@@ -81,14 +81,18 @@ struct fio_option {
        int no_free;
 };
 
-extern int parse_option(char *, const char *, struct fio_option *, struct fio_option **, void *, struct flist_head *);
-extern void sort_options(char **, struct fio_option *, int);
-extern int parse_cmd_option(const char *t, const char *l, struct fio_option *, void *, struct flist_head *);
-extern int show_cmd_help(struct fio_option *, const char *);
-extern void fill_default_options(void *, struct fio_option *);
+extern int parse_option(char *, const char *, const struct fio_option *,
+                       const struct fio_option **, void *,
+                       struct flist_head *);
+extern void sort_options(char **, const struct fio_option *, int);
+extern int parse_cmd_option(const char *t, const char *l,
+                           const struct fio_option *, void *,
+                           struct flist_head *);
+extern int show_cmd_help(const struct fio_option *, const char *);
+extern void fill_default_options(void *, const struct fio_option *);
 extern void options_init(struct fio_option *);
-extern void options_mem_dupe(struct fio_option *, void *);
-extern void options_free(struct fio_option *, void *);
+extern void options_mem_dupe(const struct fio_option *, void *);
+extern void options_free(const struct fio_option *, void *);
 
 extern void strip_blank_front(char **);
 extern void strip_blank_end(char *);
@@ -108,7 +112,8 @@ typedef int (fio_opt_str_val_fn)(void *, long long *);
 typedef int (fio_opt_int_fn)(void *, int *);
 
 struct thread_options;
-static inline void *td_var(void *to, struct fio_option *o, unsigned int offset)
+static inline void *td_var(void *to, const struct fio_option *o,
+                          unsigned int offset)
 {
        void *ret;
 
@@ -117,7 +122,7 @@ static inline void *td_var(void *to, struct fio_option *o, unsigned int offset)
        else
                ret = to;
 
-       return (char *) ret + offset;
+       return ret + offset;
 }
 
 static inline int parse_is_percent(unsigned long long val)
index 90c7057719d200871f1a325a6ad042f8a610b775..12c8d6841135437f4b3d06210aaa1ce74c9fd9b2 100644 (file)
--- a/server.c
+++ b/server.c
@@ -1199,7 +1199,6 @@ static int handle_connection(struct sk_out *sk_out)
                        .events = POLLIN,
                };
 
-               ret = 0;
                do {
                        int timeout = 1000;
 
diff --git a/stat.c b/stat.c
index a837ed90252eff2af69beb88e03f1c2c1ba6d72b..7b9dd3b1f1f1384e990ad02b4fe9a8bdfdc6769f 100644 (file)
--- a/stat.c
+++ b/stat.c
@@ -670,7 +670,6 @@ static int calc_block_percentiles(int nr_block_infos, uint32_t *block_infos,
        if (len > 1)
                qsort((void *)plist, len, sizeof(plist[0]), double_cmp);
 
-       nr_uninit = 0;
        /* Start only after the uninit entries end */
        for (nr_uninit = 0;
             nr_uninit < nr_block_infos
index 1e3a546896ad8b1379368019272ba3ab11b6284f..ee1c0e5b637d0512302ea96fb4e7f9263a4c5799 100644 (file)
@@ -350,6 +350,9 @@ uint64_t steadystate_bw_mean(struct thread_stat *ts)
        int i;
        uint64_t sum;
 
+       if (!ts->ss_dur)
+               return 0;
+
        for (i = 0, sum = 0; i < ts->ss_dur; i++)
                sum += ts->ss_bw_data[i];
 
@@ -361,6 +364,9 @@ uint64_t steadystate_iops_mean(struct thread_stat *ts)
        int i;
        uint64_t sum;
 
+       if (!ts->ss_dur)
+               return 0;
+
        for (i = 0, sum = 0; i < ts->ss_dur; i++)
                sum += ts->ss_iops_data[i];