[PATCH 4/4] nvme: Add two-pass shutdown support

Sagi Grimberg sagi at grimberg.me
Wed Jan 3 00:36:46 PST 2024


>>>> On 12/21/23 19:22, Jeremy Allison wrote:
>>>>>  EXPORT_SYMBOL_GPL(nvme_disable_ctrl);
>>>>> +int nvme_wait_for_shutdown_cmpl(struct nvme_ctrl *ctrl)
>>>>> +{
>>>>> +    ctrl->ctrl_config &= ~NVME_CC_SHN_MASK;
>>>>> +    ctrl->ctrl_config |= NVME_CC_SHN_NORMAL;
>>>>
>>>> Why is ctrl_config being set again?
>>>
>>> Good catch. There's no need for that. I'll fix
>>> in the next iteration, thanks !
>>>
>>>>> +EXPORT_SYMBOL_GPL(nvme_wait_for_shutdown_cmpl);
>>>>
>>>> Why export the symbol?
>>>
>>> nvme_wait_for_shutdown_cmpl() calls nvme_wait_ready(),
>>> which is a static function defined in drivers/nvme/host/core.c.
>>>
>>> The only way to inline the functionality of 
>>> nvme_wait_for_shutdown_cmpl()
>>> into nvme_shutdown_wait() is to export nvme_wait_ready() instead.
>>>
>>> If you're OK with that I can remove the intermediate
>>> function nvme_wait_for_shutdown_cmpl() (and indeed as
>>> you've pointed out there's no need to set ctrl->ctrl_config
>>> again).
>>
>> I think it is small enough to make it static inline in nvme.h
> 
> Sorry, just looking for some clarification here. Are
> you talking about inlining nvme_wait_ready() ? There
> are indeed larger functions already inlined in nvme.h.

No, these wrappers are getting confusing.

Exporting nvme_wait_ready and calling it from a static
nvme_shutdown_wait in pci.c is fine I think.



More information about the Linux-nvme mailing list