]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
xprtrdma: Decouple frwr_wp_create from frwr_map
authorChuck Lever <chuck.lever@oracle.com>
Fri, 6 Mar 2026 21:56:25 +0000 (16:56 -0500)
committerTrond Myklebust <trond.myklebust@hammerspace.com>
Mon, 13 Apr 2026 18:56:27 +0000 (11:56 -0700)
commit6f2e565fb3bd68636e4920223e599d70861f8ba6
treef08e6be551fbc2e0c22c0359bd9df36015d17647
parent765bde47fe7f197dabeb12da76831f40d0b20377
xprtrdma: Decouple frwr_wp_create from frwr_map

frwr_wp_create is the only caller of frwr_map outside the encode
path. It registers a single 4-byte write-pad region from a stack-
local rpcrdma_mr_seg. Inlining the registration logic directly
(sg_init_table + sg_set_page + ib_dma_map_sg + ib_map_mr_sg +
IOVA mangle + reg_wr setup) eliminates the coupling that would
otherwise complicate the removal of rpcrdma_mr_seg from frwr_map's
interface.

The inlined version adds a proper error-unwind ladder: on failure,
the DMA mapping (if established) is released, ep->re_write_pad_mr is
cleared, and the MR is returned to the transport free list. The old
frwr_map-based code relied on rpcrdma_mrs_destroy at teardown to
reclaim partially-initialized MRs.

This is a one-time setup path; duplicating ~20 lines is a reasonable
tradeoff for decoupling the write-pad registration from the data-
path MR registration.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
net/sunrpc/xprtrdma/frwr_ops.c