X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=engines%2Frdma.c;h=81f167367e90df6f9e2dd439e2ddfdc41f7c08e1;hp=e1fb380a044c6680ee03e4b2a526164495a6aaf7;hb=954cd73a9a93102c24afa869fbe67ac38af6e416;hpb=0ac5d398d9343ffba60821924fe0c386aee545b4;ds=sidebyside diff --git a/engines/rdma.c b/engines/rdma.c index e1fb380a..81f16736 100644 --- a/engines/rdma.c +++ b/engines/rdma.c @@ -36,7 +36,6 @@ #include #include -#include #include #include @@ -529,10 +528,10 @@ static int fio_rdmaio_getevents(struct thread_data *td, unsigned int min, { struct rdmaio_data *rd = td->io_ops->data; enum ibv_wc_opcode comp_opcode; - comp_opcode = IBV_WC_RDMA_WRITE; struct ibv_cq *ev_cq; void *ev_ctx; int ret, r = 0; + comp_opcode = IBV_WC_RDMA_WRITE; switch (rd->rdma_protocol) { case FIO_RDMA_MEM_WRITE: @@ -1013,26 +1012,11 @@ static int fio_rdmaio_setup_listen(struct thread_data *td, short port) return 0; } -static int fio_rdmaio_init(struct thread_data *td) +static int check_set_rlimits(struct thread_data *td) { - struct rdmaio_data *rd = td->io_ops->data; - struct flist_head *entry; - unsigned int max_bs; - unsigned int port; - char host[64], buf[128]; - char *sep, *portp, *modep; - int ret, i = 0; +#ifdef CONFIG_RLIMIT_MEMLOCK struct rlimit rl; - if (td_rw(td)) { - log_err("fio: rdma connections must be read OR write\n"); - return 1; - } - if (td_random(td)) { - log_err("fio: RDMA network IO can't be random\n"); - return 1; - } - /* check RLIMIT_MEMLOCK */ if (getrlimit(RLIMIT_MEMLOCK, &rl) != 0) { log_err("fio: getrlimit fail: %d(%s)\n", @@ -1057,6 +1041,31 @@ static int fio_rdmaio_init(struct thread_data *td) return 1; } } +#endif + + return 0; +} + +static int fio_rdmaio_init(struct thread_data *td) +{ + struct rdmaio_data *rd = td->io_ops->data; + unsigned int max_bs; + unsigned int port; + char host[64], buf[128]; + char *sep, *portp, *modep; + int ret, i; + + if (td_rw(td)) { + log_err("fio: rdma connections must be read OR write\n"); + return 1; + } + if (td_random(td)) { + log_err("fio: RDMA network IO can't be random\n"); + return 1; + } + + if (check_set_rlimits(td)) + return 1; strcpy(buf, td->o.filename); @@ -1143,8 +1152,8 @@ static int fio_rdmaio_init(struct thread_data *td) max_bs = max(td->o.max_bs[DDIR_READ], td->o.max_bs[DDIR_WRITE]); /* register each io_u in the free list */ - flist_for_each(entry, &td->io_u_freelist) { - struct io_u *io_u = flist_entry(entry, struct io_u, list); + for (i = 0; i < td->io_u_freelist.nr; i++) { + struct io_u *io_u = td->io_u_freelist.io_us[i]; io_u->engine_data = malloc(sizeof(struct rdma_io_u_data)); memset(io_u->engine_data, 0, sizeof(struct rdma_io_u_data)); @@ -1167,7 +1176,6 @@ static int fio_rdmaio_init(struct thread_data *td) #if 0 log_info("fio: Send rkey %x addr %" PRIx64 " len %d to client\n", io_u->mr->rkey, io_u->buf, max_bs); */ #endif - i++; } rd->send_buf.nr = htonl(i);