[PATCH 4/6] nvme-ioctl: common user timeout setting

Damien Le Moal dlemoal at kernel.org
Mon Feb 24 14:29:01 PST 2025


On 2/25/25 03:21, Keith Busch wrote:
> From: Keith Busch <kbusch at kernel.org>
> 
> Most of the passthrough paths repeat the same request timeout setup, so
> make it common with the request allocation.
> 
> Signed-off-by: Keith Busch <kbusch at kernel.org>
> ---
>  drivers/nvme/host/ioctl.c | 23 +++++++----------------
>  1 file changed, 7 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/nvme/host/ioctl.c b/drivers/nvme/host/ioctl.c
> index 3da014ccbe550..1f28fc4b341dd 100644
> --- a/drivers/nvme/host/ioctl.c
> +++ b/drivers/nvme/host/ioctl.c
> @@ -101,7 +101,7 @@ static void __user *nvme_to_user_ptr(uintptr_t ptrval)
>  
>  static struct request *nvme_alloc_user_request(struct request_queue *q,
>  		struct nvme_command *cmd, blk_opf_t rq_flags,
> -		blk_mq_req_flags_t blk_flags)
> +		blk_mq_req_flags_t blk_flags, unsigned timeout_ms)
>  {
>  	struct request *req;
>  
> @@ -110,6 +110,7 @@ static struct request *nvme_alloc_user_request(struct request_queue *q,
>  		return req;
>  	nvme_init_request(req, cmd);
>  	nvme_req(req)->flags |= NVME_REQ_USERCMD;
> +	req->timeout = timeout_ms ? msecs_to_jiffies(timeout_ms) : 0;

Should we check for overflows / MAX_JIFFY_OFFSET here ?

-- 
Damien Le Moal
Western Digital Research



More information about the Linux-nvme mailing list