All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Fam Zheng <famz@redhat.com>
Cc: qemu-devel@nongnu.org, Kevin Wolf <kwolf@redhat.com>,
	Max Reitz <mreitz@redhat.com>,
	Markus Armbruster <armbru@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	qemu-block@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 2/3] virtio-blk: Remove op blocker for dataplane
Date: Wed, 18 May 2016 11:26:10 +0300	[thread overview]
Message-ID: <20160518112603-mutt-send-email-mst@redhat.com> (raw)
In-Reply-To: <1463559850-5244-3-git-send-email-famz@redhat.com>

On Wed, May 18, 2016 at 04:24:09PM +0800, Fam Zheng wrote:
> Block layer is prepared to unspecialize dataplane, an evidence is this
> almost complete list of unblocked operations. It has all types except
> two (actually three if DATAPLANE itself counts but blockdev.c makes sure
> attaching twice is not possible): MIRROR_TARGET and BACKUP_TARGET.
> 
> blockdev-mirror refuses to start if target is attached, so the first is
> not a problem.
> 
> By removing BACKUP_TARGET, blockdev-backup will become permissive to
> write to a virtio-blk dataplane disk, but that is not worse than
> non-dataplane given the latter is already possible. In either case,
> blockdev.c always checks the target and source are on the same
> AioContext, or bring them together if possible.
> 
> Signed-off-by: Fam Zheng <famz@redhat.com>

Acked-by: Michael S. Tsirkin <mst@redhat.com>

