Merge branch 'master' of git://github.com/DaveGlen/fio
authorJens Axboe <axboe@fb.com>
Tue, 18 Aug 2015 17:19:50 +0000 (11:19 -0600)
committerJens Axboe <axboe@fb.com>
Tue, 18 Aug 2015 17:19:50 +0000 (11:19 -0600)
arch/arch-ppc.h
backend.c
client.c
client.h
configure
eta.c
filesetup.c
gettime.c

index d4a080c4e91f31050404cab8c61b6d23bbe7f371..aed41f9bad6d53d6ee06978f95e8e1d131ce4a8a 100644 (file)
 
 #define write_barrier()        __asm__ __volatile__ ("sync" : : : "memory")
 
+#ifdef __powerpc64__
+#define PPC_CNTLZL "cntlzd"
+#else
+#define PPC_CNTLZL "cntlzw"
+#endif
+
 static inline int __ilog2(unsigned long bitmask)
 {
        int lz;
 
-       asm ("cntlzw %0,%1" : "=r" (lz) : "r" (bitmask));
-       return 31 - lz;
+       asm (PPC_CNTLZL " %0,%1" : "=r" (lz) : "r" (bitmask));
+       return BITS_PER_LONG - 1 - lz;
 }
 
 static inline int arch_ffz(unsigned long bitmask)
 {
        if ((bitmask = ~bitmask) == 0)
-               return 32;
+               return BITS_PER_LONG;
        return  __ilog2(bitmask & -bitmask);
 }
 
index 094cf7100d3f8f0e4af0c07fe41c80b67ebc586a..76994d90b9c59b3ae059dbae99d12f7e77ce1c6d 100644 (file)
--- a/backend.c
+++ b/backend.c
@@ -951,7 +951,7 @@ reap:
                }
                if (!in_ramp_time(td) && td->o.latency_target)
                        lat_target_check(td);
-                                       
+
                if (td->o.thinktime) {
                        unsigned long long b;
 
index af3407cefe95a55fc211d5deb92bd4687fd922fc..110a01bd99564280245cd59ca7ff27759bf3e936 100644 (file)
--- a/client.c
+++ b/client.c
@@ -184,6 +184,17 @@ void fio_put_client(struct fio_client *client)
        free(client);
 }
 
+static int fio_client_dec_jobs_eta(struct client_eta *eta, client_eta_op eta_fn)
+{
+       if (!--eta->pending) {
+               eta_fn(&eta->eta);
+               free(eta);
+               return 0;
+       }
+
+       return 1;
+}
+
 static void remove_client(struct fio_client *client)
 {
        assert(client->refs);
@@ -1091,14 +1102,6 @@ void fio_client_sum_jobs_eta(struct jobs_eta *dst, struct jobs_eta *je)
        strcpy((char *) dst->run_str, (char *) je->run_str);
 }
 
-void fio_client_dec_jobs_eta(struct client_eta *eta, client_eta_op eta_fn)
-{
-       if (!--eta->pending) {
-               eta_fn(&eta->eta);
-               free(eta);
-       }
-}
-
 static void remove_reply_cmd(struct fio_client *client, struct fio_net_cmd *cmd)
 {
        struct fio_net_cmd_reply *reply = NULL;
@@ -1573,8 +1576,10 @@ static void request_client_etas(struct client_ops *ops)
                                        (uintptr_t) eta, &client->cmd_list);
        }
 
-       while (skipped--)
-               fio_client_dec_jobs_eta(eta, ops->eta);
+       while (skipped--) {
+               if (!fio_client_dec_jobs_eta(eta, ops->eta))
+                       break;
+       }
 
        dprint(FD_NET, "client: requested eta tag %p\n", eta);
 }
index 8818de2b82119e4787cbb6fd6d63b4941fb5afd9..cfb0b4d4793bef27e5f2086f1b9c1219852aceee 100644 (file)
--- a/client.h
+++ b/client.h
@@ -111,7 +111,6 @@ struct client_eta {
 };
 
 extern int fio_handle_client(struct fio_client *);
