[PATCHv2 2/2] nvme-pci: remove cached shadow doorbell offsets

Christoph Hellwig hch at lst.de
Thu Oct 14 09:53:27 PDT 2021


On Thu, Oct 14, 2021 at 09:45:43AM -0700, Keith Busch wrote:
> +static bool nvme_dbbuf_update_sq(struct nvme_queue *nvmeq)
> +{
> +	struct nvme_dev *dev = nvmeq->dev;
>  
> +	if (!dev->dbbuf_dbs)
> +		return true;
> +
> +	return nvme_dbbuf_update_and_check_event(nvmeq->sq_tail,
> +		&dev->dbbuf_dbs[sq_idx(nvmeq->qid, dev->db_stride)],
> +		&dev->dbbuf_eis[sq_idx(nvmeq->qid, dev->db_stride)]);
> +}
> +
> +static bool nvme_dbbuf_update_cq(struct nvme_queue *nvmeq)
> +{
> +	struct nvme_dev *dev = nvmeq->dev;
> +
> +	if (!dev->dbbuf_dbs)
> +		return true;
> +
> +	return nvme_dbbuf_update_and_check_event(nvmeq->cq_head,
> +		&dev->dbbuf_dbs[cq_idx(nvmeq->qid, dev->db_stride)],
> +		&dev->dbbuf_eis[cq_idx(nvmeq->qid, dev->db_stride)]);

This would look much cleaner with a local variable for the offset.

But otherwise it looks sensible to me.



More information about the Linux-nvme mailing list