[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [PATCH v4 16/18] xen: automatically create XenBlockDevi
From: |
Paul Durrant |
Subject: |
Re: [Qemu-block] [PATCH v4 16/18] xen: automatically create XenBlockDevice-s |
Date: |
Fri, 14 Dec 2018 15:39:54 +0000 |
> -----Original Message-----
> From: Xen-devel [mailto:address@hidden On Behalf
> Of Paul Durrant
> Sent: 14 December 2018 14:50
> To: 'Kevin Wolf' <address@hidden>
> Cc: address@hidden; Stefano Stabellini
> <address@hidden>; address@hidden; address@hidden;
> Max Reitz <address@hidden>
> Subject: Re: [Xen-devel] [PATCH v4 16/18] xen: automatically create
> XenBlockDevice-s
>
> > -----Original Message-----
> [snip]
> > > +
> > > + blockdev->auto_iothread = iothread;
> > > +
> > > + object_property_set_bool(OBJECT(dev), true, "realized",
> > &local_err);
> > > + if (local_err) {
> > > + error_propagate_prepend(errp, local_err,
> > > + "initialization of device %s failed:
> ",
> > > + type);
> > > + goto unref;
> > > + }
> > > +
> > > + blockdev_mark_auto_del(blk);
> >
> > You don't need this one any more then (if you look into the details,
> > it's one of the more confusing parts of the drive_*() magic, so it's
> > good to get rid of it). When you use the anonymous BlockBackend created
> > by the qdev drive property (because you passed it a node-name rather
> > than a BlockBackend name) means that the BlockBackend disappears
> > together with the drive.
> >
> > Note that explicitly created block nodes must also be unreferenced
> > explicitly (bdrv_open() should be paired with bdrv_unref() and
> > qmp_blockdev_add() with qmp_blockdev_del()). Maybe XenBackendInfo needs
> > a .destroy callback so we can do destruction symmetrically to device
> > creation?
> >
>
> I have something implemented using qmp_blockdev_add() now and it seems to
> work, but when I call into qmp_blockdev_del() (passing in the node-name I
> used to the set the "drive" parameter) during unrealize then it tells me
> that the device is in use. Do I need a callback that runs after unrealize
> of the device?
I have coded it up now and apparently I do.
Paul
>
> Paul
>
> > > + return;
> > > +
> > > +unref:
> > > + if (dev) {
> > > + object_unparent(OBJECT(dev));
> > > + }
> > > +
> > > + if (iothread) {
> > > + iothread_destroy(iothread);
> > > + }
> > > +
> > > + if (blk) {
> > > + monitor_remove_blk(blk);
> > > + blk_unref(blk);
> > > + }
> > > +}
> >
> > Kevin
>
> _______________________________________________
> Xen-devel mailing list
> address@hidden
> https://lists.xenproject.org/mailman/listinfo/xen-devel
- [Qemu-block] [PATCH v4 17/18] MAINTAINERS: add myself as a Xen maintainer, (continued)
- [Qemu-block] [PATCH v4 17/18] MAINTAINERS: add myself as a Xen maintainer, Paul Durrant, 2018/12/11
- [Qemu-block] [PATCH v4 12/18] xen: remove 'ioreq' struct/varable/field names from dataplane/xen-block.c, Paul Durrant, 2018/12/11
- [Qemu-block] [PATCH v4 18/18] xen: remove the legacy 'xen_disk' backend, Paul Durrant, 2018/12/11
- [Qemu-block] [PATCH v4 10/18] xen: add header and build dataplane/xen-block.c, Paul Durrant, 2018/12/11
- [Qemu-block] [PATCH v4 11/18] xen: remove 'XenBlkDev' and 'blkdev' names from dataplane/xen-block, Paul Durrant, 2018/12/11
- [Qemu-block] [PATCH v4 16/18] xen: automatically create XenBlockDevice-s, Paul Durrant, 2018/12/11