X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=engines%2Frdma.c;h=f192f432738da6e8fa448766348ae6e4578fee5d;hb=95625c6d5ad7a4428ebbf55230016136054c7e44;hp=6b173a84a197258a9e7b80f4b3205a8ccb06dc93;hpb=2f28bb35f2b62ba865e083be63773295a10692ad;p=fio.git diff --git a/engines/rdma.c b/engines/rdma.c index 6b173a84..f192f432 100644 --- a/engines/rdma.c +++ b/engines/rdma.c @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include #include @@ -791,7 +791,8 @@ static int fio_rdmaio_recv(struct thread_data *td, struct io_u **io_us, return i; } -static int fio_rdmaio_queue(struct thread_data *td, struct io_u *io_u) +static enum fio_q_status fio_rdmaio_queue(struct thread_data *td, + struct io_u *io_u) { struct rdmaio_data *rd = td->io_ops_data; @@ -1049,7 +1050,7 @@ static int fio_rdmaio_setup_connect(struct thread_data *td, const char *host, return err; /* resolve route */ - if (strcmp(o->bindname, "") != 0) { + if (o->bindname && strlen(o->bindname)) { addrb.ss_family = AF_INET; err = aton(td, o->bindname, (struct sockaddr_in *)&addrb); if (err) @@ -1115,7 +1116,7 @@ static int fio_rdmaio_setup_listen(struct thread_data *td, short port) rd->addr.sin_family = AF_INET; rd->addr.sin_port = htons(port); - if (strcmp(o->bindname, "") == 0) + if (!o->bindname || !strlen(o->bindname)) rd->addr.sin_addr.s_addr = htonl(INADDR_ANY); else rd->addr.sin_addr.s_addr = htonl(*o->bindname); @@ -1248,8 +1249,7 @@ static int fio_rdmaio_init(struct thread_data *td) { struct rdmaio_data *rd = td->io_ops_data; struct rdmaio_options *o = td->eo; - unsigned int max_bs; - int ret, i; + int ret; if (td_rw(td)) { log_err("fio: rdma connections must be read OR write\n"); @@ -1317,6 +1317,13 @@ static int fio_rdmaio_init(struct thread_data *td) rd->is_client = 1; ret = fio_rdmaio_setup_connect(td, td->o.filename, o->port); } + return ret; +} +static int fio_rdmaio_post_init(struct thread_data *td) +{ + unsigned int max_bs; + int i; + struct rdmaio_data *rd = td->io_ops_data; max_bs = max(td->o.max_bs[DDIR_READ], td->o.max_bs[DDIR_WRITE]); rd->send_buf.max_bs = htonl(max_bs); @@ -1350,7 +1357,7 @@ static int fio_rdmaio_init(struct thread_data *td) rd->send_buf.nr = htonl(i); - return ret; + return 0; } static void fio_rdmaio_cleanup(struct thread_data *td) @@ -1387,6 +1394,7 @@ static struct ioengine_ops ioengine_rw = { .version = FIO_IOOPS_VERSION, .setup = fio_rdmaio_setup, .init = fio_rdmaio_init, + .post_init = fio_rdmaio_post_init, .prep = fio_rdmaio_prep, .queue = fio_rdmaio_queue, .commit = fio_rdmaio_commit,