-extern void fio_client_dec_jobs_eta(struct client_eta *eta, client_eta_op fn);
 extern void fio_client_sum_jobs_eta(struct jobs_eta *dst, struct jobs_eta *je);
 
 enum {
index 4fb65e66a5bcef26dbcec9477b809a60620463fe..1a41fe58024ea40a0d892c9d9e44ff7eb0e819bb 100755 (executable)
--- a/configure
+++ b/configure
@@ -1409,11 +1409,14 @@ echo "HDFS engine                   $libhdfs"
 # Check whether we have MTD
 mtd="no"
 cat > $TMPC << EOF
+#include <string.h>
 #include <mtd/mtd-user.h>
 #include <sys/ioctl.h>
 int main(int argc, char **argv)
 {
+  struct mtd_write_req ops;
   struct mtd_info_user info;
+  memset(&ops, 0, sizeof(ops));
   info.type = MTD_MLCNANDFLASH;
   return ioctl(0, MEMGETINFO, &info);
 }
diff --git a/eta.c b/eta.c
index db045cb230338096c90d7ea2bb93fb13014f37cd..3e8eb0bbc0d1981fc0aa9dac768fddbb1a02b466 100644 (file)
--- a/eta.c
+++ b/eta.c
@@ -590,7 +590,7 @@ struct jobs_eta *get_jobs_eta(int force, size_t *size)
        if (!thread_number)
                return NULL;
 
-       *size = sizeof(*je) + THREAD_RUNSTR_SZ;
+       *size = sizeof(*je) + THREAD_RUNSTR_SZ + 1;
        je = malloc(*size);
        if (!je)
                return NULL;
index 212a126b94aed73c83319763298f573051af4413..881aeee8f8bf2b94649046181d9892d7050face8 100644 (file)
@@ -1051,6 +1051,43 @@ static int init_rand_distribution(struct thread_data *td)
        return 1;
 }
 
+/*
+ * Check if the number of blocks exceeds the randomness capability of
+ * the selected generator. Tausworthe is 32-bit, the others are fullly
+ * 64-bit capable.
+ */
+static int check_rand_gen_limits(struct thread_data *td, struct fio_file *f,
+                                uint64_t blocks)
+{
+       if (blocks <= FRAND32_MAX)
+               return 0;
+       if (td->o.random_generator != FIO_RAND_GEN_TAUSWORTHE)
+               return 0;
+
+       /*
+        * If the user hasn't specified a random generator, switch
+        * to tausworthe64 with informational warning. If the user did
+        * specify one, just warn.
+        */
+       log_info("fio: file %s exceeds 32-bit tausworthe random generator.\n",
+                       f->file_name);
+
+       if (!fio_option_is_set(&td->o, random_generator)) {
+               log_info("fio: Switching to tausworthe64. Use the "
+                        "random_generator= option to get rid of this "
+                        " warning.\n");
+               td->o.random_generator = FIO_RAND_GEN_TAUSWORTHE64;
+               return 0;
+       }
+
+       /*
+        * Just make this information to avoid breaking scripts.
+        */
+       log_info("fio: Use the random_generator= option to switch to lfsr or "
+                        "tausworthe64.\n");
+       return 0;
+}
+
 int init_random_map(struct thread_data *td)
 {
        unsigned long long blocks;
@@ -1067,15 +1104,8 @@ int init_random_map(struct thread_data *td)
 
                blocks = fsize / (unsigned long long) td->o.rw_min_bs;
 
-               if (blocks > FRAND32_MAX &&
-                   td->o.random_generator == FIO_RAND_GEN_TAUSWORTHE &&
-                   !fio_option_is_set(&td->o, random_generator)) {
-                       log_err("fio: file %s exceeds 32-bit tausworthe "
-                                "random generator. Use lfsr or "
-                                "tausworthe64.\n", f->file_name);
-                       td_verror(td, EINVAL, "init file random");
+               if (check_rand_gen_limits(td, f, blocks))
                        return 1;
-               }
 
                if (td->o.random_generator == FIO_RAND_GEN_LFSR) {
                        unsigned long seed;
index ac541113245fb49876ed2afa601894cff3ca776c..8d99900c72819c70471115bac9cbd50f88d2671f 100644 (file)
--- a/gettime.c
+++ b/gettime.c
@@ -640,6 +640,8 @@ int fio_monotonic_clocktest(int debug)
 
        qsort(entries, tentries, sizeof(struct clock_entry), clock_cmp);
 
+       /* silence silly gcc */
+       prev = NULL;
        for (failed = i = 0; i < tentries; i++) {
                this = &entries[i];