qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Luiz Capitulino <lcapitulino@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 3/5] ide: Generate BLOCK_IO_ERROR QMP event
Date: Wed, 3 Feb 2010 09:41:28 -0200	[thread overview]
Message-ID: <20100203094128.0d7f77f8@doriath> (raw)
In-Reply-To: <4B693DA3.6080702@redhat.com>

On Wed, 03 Feb 2010 10:10:59 +0100
Kevin Wolf <kwolf@redhat.com> wrote:

> Am 03.02.2010 09:31, schrieb Christoph Hellwig:
> > On Tue, Feb 02, 2010 at 07:10:11PM -0200, Luiz Capitulino wrote:
> >> Just call bdrv_mon_event() in the right place.
> >>
> >> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
> >> ---
> >>  hw/ide/core.c |    6 +++++-
> >>  1 files changed, 5 insertions(+), 1 deletions(-)
> >>
> >> diff --git a/hw/ide/core.c b/hw/ide/core.c
> >> index b6643e8..603e537 100644
> >> --- a/hw/ide/core.c
> >> +++ b/hw/ide/core.c
> >> @@ -480,14 +480,17 @@ static int ide_handle_rw_error(IDEState *s, int error, int op)
> >>      int is_read = (op & BM_STATUS_RETRY_READ);
> >>      BlockInterfaceErrorAction action = drive_get_on_error(s->bs, is_read);
> >>  
> >> -    if (action == BLOCK_ERR_IGNORE)
> >> +    if (action == BLOCK_ERR_IGNORE) {
> >> +        bdrv_mon_event(s->bs, BDRV_ACTION_IGNORE, is_read);
> >>          return 0;
> >> +    }
> >>  
> >>      if ((error == ENOSPC && action == BLOCK_ERR_STOP_ENOSPC)
> >>              || action == BLOCK_ERR_STOP_ANY) {
> >>          s->bus->bmdma->unit = s->unit;
> >>          s->bus->bmdma->status |= op;
> >>          vm_stop(0);
> >> +        bdrv_mon_event(s->bs, BDRV_ACTION_STOP, is_read);
> > 
> > Why isn't the event directly sent from drive_get_on_error?  Having
> > to opencode this in every driver is a sure way to make sure it's
> > going to be broken somewhere.
> 
> Because drive_get_on_error isn't an event handler and shouldn't have any
> side effects. It might be called anywhere. And it doesn't know the error
> code, so it can't even decide if the VM has stopped or not.
> 
> Maybe we could look at writing a generic handle_rw_error function for
> all block devices. They look pretty much the same in every driver, even
> without the monitor event.

 Any design in mind? I could try this later (preferably after the
event series is merged).

 What if block devices register the following callbacks somewhere:

- handle_rw_error_ignore()
- handle_rw_error_stop()
- handle_rw_error_report()

 But then they'd have to trigger their call by calling, say,
block_handle_rw_error() from the error site.

  reply	other threads:[~2010-02-03 11:41 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-02 21:10 [Qemu-devel] [PATCH v0 0/5]: BLOCK_IO_ERROR QMP event Luiz Capitulino
2010-02-02 21:10 ` [Qemu-devel] [PATCH 1/5] QMP: BLOCK_IO_ERROR event handling Luiz Capitulino
2010-02-03  9:18   ` [Qemu-devel] " Kevin Wolf
2010-02-03 11:27     ` Luiz Capitulino
2010-02-02 21:10 ` [Qemu-devel] [PATCH 2/5] block: BLOCK_IO_ERROR QMP event Luiz Capitulino
2010-02-02 21:10 ` [Qemu-devel] [PATCH 3/5] ide: Generate " Luiz Capitulino
2010-02-03  8:31   ` Christoph Hellwig
2010-02-03  9:10     ` Kevin Wolf
2010-02-03 11:41       ` Luiz Capitulino [this message]
2010-02-02 21:10 ` [Qemu-devel] [PATCH 4/5] scsi: " Luiz Capitulino
2010-02-02 21:10 ` [Qemu-devel] [PATCH 5/5] virtio-blk: " Luiz Capitulino
2010-02-03 10:25 ` [Qemu-devel] Re: [PATCH v0 0/5]: " Kevin Wolf
  -- strict thread matches above, loose matches on Subject: below --
2010-02-03 14:40 [Qemu-devel] [PATCH v1 " Luiz Capitulino
2010-02-03 14:41 ` [Qemu-devel] [PATCH 3/5] ide: Generate " Luiz Capitulino

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=20100203094128.0d7f77f8@doriath \
    --to=lcapitulino@redhat.com \
    --cc=hch@lst.de \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.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).