mirror of https://gitee.com/openkylin/qemu.git
hw/block/nvme: factor out block backend setup
Signed-off-by: Klaus Jensen <k.jensen@samsung.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com> Reviewed-by: Keith Busch <kbusch@kernel.org> Message-Id: <20200609190333.59390-13-its@irrelevant.dk> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
a17f50188b
commit
90f4511543
|
@ -1410,6 +1410,13 @@ static void nvme_init_state(NvmeCtrl *n)
|
||||||
n->cq = g_new0(NvmeCQueue *, n->params.max_ioqpairs + 1);
|
n->cq = g_new0(NvmeCQueue *, n->params.max_ioqpairs + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void nvme_init_blk(NvmeCtrl *n, Error **errp)
|
||||||
|
{
|
||||||
|
blkconf_blocksizes(&n->conf);
|
||||||
|
blkconf_apply_backend_options(&n->conf, blk_is_read_only(n->conf.blk),
|
||||||
|
false, errp);
|
||||||
|
}
|
||||||
|
|
||||||
static void nvme_realize(PCIDevice *pci_dev, Error **errp)
|
static void nvme_realize(PCIDevice *pci_dev, Error **errp)
|
||||||
{
|
{
|
||||||
NvmeCtrl *n = NVME(pci_dev);
|
NvmeCtrl *n = NVME(pci_dev);
|
||||||
|
@ -1434,9 +1441,9 @@ static void nvme_realize(PCIDevice *pci_dev, Error **errp)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
blkconf_blocksizes(&n->conf);
|
nvme_init_blk(n, &local_err);
|
||||||
if (!blkconf_apply_backend_options(&n->conf, blk_is_read_only(n->conf.blk),
|
if (local_err) {
|
||||||
false, errp)) {
|
error_propagate(errp, local_err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue