From: "Michael S. Tsirkin" <mst@redhat.com>
To: Heinz Graalfs <graalfs@linux.vnet.ibm.com>
Cc: borntraeger@de.ibm.com, virtualization@lists.linux-foundation.org
Subject: Re: [PATCH RFC 2/3] virtio_blk: add virtblk_notify() as virtio_driver's notify() callback
Date: Thu, 21 Nov 2013 08:41:57 +0200 [thread overview]
Message-ID: <20131121064157.GI19005@redhat.com> (raw)
In-Reply-To: <1384960923-31463-3-git-send-email-graalfs@linux.vnet.ibm.com>
On Wed, Nov 20, 2013 at 04:22:02PM +0100, Heinz Graalfs wrote:
> Add virtblk_notify() as virtio_driver's notify() callback.
>
> When a transport driver is notified that a device disappeared it
> should invoke this callback to prevent further request queueing.
>
> Subsequent block layer calls of virtio_blk's request function will
> fail, resulting in appropriate I/O errors.
>
> Signed-off-by: Heinz Graalfs <graalfs@linux.vnet.ibm.com>
> ---
> drivers/block/virtio_blk.c | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
> index 2d43be4..7fc1d62 100644
> --- a/drivers/block/virtio_blk.c
> +++ b/drivers/block/virtio_blk.c
> @@ -901,6 +901,19 @@ static void virtblk_remove(struct virtio_device *vdev)
> ida_simple_remove(&vd_index_ida, index);
> }
>
> +static int virtblk_notify(struct virtio_device *vdev, int event)
> +{
> + struct virtio_blk *vblk = vdev->priv;
> +
> + if (event == VDEV_GONE) {
> + queue_flag_set_unlocked(QUEUE_FLAG_DYING, vblk->disk->queue);
> + queue_flag_set_unlocked(QUEUE_FLAG_NOMERGES, vblk->disk->queue);
> + queue_flag_set_unlocked(QUEUE_FLAG_NOXMERGES,
> + vblk->disk->queue);
> + }
> + return NOTIFY_DONE;
Also pls include linux/notifier.h for this value.
> +}
> +
> #ifdef CONFIG_PM
> static int virtblk_freeze(struct virtio_device *vdev)
> {
> @@ -961,6 +974,7 @@ static struct virtio_driver virtio_blk = {
> .probe = virtblk_probe,
> .remove = virtblk_remove,
> .config_changed = virtblk_config_changed,
> + .notify = virtblk_notify,
> #ifdef CONFIG_PM
> .freeze = virtblk_freeze,
> .restore = virtblk_restore,
> --
> 1.8.3.1
next prev parent reply other threads:[~2013-11-21 6:41 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-20 15:22 [PATCH RFC 0/3] virtio: add new notify() callback to virtio_driver Heinz Graalfs
2013-11-20 15:22 ` [PATCH RFC 1/3] virtio: add " Heinz Graalfs
2013-11-21 1:30 ` Rusty Russell
2013-11-21 6:44 ` Michael S. Tsirkin
2013-11-20 15:22 ` [PATCH RFC 2/3] virtio_blk: add virtblk_notify() as virtio_driver's notify() callback Heinz Graalfs
2013-11-21 6:39 ` Michael S. Tsirkin
2013-11-21 6:41 ` Michael S. Tsirkin [this message]
2013-11-20 15:22 ` [PATCH RFC 3/3] virtio_ccw: invoke virtio_driver's notify() on CIO_GONE notification Heinz Graalfs
2013-11-21 6:47 ` [PATCH RFC 0/3] virtio: add new notify() callback to virtio_driver Michael S. Tsirkin
2013-11-21 14:43 ` Heinz Graalfs
2013-11-21 14:58 ` Michael S. Tsirkin
2013-11-21 17:18 ` Heinz Graalfs
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=20131121064157.GI19005@redhat.com \
--to=mst@redhat.com \
--cc=borntraeger@de.ibm.com \
--cc=graalfs@linux.vnet.ibm.com \
--cc=virtualization@lists.linux-foundation.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).