Re: [PATCH 6/6] ublk: lift need_map check out of ublk_{,un}map_io()
From: Ming Lei
Date: Thu Jul 30 2026 - 11:34:16 EST
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 <csander@xxxxxxxxxxxxxxx>
Reviewed-by: Ming Lei <tom.leiming@xxxxxxxxx>
Thanks,
Ming