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

Hannes Reinecke hare at suse.de
Tue Sep 21 23:01:47 PDT 2021


On 9/22/21 3:23 AM, Chaitanya Kulkarni wrote:
> 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;
> }
> 
Good point. Will be updating the patchset.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                Kernel Storage Architect
hare at suse.de                              +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer



More information about the Linux-nvme mailing list