iolog: Ignore re-add/re-open with replay_redirect
[fio.git] / client.c
index 82db502028d9f5b488ca31750299946d3f30440e..c61388716ad8930f6e108e327a6a2bc88a93689c 100644 (file)
--- a/client.c
+++ b/client.c
@@ -1135,11 +1135,11 @@ static void convert_jobs_eta(struct jobs_eta *je)
        je->files_open          = le32_to_cpu(je->files_open);
 
        for (i = 0; i < DDIR_RWDIR_CNT; i++) {
-               je->m_rate[i]   = le32_to_cpu(je->m_rate[i]);
-               je->t_rate[i]   = le32_to_cpu(je->t_rate[i]);
+               je->m_rate[i]   = le64_to_cpu(je->m_rate[i]);
+               je->t_rate[i]   = le64_to_cpu(je->t_rate[i]);
                je->m_iops[i]   = le32_to_cpu(je->m_iops[i]);
                je->t_iops[i]   = le32_to_cpu(je->t_iops[i]);
-               je->rate[i]     = le32_to_cpu(je->rate[i]);
+               je->rate[i]     = le64_to_cpu(je->rate[i]);
                je->iops[i]     = le32_to_cpu(je->iops[i]);
        }
 
@@ -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)
@@ -1275,7 +1276,7 @@ static void client_flush_hist_samples(FILE *f, int hist_coarseness, void *sample
                s = (struct io_sample *)((char *)__get_sample(samples, log_offset, i) +
                        i * sizeof(struct io_u_plat_entry));
 
-               entry = s->plat_entry;
+               entry = s->data.plat_entry;
                io_u_plat = entry->io_u_plat;
 
                fprintf(f, "%lu, %u, %u, ", (unsigned long) s->time,
@@ -1303,8 +1304,7 @@ static int fio_client_handle_iolog(struct fio_client *client,
        }
 
         /* allocate buffer big enough for next sprintf() call */
-       log_pathname = malloc( 10 + 
-                       strlen((char * )pdu->name) + 
+       log_pathname = malloc(10 + strlen((char *)pdu->name) +
                        strlen(client->hostname));
        if (!log_pathname) {
                log_err("fio: memory allocation of unique pathname failed");
@@ -1321,7 +1321,7 @@ static int fio_client_handle_iolog(struct fio_client *client,
                fd = open((const char *) log_pathname,
                                O_WRONLY | O_CREAT | O_TRUNC, 0644);
                if (fd < 0) {
-                       log_err("fio: open log %s: %s\n", 
+                       log_err("fio: open log %s: %s\n",
                                log_pathname, strerror(errno));
                        return 1;
                }
@@ -1340,7 +1340,7 @@ static int fio_client_handle_iolog(struct fio_client *client,
                FILE *f;
                f = fopen((const char *) log_pathname, "w");
                if (!f) {
-                       log_err("fio: fopen log %s : %s\n", 
+                       log_err("fio: fopen log %s : %s\n",
                                log_pathname, strerror(errno));
                        return 1;
                }
@@ -1552,7 +1552,7 @@ static struct cmd_iolog_pdu *convert_iolog(struct fio_net_cmd *cmd,
                        s = (struct io_sample *)((void *)s + sizeof(struct io_u_plat_entry) * i);
 
                s->time         = le64_to_cpu(s->time);
-               s->val          = le64_to_cpu(s->val);
+               s->data.val     = le64_to_cpu(s->data.val);
                s->__ddir       = le32_to_cpu(s->__ddir);
                s->bs           = le32_to_cpu(s->bs);
 
@@ -1563,9 +1563,9 @@ static struct cmd_iolog_pdu *convert_iolog(struct fio_net_cmd *cmd,
                }
 
                if (ret->log_type == IO_LOG_TYPE_HIST) {
-                       s->plat_entry = (struct io_u_plat_entry *)(((void *)s) + sizeof(*s));
-                       s->plat_entry->list.next = NULL;
-                       s->plat_entry->list.prev = NULL;
+                       s->data.plat_entry = (struct io_u_plat_entry *)(((void *)s) + sizeof(*s));
+                       s->data.plat_entry->list.next = NULL;
+                       s->data.plat_entry->list.prev = NULL;
                }
        }
 
@@ -1666,7 +1666,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;