From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49436) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YSS7X-0002tx-Q8 for qemu-devel@nongnu.org; Mon, 02 Mar 2015 10:19:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YSS7S-0002WW-PN for qemu-devel@nongnu.org; Mon, 02 Mar 2015 10:18:59 -0500 Message-ID: <54F47F5A.10803@redhat.com> Date: Mon, 02 Mar 2015 10:18:50 -0500 From: Max Reitz MIME-Version: 1.0 References: <1425055440-18038-1-git-send-email-mreitz@redhat.com> <1425055440-18038-6-git-send-email-mreitz@redhat.com> <20150228025520.GA27129@ad.nay.redhat.com> In-Reply-To: <20150228025520.GA27129@ad.nay.redhat.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v4 05/11] block: Move BDS close notifiers into BB List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng Cc: Kevin Wolf , qemu-block@nongnu.org, qemu-devel@nongnu.org, Markus Armbruster , Stefan Hajnoczi , Paolo Bonzini On 2015-02-27 at 21:55, Fam Zheng wrote: > On Fri, 02/27 11:43, Max Reitz wrote: >> static void virtio_scsi_hotplug(HotplugHandler *hotplug_dev, DeviceState *dev, >> Error **errp) >> { >> @@ -763,12 +794,26 @@ static void virtio_scsi_hotplug(HotplugHandler *hotplug_dev, DeviceState *dev, >> SCSIDevice *sd = SCSI_DEVICE(dev); >> >> if (s->ctx && !s->dataplane_disabled) { >> + VirtIOSCSIBlkChangeNotifier *insert_notifier, *remove_notifier; >> + >> + insert_notifier = g_new0(VirtIOSCSIBlkChangeNotifier, 1); >> + insert_notifier->n.notify = virtio_scsi_blk_insert_notifier; >> + insert_notifier->s = s; >> + insert_notifier->sd = sd; >> + blk_add_insert_bs_notifier(sd->conf.blk, &insert_notifier->n); >> + QTAILQ_INSERT_TAIL(&s->insert_notifiers, insert_notifier, next); > Could you instead embed a Notifier into SCSIDevice, similarly? That way there > is no need to maintain a list in VirtIOSCSI. I thought about that, but somehow SCSIDevice seemed so generic to me... I didn't really want to add a VirtIOSCSI pointer to it (or even just a notifier only to be used by virtio-scsi). So I take it you want me to? Max >> + >> + remove_notifier = g_new0(VirtIOSCSIBlkChangeNotifier, 1); >> + remove_notifier->n.notify = virtio_scsi_blk_remove_notifier; >> + remove_notifier->s = s; >> + remove_notifier->sd = sd; >> + blk_add_remove_bs_notifier(sd->conf.blk, &remove_notifier->n); >> + QTAILQ_INSERT_TAIL(&s->remove_notifiers, remove_notifier, next); >> + >> if (blk_op_is_blocked(sd->conf.blk, BLOCK_OP_TYPE_DATAPLANE, errp)) { >> return; >> } >> - assert(!s->blocker); >> - error_setg(&s->blocker, "block device is in use by data plane"); >> - blk_op_block_all(sd->conf.blk, s->blocker); >> + virtio_scsi_set_up_op_blockers(s, sd); >> } > Fam