Re: [PATCH 6/6] ublk: lift need_map check out of ublk_{,un}map_io()

Ming Lei <[email protected]> Thu, 30 Jul 2026 10:17:43 -0500
Newsgroups org.kernel.vger.linux-block,org.kernel.vger.linux-kernel
Message-ID <amtrF4dFF1HImoMn@fedora-laptop>
On Tue, Jul 28, 2026 at 07:29:51PM -0600, Caleb Sander Mateos wrote:
> ublk_map_io() and ublk_unmap_io() are no-ops for ublk devices that
> enable user copy or zero copy. However, the implementation is a bit
> convoluted, returning the full request data length and relying on the
> caller to check the return value against the request length.
> UBLK_F_SHMEM_ZC recently added branches to skip the ublk_{,un}map_io()
> call for I/Os using a shared-memory buffer. This is a more logical place
> for the need_map check, so move it there from ublk_{,un}map_io().
> 
> Checking need_map early also avoids the expensive pointer-chasing for
> the ublk_iod_is_shmem_zc() check in __ublk_complete_rq() in the common
> case of a ublk device using user copy or zero copy.
> 
> Signed-off-by: Caleb Sander Mateos <[email protected]>

Reviewed-by: Ming Lei <[email protected]>

Thanks,
Ming