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: > > @@ -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@xxxxxxxxxx>