nvmet-rdma: add unlikely check at nvmet_rdma_map_sgl_keyed
authorIsrael Rukshin <israelr@mellanox.com>
Sun, 13 Oct 2019 16:57:34 +0000 (19:57 +0300)
committerJens Axboe <axboe@kernel.dk>
Mon, 4 Nov 2019 17:56:41 +0000 (10:56 -0700)
The calls to nvmet_req_alloc_sgl and rdma_rw_ctx_init should usually
succeed, so add this simple optimization to the fast path.

Signed-off-by: Israel Rukshin <israelr@mellanox.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Max Gurtovoy <maxg@mellanox.com>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/nvme/target/rdma.c

index 36d906a7f70d3437655d73108a4b2ac70cc7fa7e..ccf9821641363360c6731dd4f5a1358a8d966a2a 100644 (file)
@@ -672,13 +672,13 @@ static u16 nvmet_rdma_map_sgl_keyed(struct nvmet_rdma_rsp *rsp,
                return 0;
 
        ret = nvmet_req_alloc_sgl(&rsp->req);
-       if (ret < 0)
+       if (unlikely(ret < 0))
                goto error_out;
 
        ret = rdma_rw_ctx_init(&rsp->rw, cm_id->qp, cm_id->port_num,
                        rsp->req.sg, rsp->req.sg_cnt, 0, addr, key,
                        nvmet_data_dir(&rsp->req));
-       if (ret < 0)
+       if (unlikely(ret < 0))
                goto error_out;
        rsp->n_rdma += ret;