[PATCH 3/6] nvmet: set 'CNTRLTYPE' in the identify controller data

Chaitanya Kulkarni chaitanyak at nvidia.com
Tue Sep 21 18:23:03 PDT 2021


On 9/21/21 8:15 AM, Hannes Reinecke wrote:
> Set the correct 'CNTRLTYPE' field in the identify controller data.
> 
> Signed-off-by: Hannes Reinecke <hare at suse.de>
> ---
>   drivers/nvme/target/admin-cmd.c   | 3 +++
>   drivers/nvme/target/discovery.c   | 2 ++
>   drivers/nvme/target/fabrics-cmd.c | 3 ++-
>   3 files changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/nvme/target/admin-cmd.c b/drivers/nvme/target/admin-cmd.c
> index aa6d84d8848e..8546bae5244d 100644
> --- a/drivers/nvme/target/admin-cmd.c
> +++ b/drivers/nvme/target/admin-cmd.c
> @@ -374,6 +374,9 @@ static void nvmet_execute_identify_ctrl(struct nvmet_req *req)
>   
>   	id->rab = 6;
>   
> +	id->cntrltype = ctrl->subsys->type == NVME_NQN_DISC ?
> +		NVME_CTRL_DISC : NVME_CTRL_IO;
> +

since this check is used on more than one place in this patch,
why not have a helper instead of opencoding that makes code easy so
search e.g.

bool nvmet_is_subsys_disc(struct nvmet_subsys *s)
{
	return subsys->type == NVME_NQN_DISC ? true : false;
}



More information about the Linux-nvme mailing list