Thread (20 messages) 20 messages, 6 authors, 2021-08-23

Re: [PATCH 1/9] nvme: use blk_mq_alloc_disk

From: Keith Busch <kbusch@kernel.org>
Date: 2021-08-19 14:58:33
Also in: linux-block, linux-s390, linux-scsi

On Thu, Aug 19, 2021 at 07:54:55AM -0700, Keith Busch wrote:
On Mon, Aug 16, 2021 at 03:19:02PM +0200, Christoph Hellwig wrote:
quoted
@@ -3729,9 +3729,14 @@ static void nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid,
 	if (!ns)
 		goto out_free_id;
 
-	ns->queue = blk_mq_init_queue(ctrl->tagset);
-	if (IS_ERR(ns->queue))
+	disk = blk_mq_alloc_disk(ctrl->tagset, ns);
+	if (IS_ERR(disk))
 		goto out_free_ns;
+	disk->fops = &nvme_bdev_ops;
+	disk->private_data = ns;
+
+	ns->disk = disk;
+	ns->queue = disk->queue;
 
 	if (ctrl->opts && ctrl->opts->data_digest)
 		blk_queue_flag_set(QUEUE_FLAG_STABLE_WRITES, ns->queue);
@@ -3740,20 +3745,12 @@ static void nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid,
 	if (ctrl->ops->flags & NVME_F_PCI_P2PDMA)
 		blk_queue_flag_set(QUEUE_FLAG_PCI_P2PDMA, ns->queue);
 
-	ns->queue->queuedata = ns;
 	ns->ctrl = ctrl;
 	kref_init(&ns->kref);
With this removal, I don't find queuedata being set anywhere, but
the driver still uses it in various places expecting 'ns'. Am I missing
something? Should all nvme's queuedata references be changed to
q->disk->private_data?
Oops, I see the queuedata is set via blk_mq_alloc_disk().

Looks good.

Reviewed-by: Keith Busch <kbusch@kernel.org>

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help