On Apr 19 15:01, Alexander Mikhalitsyn wrote:
> From: Alexander Mikhalitsyn <[email protected]>
> 
> Instead of unmapping req->sg in nvme_post_cqes(), we can do it earlier in
> nvme_enqueue_req_completion(). When req completion is enqueued we don't
> need to access req->sg anymore. We only care about req->sq, req->cqe and
> req->status.
> 
> Signed-off-by: Alexander Mikhalitsyn <[email protected]>

Nice cleanup,

Reviewed-by: Klaus Jensen <[email protected]>

> ---
>  hw/nvme/ctrl.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
> index d9bf32bff2c..1ff91493b60 100644
> --- a/hw/nvme/ctrl.c
> +++ b/hw/nvme/ctrl.c
> @@ -1534,7 +1534,6 @@ static void nvme_post_cqes(void *opaque)
>          QTAILQ_REMOVE(&cq->req_list, req, entry);
>  
>          nvme_inc_cq_tail(cq);
> -        nvme_sg_unmap(&req->sg);
>  
>          if (QTAILQ_EMPTY(&sq->req_list) && !nvme_sq_empty(sq)) {
>              qemu_bh_schedule(sq->bh);
> @@ -1564,6 +1563,8 @@ static void nvme_enqueue_req_completion(NvmeCQueue *cq, 
> NvmeRequest *req)
>                                        req->status, req->cmd.opcode);
>      }
>  
> +    nvme_sg_unmap(&req->sg);
> +
>      QTAILQ_REMOVE(&req->sq->out_req_list, req, entry);
>      QTAILQ_INSERT_TAIL(&cq->req_list, req, entry);
>  
> -- 
> 2.47.3
> 
> 

Attachment: signature.asc
Description: PGP signature

Reply via email to