> ---
>  hw/block/dataplane/virtio-blk.c | 63 -----------------------------------------
>  1 file changed, 63 deletions(-)
> 
> diff --git a/hw/block/dataplane/virtio-blk.c b/hw/block/dataplane/virtio-blk.c
> index 3cb97c9..2073f9a 100644
> --- a/hw/block/dataplane/virtio-blk.c
> +++ b/hw/block/dataplane/virtio-blk.c
> @@ -37,8 +37,6 @@ struct VirtIOBlockDataPlane {
>      EventNotifier *guest_notifier;  /* irq */
>      QEMUBH *bh;                     /* bh for guest notification */
>  
> -    Notifier insert_notifier, remove_notifier;
> -
>      /* Note that these EventNotifiers are assigned by value.  This is
>       * fine as long as you do not call event_notifier_cleanup on them
>       * (because you don't own the file descriptor or handle; you just
> @@ -46,9 +44,6 @@ struct VirtIOBlockDataPlane {
>       */
>      IOThread *iothread;
>      AioContext *ctx;
> -
> -    /* Operation blocker on BDS */
> -    Error *blocker;
>  };
>  
>  /* Raise an interrupt to signal guest, if necessary */
> @@ -68,54 +63,6 @@ static void notify_guest_bh(void *opaque)
>      event_notifier_set(s->guest_notifier);
>  }
>  
> -static void data_plane_set_up_op_blockers(VirtIOBlockDataPlane *s)
> -{
> -    assert(!s->blocker);
> -    error_setg(&s->blocker, "block device is in use by data plane");
> -    blk_op_block_all(s->conf->conf.blk, s->blocker);
> -    blk_op_unblock(s->conf->conf.blk, BLOCK_OP_TYPE_RESIZE, s->blocker);
> -    blk_op_unblock(s->conf->conf.blk, BLOCK_OP_TYPE_DRIVE_DEL, s->blocker);
> -    blk_op_unblock(s->conf->conf.blk, BLOCK_OP_TYPE_BACKUP_SOURCE, s->blocker);
> -    blk_op_unblock(s->conf->conf.blk, BLOCK_OP_TYPE_CHANGE, s->blocker);
> -    blk_op_unblock(s->conf->conf.blk, BLOCK_OP_TYPE_COMMIT_SOURCE, s->blocker);
> -    blk_op_unblock(s->conf->conf.blk, BLOCK_OP_TYPE_COMMIT_TARGET, s->blocker);
> -    blk_op_unblock(s->conf->conf.blk, BLOCK_OP_TYPE_EJECT, s->blocker);
> -    blk_op_unblock(s->conf->conf.blk, BLOCK_OP_TYPE_EXTERNAL_SNAPSHOT,
> -                   s->blocker);
> -    blk_op_unblock(s->conf->conf.blk, BLOCK_OP_TYPE_INTERNAL_SNAPSHOT,
> -                   s->blocker);
> -    blk_op_unblock(s->conf->conf.blk, BLOCK_OP_TYPE_INTERNAL_SNAPSHOT_DELETE,
> -                   s->blocker);
> -    blk_op_unblock(s->conf->conf.blk, BLOCK_OP_TYPE_MIRROR_SOURCE, s->blocker);
> -    blk_op_unblock(s->conf->conf.blk, BLOCK_OP_TYPE_STREAM, s->blocker);
> -    blk_op_unblock(s->conf->conf.blk, BLOCK_OP_TYPE_REPLACE, s->blocker);
> -}
> -
> -static void data_plane_remove_op_blockers(VirtIOBlockDataPlane *s)
> -{
> -    if (s->blocker) {
> -        blk_op_unblock_all(s->conf->conf.blk, s->blocker);
> -        error_free(s->blocker);
> -        s->blocker = NULL;
> -    }
> -}
> -
> -static void data_plane_blk_insert_notifier(Notifier *n, void *data)
> -{
> -    VirtIOBlockDataPlane *s = container_of(n, VirtIOBlockDataPlane,
> -                                           insert_notifier);
> -    assert(s->conf->conf.blk == data);
> -    data_plane_set_up_op_blockers(s);
> -}
> -
> -static void data_plane_blk_remove_notifier(Notifier *n, void *data)
> -{
> -    VirtIOBlockDataPlane *s = container_of(n, VirtIOBlockDataPlane,
> -                                           remove_notifier);
> -    assert(s->conf->conf.blk == data);
> -    data_plane_remove_op_blockers(s);
> -}
> -
>  /* Context: QEMU global mutex held */
>  void virtio_blk_data_plane_create(VirtIODevice *vdev, VirtIOBlkConf *conf,
>                                    VirtIOBlockDataPlane **dataplane,
> @@ -158,13 +105,6 @@ void virtio_blk_data_plane_create(VirtIODevice *vdev, VirtIOBlkConf *conf,
>      s->ctx = iothread_get_aio_context(s->iothread);
>      s->bh = aio_bh_new(s->ctx, notify_guest_bh, s);
>  
> -    s->insert_notifier.notify = data_plane_blk_insert_notifier;
> -    s->remove_notifier.notify = data_plane_blk_remove_notifier;
> -    blk_add_insert_bs_notifier(conf->conf.blk, &s->insert_notifier);
> -    blk_add_remove_bs_notifier(conf->conf.blk, &s->remove_notifier);
> -
> -    data_plane_set_up_op_blockers(s);
> -
>      *dataplane = s;
>  }
>  
> @@ -176,9 +116,6 @@ void virtio_blk_data_plane_destroy(VirtIOBlockDataPlane *s)
>      }
>  
>      virtio_blk_data_plane_stop(s);
> -    data_plane_remove_op_blockers(s);
> -    notifier_remove(&s->insert_notifier);
> -    notifier_remove(&s->remove_notifier);
>      qemu_bh_delete(s->bh);
>      object_unref(OBJECT(s->iothread));
>      g_free(s);
> -- 
> 2.8.2

  reply	other threads:[~2016-05-18  8:26 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-18  8:24 [Qemu-devel] [PATCH 0/3] Drop virtio-{blk,scsi} op blockers Fam Zheng
2016-05-18  8:24 ` [Qemu-devel] [PATCH 1/3] blockdev-backup: Don't move target AioContext if it's attached Fam Zheng
2016-05-19 20:42   ` Stefan Hajnoczi
2016-05-23  1:09     ` Fam Zheng
2016-05-20  8:03   ` Kevin Wolf
2016-05-23  1:00     ` Fam Zheng
2016-05-18  8:24 ` [Qemu-devel] [PATCH 2/3] virtio-blk: Remove op blocker for dataplane Fam Zheng
2016-05-18  8:26   ` Michael S. Tsirkin [this message]
2016-05-18  8:24 ` [Qemu-devel] [PATCH 3/3] virtio-scsi: " Fam Zheng
2016-05-18  8:26   ` Michael S. Tsirkin
2016-05-18  8:27 ` [Qemu-devel] [PATCH 0/3] Drop virtio-{blk,scsi} op blockers Michael S. Tsirkin
2016-05-19 20:48 ` Stefan Hajnoczi
2016-05-19 20:55 ` Stefan Hajnoczi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160518112603-mutt-send-email-mst@redhat.com \
    --to=mst@redhat.com \
    --cc=armbru@redhat.com \
    --cc=famz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.