Re: [RFC 6/7] nvme: Move BLK_MQ_F_BLOCKING indicator to struct nvme_ctrl

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 22 Aug 2024 11:37:17 -0700
mhkelley58@xxxxxxxxx wrote:

> From: Michael Kelley <mhklinux@xxxxxxxxxxx>
> 
> The NVMe setting that controls the BLK_MQ_F_BLOCKING flag on the
> request queue is currently a flag in struct nvme_ctrl_ops, where
> it is not writable. A new use case needs this flag to be writable
> based on a determination made during the NVMe device probe function.
> 
> Move this setting to struct nvme_ctrl, and update the only user to
> set it in the new location.
> 
> No functional change.
> 
> Signed-off-by: Michael Kelley <mhklinux@xxxxxxxxxxx>

LGTM.

Reviewed-by: Petr Tesarik <ptesarik@xxxxxxxx>

Petr T

> ---
>  drivers/nvme/host/core.c | 4 ++--
>  drivers/nvme/host/nvme.h | 2 +-
>  drivers/nvme/host/tcp.c  | 3 ++-
>  3 files changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index 33fa01c599ad..f1ce325471f1 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -4495,7 +4495,7 @@ int nvme_alloc_admin_tag_set(struct nvme_ctrl *ctrl, struct blk_mq_tag_set *set,
>  		set->reserved_tags = 2;
>  	set->numa_node = ctrl->numa_node;
>  	set->flags = BLK_MQ_F_NO_SCHED;
> -	if (ctrl->ops->flags & NVME_F_BLOCKING)
> +	if (ctrl->blocking)
>  		set->flags |= BLK_MQ_F_BLOCKING;
>  	set->cmd_size = cmd_size;
>  	set->driver_data = ctrl;
> @@ -4565,7 +4565,7 @@ int nvme_alloc_io_tag_set(struct nvme_ctrl *ctrl, struct blk_mq_tag_set *set,
>  		set->reserved_tags = 1;
>  	set->numa_node = ctrl->numa_node;
>  	set->flags = BLK_MQ_F_SHOULD_MERGE;
> -	if (ctrl->ops->flags & NVME_F_BLOCKING)
> +	if (ctrl->blocking)
>  		set->flags |= BLK_MQ_F_BLOCKING;
>  	set->cmd_size = cmd_size,
>  	set->driver_data = ctrl;
> diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
> index ae5314d32943..28709f166cab 100644
> --- a/drivers/nvme/host/nvme.h
> +++ b/drivers/nvme/host/nvme.h
> @@ -338,6 +338,7 @@ struct nvme_ctrl {
>  	unsigned int shutdown_timeout;
>  	unsigned int kato;
>  	bool subsystem;
> +	bool blocking;
>  	unsigned long quirks;
>  	struct nvme_id_power_state psd[32];
>  	struct nvme_effects_log *effects;
> @@ -546,7 +547,6 @@ struct nvme_ctrl_ops {
>  	unsigned int flags;
>  #define NVME_F_FABRICS			(1 << 0)
>  #define NVME_F_METADATA_SUPPORTED	(1 << 1)
> -#define NVME_F_BLOCKING			(1 << 2)
>  
>  	const struct attribute_group **dev_attr_groups;
>  	int (*reg_read32)(struct nvme_ctrl *ctrl, u32 off, u32 *val);
> diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
> index 9ea6be0b0392..6b9fdf7dc1ac 100644
> --- a/drivers/nvme/host/tcp.c
> +++ b/drivers/nvme/host/tcp.c
> @@ -2658,7 +2658,7 @@ static const struct blk_mq_ops nvme_tcp_admin_mq_ops = {
>  static const struct nvme_ctrl_ops nvme_tcp_ctrl_ops = {
>  	.name			= "tcp",
>  	.module			= THIS_MODULE,
> -	.flags			= NVME_F_FABRICS | NVME_F_BLOCKING,
> +	.flags			= NVME_F_FABRICS,
>  	.reg_read32		= nvmf_reg_read32,
>  	.reg_read64		= nvmf_reg_read64,
>  	.reg_write32		= nvmf_reg_write32,
> @@ -2762,6 +2762,7 @@ static struct nvme_tcp_ctrl *nvme_tcp_alloc_ctrl(struct device *dev,
>  	if (ret)
>  		goto out_kfree_queues;
>  
> +	ctrl->ctrl.blocking = true;
>  	return ctrl;
>  out_kfree_queues:
>  	kfree(ctrl->queues);





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux