[PATCH 3/6] nvme-auth: use xarray instead of linked list

Hannes Reinecke hare at suse.de
Thu Nov 3 23:57:29 PDT 2022


On 11/3/22 22:20, Sagi Grimberg wrote:
> 
>> The current design of holding the chap context is slightly awkward,
>> as the context is allocated on demand, and we have to lock the list
>> when looking up contexts as we wouldn't know if the context is
>> allocated.
>>
>> This patch moves the allocation out of the chap context before starting
>> authentication and stores it into an xarray. With that we can do
>> away with the list traversal and access the context directly
>> via the queue number.
> 
> Why not just allocate the chap contexts in auth_init() ??
> its always the number of queues and is mapped 1x1. It IS
> an array effectively.

As the dhchap structure is rather large I was worried about pointless 
memory allocations; quite some nvme-of arrays expose only a small number 
of queues (say: 8), causing the number of queues to be decreased after 
the initial connect call.
But if you're fine with it I can easily move it into auth_init(); that 
certainly will make the implementation simpler.

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: Ivo Totev, Andrew
Myers, Andrew McDonald, Martje Boudien Moerman




More information about the Linux-nvme mailing list