Skip to content

Commit b5cde6a

Browse files
chuckleveramschuma-ntap
authored andcommitted
xprtrdma: Remove rpcrdma_sendctx::sc_device
Micro-optimization: Save eight bytes in a frequently allocated structure. Signed-off-by: Chuck Lever <[email protected]> Signed-off-by: Anna Schumaker <[email protected]>
1 parent f995879 commit b5cde6a

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

net/sunrpc/xprtrdma/rpc_rdma.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,7 @@ static void rpcrdma_sendctx_done(struct kref *kref)
564564
*/
565565
void rpcrdma_sendctx_unmap(struct rpcrdma_sendctx *sc)
566566
{
567+
struct rpcrdma_regbuf *rb = sc->sc_req->rl_sendbuf;
567568
struct ib_sge *sge;
568569

569570
if (!sc->sc_unmap_count)
@@ -575,7 +576,7 @@ void rpcrdma_sendctx_unmap(struct rpcrdma_sendctx *sc)
575576
*/
576577
for (sge = &sc->sc_sges[2]; sc->sc_unmap_count;
577578
++sge, --sc->sc_unmap_count)
578-
ib_dma_unmap_page(sc->sc_device, sge->addr, sge->length,
579+
ib_dma_unmap_page(rdmab_device(rb), sge->addr, sge->length,
579580
DMA_TO_DEVICE);
580581

581582
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,
625626
*/
626627
if (!rpcrdma_regbuf_dma_map(r_xprt, rb))
627628
goto out_regbuf;
628-
sc->sc_device = rdmab_device(rb);
629629
sge_no = 1;
630630
sge[sge_no].addr = rdmab_addr(rb);
631631
sge[sge_no].length = xdr->head[0].iov_len;

net/sunrpc/xprtrdma/xprt_rdma.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,6 @@ struct rpcrdma_req;
221221
struct rpcrdma_sendctx {
222222
struct ib_send_wr sc_wr;
223223
struct ib_cqe sc_cqe;
224-
struct ib_device *sc_device;
225224
struct rpcrdma_req *sc_req;
226225
unsigned int sc_unmap_count;
227226
struct ib_sge sc_sges[];

0 commit comments

Comments
 (0)