From: Logan Gunthorpe Date: Fri, 10 Jul 2015 18:23:55 +0000 (-0600) Subject: RDMA engine server mode flow fix ups. X-Git-Tag: fio-2.2.10~40 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=263775ad3c26a76f05cdf8b204c466af09c8adda RDMA engine server mode flow fix ups. 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.) --- diff --git a/engines/rdma.c b/engines/rdma.c index 5f0adee5..7eb0051a 100644 --- a/engines/rdma.c +++ b/engines/rdma.c @@ -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 e458457a..aed61ecc 100644 --- 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 819d4fcb..744d9942 100644 --- 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 {