[RFC 2/3] nvme: passthrough helper with callback

Chaitanya Kulkarni Chaitanya.Kulkarni at wdc.com
Fri Mar 5 04:14:11 GMT 2021


On 3/4/21 03:14, Kanchan Joshi wrote:
> On Wed, Mar 3, 2021 at 8:52 PM Chaitanya Kulkarni
> <Chaitanya.Kulkarni at wdc.com> wrote:
>> On 3/2/21 23:22, Kanchan Joshi wrote:
>>> -void nvme_execute_passthru_rq(struct request *rq)
>>> +void nvme_execute_passthru_rq_common(struct request *rq,
>>> +                     rq_end_io_fn *done)
>>>  {
>>>       struct nvme_command *cmd = nvme_req(rq)->cmd;
>>>       struct nvme_ctrl *ctrl = nvme_req(rq)->ctrl;
>>> @@ -1135,9 +1136,17 @@ void nvme_execute_passthru_rq(struct request *rq)
>>>       u32 effects;
>>>
>>>       effects = nvme_passthru_start(ctrl, ns, cmd->common.opcode);
>>> -     blk_execute_rq(disk, rq, 0);
>>> +     if (!done)
>>> +             blk_execute_rq(disk, rq, 0);
>>> +     else
>>> +             blk_execute_rq_nowait(disk, rq, 0, done);
>>>       nvme_passthru_end(ctrl, effects);
>> This needs a detailed explanation in order to prove the correctness.
> Do you see something wrong here?
> blk_execute_rq() employs the same helper (i.e. nowait one) and uses
> additional completion-variable to make it sync.
>

There is no gurantee that command will finish between call to
blk_execute_rq_nowait()
and nvme_passthru_end() is there ?





More information about the Linux-nvme mailing list