Merge branch 'client-unique-log-names' of https://github.com/bengland2/fio into log...
authorJens Axboe <axboe@fb.com>
Fri, 16 Sep 2016 15:26:30 +0000 (09:26 -0600)
committerJens Axboe <axboe@fb.com>
Fri, 16 Sep 2016 15:26:30 +0000 (09:26 -0600)
Makefile
client.c
configure
init.c
io_u.c
tools/fio.service [new file with mode: 0644]

index 3f67ab76f0c520bfffcc4b98c14e81458d73a9eb..6b5548a83574f504e83f332792b09356b33e3b7a 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -49,7 +49,7 @@ SOURCE :=     $(patsubst $(SRCDIR)/%,%,$(wildcard $(SRCDIR)/crc/*.c)) \
 
 ifdef CONFIG_LIBHDFS
   HDFSFLAGS= -I $(JAVA_HOME)/include -I $(JAVA_HOME)/include/linux -I $(FIO_LIBHDFS_INCLUDE)
-  HDFSLIB= -Wl,-rpath $(JAVA_HOME)/jre/lib/`uname -m`/server -L$(JAVA_HOME)/jre/lib/`uname -m`/server -ljvm $(FIO_LIBHDFS_LIB)/libhdfs.a
+  HDFSLIB= -Wl,-rpath $(JAVA_HOME)/jre/lib/$(FIO_HDFS_CPU)/server -L$(JAVA_HOME)/jre/lib/$(FIO_HDFS_CPU)/server -ljvm $(FIO_LIBHDFS_LIB)/libhdfs.a
   CFLAGS += $(HDFSFLAGS)
   SOURCE += engines/libhdfs.c
 endif
index 82db502028d9f5b488ca31750299946d3f30440e..4121ea5f4f17df7a9565570bcbb51816ae0229fb 100644 (file)
--- a/client.c
+++ b/client.c
@@ -1183,7 +1183,7 @@ void fio_client_sum_jobs_eta(struct jobs_eta *dst, struct jobs_eta *je)
        strcpy((char *) dst->run_str, (char *) je->run_str);
 }
 
-static void remove_reply_cmd(struct fio_client *client, struct fio_net_cmd *cmd)
+static bool remove_reply_cmd(struct fio_client *client, struct fio_net_cmd *cmd)
 {
        struct fio_net_cmd_reply *reply = NULL;
        struct flist_head *entry;
@@ -1199,12 +1199,13 @@ static void remove_reply_cmd(struct fio_client *client, struct fio_net_cmd *cmd)
 
        if (!reply) {
                log_err("fio: client: unable to find matching tag (%llx)\n", (unsigned long long) cmd->tag);
-               return;
+               return false;
        }
 
        flist_del(&reply->list);
        cmd->tag = reply->saved_tag;
        free(reply);
+       return true;
 }
 
 int fio_client_wait_for_reply(struct fio_client *client, uint64_t tag)
@@ -1666,7 +1667,8 @@ int fio_handle_client(struct fio_client *client)
        case FIO_NET_CMD_ETA: {
                struct jobs_eta *je = (struct jobs_eta *) cmd->payload;
 
-               remove_reply_cmd(client, cmd);
+               if (!remove_reply_cmd(client, cmd))
+                       break;
                convert_jobs_eta(je);
                handle_eta(client, cmd);
                break;
index 93c372006660b4ad26dfd8eb346e19ac51c161f2..2851f54d951a983c2c2467b7188989b0b30eabea 100755 (executable)
--- a/configure
+++ b/configure
@@ -1489,6 +1489,10 @@ if test "$libhdfs" = "yes" ; then
   if test "$hdfs_conf_error" = "1" ; then
     exit 1
   fi
+  FIO_HDFS_CPU=$cpu
+  if test "$FIO_HDFS_CPU" = "x86_64" ; then
+    FIO_HDFS_CPU="amd64"
+  fi
 fi
 echo "HDFS engine                   $libhdfs"
 
@@ -1829,6 +1833,7 @@ if test "$gf_trim" = "yes" ; then
 fi
 if test "$libhdfs" = "yes" ; then
   output_sym "CONFIG_LIBHDFS"
+  echo "FIO_HDFS_CPU=$FIO_HDFS_CPU" >> $config_host_mak
   echo "JAVA_HOME=$JAVA_HOME" >> $config_host_mak
   echo "FIO_LIBHDFS_INCLUDE=$FIO_LIBHDFS_INCLUDE" >> $config_host_mak
   echo "FIO_LIBHDFS_LIB=$FIO_LIBHDFS_LIB" >> $config_host_mak
diff --git a/init.c b/init.c
index 4b4a86a6fe2421459a7f8bf1feaf15c58215baf3..bc17b40213a5bacdcecae2ca89e937ef86d6c8b8 100644 (file)
--- a/init.c
+++ b/init.c
@@ -309,7 +309,7 @@ static void free_shm(void)
        free(trigger_remote_cmd);
        trigger_file = trigger_cmd = trigger_remote_cmd = NULL;
 
-       options_free(fio_options, &def_thread);
+       options_free(fio_options, &def_thread.o);
        fio_filelock_exit();
        scleanup();
 }
diff --git a/io_u.c b/io_u.c
index b6d530f2a23a542d28673587ababf8a0e091f3e9..7b51dd2ee19c3cd2e29a9bbcd4ac96a01ec1eba7 100644 (file)
--- a/io_u.c
+++ b/io_u.c
@@ -531,8 +531,7 @@ static unsigned int __get_next_buflen(struct thread_data *td, struct io_u *io_u,
        int ddir = io_u->ddir;
        unsigned int buflen = 0;
        unsigned int minbs, maxbs;
-       uint64_t frand_max;
-       unsigned long r;
+       uint64_t frand_max, r;
 
        assert(ddir_rw(ddir));
 
@@ -561,7 +560,7 @@ static unsigned int __get_next_buflen(struct thread_data *td, struct io_u *io_u,
                        if (buflen < minbs)
                                buflen = minbs;
                } else {
-                       long perc = 0;
+                       long long perc = 0;
                        unsigned int i;
 
                        for (i = 0; i < td->o.bssplit_nr[ddir]; i++) {
@@ -569,7 +568,9 @@ static unsigned int __get_next_buflen(struct thread_data *td, struct io_u *io_u,
 
                                buflen = bsp->bs;
                                perc += bsp->perc;
-                               if ((r * 100UL <= frand_max * perc) &&
+                               if (!perc)
+                                       break;
+                               if ((r / perc <= frand_max / 100ULL) &&
                                    io_u_fits(td, io_u, buflen))
                                        break;
                        }
diff --git a/tools/fio.service b/tools/fio.service
new file mode 100644 (file)
index 0000000..21de0b7
--- /dev/null
@@ -0,0 +1,10 @@
+[Unit]
+
+Description=flexible I/O tester server
+After=network.target
+
+[Service]
+
+Type=simple
+PIDFile=/run/fio.pid
+ExecStart=/usr/bin/fio --server