Re: [PATCH v5 4/5] ublk: add helper to check if device supports user copy

From: Damien Le Moal
Date: Tue Jul 04 2023 - 19:44:04 EST


On 7/5/23 01:52, Andreas Hindborg wrote:
> From: Andreas Hindborg <a.hindborg@xxxxxxxxxxx>
>
> This will be used by ublk zoned storage support.
>
> Signed-off-by: Andreas Hindborg <a.hindborg@xxxxxxxxxxx>

Looks good.

Reviewed-by: Damien Le Moal <dlemoal@xxxxxxxxxx>

> ---
> drivers/block/ublk.c | 2 +-
> drivers/block/ublk.h | 5 +++++
> 2 files changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/block/ublk.c b/drivers/block/ublk.c
> index a0453619bf67..0b1ec102aaae 100644
> --- a/drivers/block/ublk.c
> +++ b/drivers/block/ublk.c
> @@ -1947,7 +1947,7 @@ static int ublk_ctrl_add_dev(struct io_uring_cmd *cmd)
> UBLK_F_URING_CMD_COMP_IN_TASK;
>
> /* GET_DATA isn't needed any more with USER_COPY */
> - if (ub->dev_info.flags & UBLK_F_USER_COPY)
> + if (ublk_dev_is_user_copy(ub))
> ub->dev_info.flags &= ~UBLK_F_NEED_GET_DATA;
>
> /* We are not ready to support zero copy */
> diff --git a/drivers/block/ublk.h b/drivers/block/ublk.h
> index 2a4ab721d513..fcbcc6b02aa0 100644
> --- a/drivers/block/ublk.h
> +++ b/drivers/block/ublk.h
> @@ -100,4 +100,9 @@ struct ublk_io {
> struct io_uring_cmd *cmd;
> };
>
> +static inline bool ublk_dev_is_user_copy(const struct ublk_device *ub)
> +{
> + return ub->dev_info.flags & UBLK_F_USER_COPY;
> +}
> +
> #endif

--
Damien Le Moal
Western Digital Research