RDMA engine server mode flow fix ups.
authorLogan Gunthorpe <logang@deltatee.com>
Fri, 10 Jul 2015 18:23:55 +0000 (12:23 -0600)
committerLogan Gunthorpe <logang@deltatee.com>
Fri, 10 Jul 2015 18:34:22 +0000 (12:34 -0600)
When running fio in RDMA server mode, the user just sees an ever
increasing ETA line. Which is rather uninfromative. This patch
adds a waiting for connection message and sets the thread to SETTING_UP
while waiting.

Then when the server is running the ETA is disabled. (The RDMA server
has no access to progress information.)

engines/rdma.c
eta.c
fio.h

index 5f0adee5377c61a84080169811eebc16ad0c8b61..7eb0051aa6cefdabcb904441436647b521e3eca3 100644 (file)
@@ -1073,6 +1073,9 @@ static int fio_rdmaio_setup_listen(struct thread_data *td, short port)
 {
        struct rdmaio_data *rd = td->io_ops->data;
        struct ibv_recv_wr *bad_wr;
+       int state = td->runstate;
+
+       td_set_runstate(td, TD_SETTING_UP);
 
        rd->addr.sin_family = AF_INET;
        rd->addr.sin_addr.s_addr = htonl(INADDR_ANY);
@@ -1089,6 +1092,8 @@ static int fio_rdmaio_setup_listen(struct thread_data *td, short port)
                return 1;
        }
 
+       log_info("fio: waiting for connection\n");
+
        /* wait for CONNECT_REQUEST */
        if (get_next_channel_event
            (td, rd->cm_channel, RDMA_CM_EVENT_CONNECT_REQUEST) != 0) {
@@ -1108,6 +1113,7 @@ static int fio_rdmaio_setup_listen(struct thread_data *td, short port)
                return 1;
        }
 
+       td_set_runstate(td, state);
        return 0;
 }
 
@@ -1264,6 +1270,7 @@ static int fio_rdmaio_init(struct thread_data *td)
 
        if (td_read(td)) {      /* READ as the server */
                rd->is_client = 0;
+               td->flags |= TD_F_NO_PROGRESS;
                /* server rd->rdma_buf_len will be setup after got request */
                ret = fio_rdmaio_setup_listen(td, o->port);
        } else {                /* WRITE as the client */
diff --git a/eta.c b/eta.c
index e458457a902f4df3fc3e6642c402abf6148c7016..aed61ecca935b1406985e9bdd64039d25a890664 100644 (file)
--- a/eta.c
+++ b/eta.c
@@ -123,6 +123,11 @@ void eta_to_str(char *str, unsigned long eta_sec)
        unsigned int d, h, m, s;
        int disp_hour = 0;
 
+       if (eta_sec == -1) {
+               sprintf(str, "--");
+               return;
+       }
+
        s = eta_sec % 60;
        eta_sec /= 60;
        m = eta_sec % 60;
@@ -146,7 +151,7 @@ void eta_to_str(char *str, unsigned long eta_sec)
 /*
  * Best effort calculation of the estimated pending runtime of a job.
  */
-static int thread_eta(struct thread_data *td)
+static unsigned long thread_eta(struct thread_data *td)
 {
        unsigned long long bytes_total, bytes_done;
        unsigned long eta_sec = 0;
@@ -158,6 +163,9 @@ static int thread_eta(struct thread_data *td)
 
        bytes_total = td->total_io_size;
 
+       if (td->flags & TD_F_NO_PROGRESS)
+               return -1;
+
        if (td->o.fill_device && td->o.size  == -1ULL) {
                if (!td->fill_device_size || td->fill_device_size == -1ULL)
                        return 0;
@@ -513,7 +521,8 @@ void display_thread_status(struct jobs_eta *je)
                int l;
                int ddir;
 
-               if ((!je->eta_sec && !eta_good) || je->nr_ramp == je->nr_running)
+               if ((!je->eta_sec && !eta_good) || je->nr_ramp == je->nr_running ||
+                   je->eta_sec == -1)
                        strcpy(perc_str, "-.-% done");
                else {
                        double mult = 100.0;
diff --git a/fio.h b/fio.h
index 819d4fcbbef15704baf091906db818e2b6f6b631..744d99422ba70d4e4c641eb05023742139e1ab93 100644 (file)
--- a/fio.h
+++ b/fio.h
@@ -78,6 +78,7 @@ enum {
        TD_F_VSTATE_SAVED       = 1U << 10,
        TD_F_NEED_LOCK          = 1U << 11,
        TD_F_CHILD              = 1U << 12,
+       TD_F_NO_PROGRESS        = 1U << 13,
 };
 
 enum {