xprtrdma: Remove rpcrdma_sendctx::sc_device
authorChuck Lever <chuck.lever@oracle.com>
Thu, 17 Oct 2019 18:31:27 +0000 (14:31 -0400)
committerAnna Schumaker <Anna.Schumaker@Netapp.com>
Thu, 24 Oct 2019 14:30:40 +0000 (10:30 -0400)
Micro-optimization: Save eight bytes in a frequently allocated
structure.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
net/sunrpc/xprtrdma/rpc_rdma.c
net/sunrpc/xprtrdma/xprt_rdma.h

index 7b1358284242a02fd7c925e49bbb501d8db6fcce..1941b2261ca5b578b33d3477e1ebcd974da5f131 100644 (file)
@@ -564,6 +564,7 @@ static void rpcrdma_sendctx_done(struct kref *kref)
  */
 void rpcrdma_sendctx_unmap(struct rpcrdma_sendctx *sc)
 {
+       struct rpcrdma_regbuf *rb = sc->sc_req->rl_sendbuf;
        struct ib_sge *sge;
 
        if (!sc->sc_unmap_count)
@@ -575,7 +576,7 @@ void rpcrdma_sendctx_unmap(struct rpcrdma_sendctx *sc)
         */
        for (sge = &sc->sc_sges[2]; sc->sc_unmap_count;
             ++sge, --sc->sc_unmap_count)
-               ib_dma_unmap_page(sc->sc_device, sge->addr, sge->length,
+               ib_dma_unmap_page(rdmab_device(rb), sge->addr, sge->length,
                                  DMA_TO_DEVICE);
 
        kref_put(&sc->sc_req->rl_kref, rpcrdma_sendctx_done);
@@ -625,7 +626,6 @@ static bool rpcrdma_prepare_msg_sges(struct rpcrdma_xprt *r_xprt,
         */
        if (!rpcrdma_regbuf_dma_map(r_xprt, rb))
                goto out_regbuf;
-       sc->sc_device = rdmab_device(rb);
        sge_no = 1;
        sge[sge_no].addr = rdmab_addr(rb);
        sge[sge_no].length = xdr->head[0].iov_len;
index 4897c09d6f61d92bb156b7fbd1e7cb4154209d6b..0e5b7f3730776438b0ae72b7c9d5604ea01d86e8 100644 (file)
@@ -221,7 +221,6 @@ struct rpcrdma_req;
 struct rpcrdma_sendctx {
        struct ib_send_wr       sc_wr;
        struct ib_cqe           sc_cqe;
-       struct ib_device        *sc_device;
        struct rpcrdma_req      *sc_req;
        unsigned int            sc_unmap_count;
        struct ib_sge           sc_sges[];