Skip to content

Commit

Permalink
Merge pull request axboe#64 from ldorau/rpma-flush_req-length==0-mean…
Browse files Browse the repository at this point in the history
…s-it-is-the-last-message

rpma: define the last message the client has to send when it is done
  • Loading branch information
ldorau authored Nov 20, 2020
2 parents 133a9aa + b1adf57 commit f50ea3b
Showing 1 changed file with 23 additions and 12 deletions.
35 changes: 23 additions & 12 deletions engines/librpma_gpspm.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,20 @@
#define SEND_OFFSET (0)
#define RECV_OFFSET (SEND_OFFSET + MAX_MSG_SIZE)

#define GPSPM_FLUSH_REQUEST__LAST \
{ PROTOBUF_C_MESSAGE_INIT (&gpspm_flush_request__descriptor), 0, 0, 0 }

/*
* 'Flush_req_last' is the last flush request
* the client has to send to server to indicate
* that the client is done.
*/
static const GPSPMFlushRequest Flush_req_last = GPSPM_FLUSH_REQUEST__LAST;

#define IS_NOT_THE_LAST_MESSAGE(flush_req) \
(flush_req->length != Flush_req_last.length || \
flush_req->offset != Flush_req_last.offset)

/*
* Limited by the maximum length of the private data
* for rdma_connect() in case of RDMA_PS_TCP (56 bytes).
Expand Down Expand Up @@ -835,14 +849,6 @@ static enum fio_q_status server_queue(struct thread_data *td,
int msg_index;
int ret;

/*
* XXX
* The server handles only one io_us for now (it should handle multiple io_us).
* It is a temporary solution, we expect to change it in the future.
* A new message can be defined that will be sent when the client is done,
* so the server will transition to the cleanup stage.
*/

/* wait for the completion to be ready */
if ((ret = rpma_conn_completion_wait(sd->conn)))
goto err_terminate;
Expand Down Expand Up @@ -871,8 +877,15 @@ static enum fio_q_status server_queue(struct thread_data *td,
goto err_terminate;
}

op_ptr = (char *)sd->mmap_ptr + flush_req->offset;
pmem_persist(op_ptr, flush_req->length);
if (IS_NOT_THE_LAST_MESSAGE(flush_req)) {
op_ptr = (char *)sd->mmap_ptr + flush_req->offset;
pmem_persist(op_ptr, flush_req->length);
} else {
/*
* This is the last message - the client is done.
*/
td->done = true;
}

/* prepare a flush response and pack it to a send buffer */
flush_resp.op_context = flush_req->op_context;
Expand Down Expand Up @@ -906,8 +919,6 @@ static enum fio_q_status server_queue(struct thread_data *td,
goto err_terminate;
}

td->done = true;

return FIO_Q_COMPLETED;

err_terminate:
Expand Down

0 comments on commit f50ea3b

Please sign in to comment.