[PATCH 3/3] nvme: use helper nvme_ctrl_state in nvme_keep_alive_end_io function
Nilay Shroff
nilay at linux.ibm.com
Sun Oct 27 21:43:25 PDT 2024
On 10/28/24 03:37, Sagi Grimberg wrote:
>
>
>
> On 27/10/2024 19:02, Nilay Shroff wrote:
>> We no more need acquiring ctrl->lock before accessing the
>> NVMe controller state and instead we can now use the helper
>> nvme_ctrl_state. So replace the use of ctrl->lock from
>> nvme_keep_alive_end_io function with nvme_ctrl_state call.
>
> The patch description is not clear. Why do we "no longer need"
> to take the ctrl->lock? What exactly changed for this?
>
The update of ctrl->state is now done using WRITE_ONCE(). So it
makes sense to pair the read of ctrl->state using READ_ONCE(). And
the helper nvme_ctrl_state(), in fact, reads the ctrl->state
using READ_ONCE(). So, if we use the nvme_ctrl_state() for
retrieving ctrl->state value then we don't need locking.
I think I would better format the commit message of this patch
to describe the above intent.
Thanks,
--Nilay
More information about the Linux-nvme
mailing list