[Qemu-devel] [PATCH 2/4] block: Add blkdebug hook for copy-on-read

Eric Blake posted 4 patches 8 years, 4 months ago
There is a newer version of this series
[Qemu-devel] [PATCH 2/4] block: Add blkdebug hook for copy-on-read
Posted by Eric Blake 8 years, 4 months ago
Make it possible to inject errors on writes performed during a
read operation due to copy-on-read semantics.

Signed-off-by: Eric Blake <eblake@redhat.com>
---
 qapi/block-core.json | 5 ++++-
 block/io.c           | 1 +
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/qapi/block-core.json b/qapi/block-core.json
index 750bb0c77c..ab96e348e6 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
@@ -2538,6 +2538,8 @@
 #
 # @l1_shrink_free_l2_clusters: discard the l2 tables. (since 2.11)
 #
+# @cor_write: a write due to copy-on-read (since 2.11)
+#
 # Since: 2.9
 ##
 { 'enum': 'BlkdebugEvent', 'prefix': 'BLKDBG',
@@ -2555,7 +2557,8 @@
             'flush_to_disk', 'pwritev_rmw_head', 'pwritev_rmw_after_head',
             'pwritev_rmw_tail', 'pwritev_rmw_after_tail', 'pwritev',
             'pwritev_zero', 'pwritev_done', 'empty_image_prepare',
-            'l1_shrink_write_table', 'l1_shrink_free_l2_clusters' ] }
+            'l1_shrink_write_table', 'l1_shrink_free_l2_clusters',
+            'cor_write'] }

 ##
 # @BlkdebugInjectErrorOptions:
diff --git a/block/io.c b/block/io.c
index d633b0f851..97d9fa655d 100644
--- a/block/io.c
+++ b/block/io.c
@@ -983,6 +983,7 @@ static int coroutine_fn bdrv_co_do_copy_on_readv(BdrvChild *child,
         goto err;
     }

+    bdrv_debug_event(bs, BLKDBG_COR_WRITE);
     if (drv->bdrv_co_pwrite_zeroes &&
         buffer_is_zero(bounce_buffer, iov.iov_len)) {
         /* FIXME: Should we (perhaps conditionally) be setting
-- 
2.13.6


Re: [Qemu-devel] [Qemu-block] [PATCH 2/4] block: Add blkdebug hook for copy-on-read
Posted by Jeff Cody 8 years, 4 months ago
On Sat, Sep 30, 2017 at 02:53:43PM -0500, Eric Blake wrote:
> Make it possible to inject errors on writes performed during a
> read operation due to copy-on-read semantics.
> 
> Signed-off-by: Eric Blake <eblake@redhat.com>


Reviewed-by: Jeff Cody <jcody@redhat.com>


> ---
>  qapi/block-core.json | 5 ++++-
>  block/io.c           | 1 +
>  2 files changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/qapi/block-core.json b/qapi/block-core.json
> index 750bb0c77c..ab96e348e6 100644
> --- a/qapi/block-core.json
> +++ b/qapi/block-core.json
> @@ -2538,6 +2538,8 @@
>  #
>  # @l1_shrink_free_l2_clusters: discard the l2 tables. (since 2.11)
>  #
> +# @cor_write: a write due to copy-on-read (since 2.11)
> +#
>  # Since: 2.9
>  ##
>  { 'enum': 'BlkdebugEvent', 'prefix': 'BLKDBG',
> @@ -2555,7 +2557,8 @@
>              'flush_to_disk', 'pwritev_rmw_head', 'pwritev_rmw_after_head',
>              'pwritev_rmw_tail', 'pwritev_rmw_after_tail', 'pwritev',
>              'pwritev_zero', 'pwritev_done', 'empty_image_prepare',
> -            'l1_shrink_write_table', 'l1_shrink_free_l2_clusters' ] }
> +            'l1_shrink_write_table', 'l1_shrink_free_l2_clusters',
> +            'cor_write'] }
> 
>  ##
>  # @BlkdebugInjectErrorOptions:
> diff --git a/block/io.c b/block/io.c
> index d633b0f851..97d9fa655d 100644
> --- a/block/io.c
> +++ b/block/io.c
> @@ -983,6 +983,7 @@ static int coroutine_fn bdrv_co_do_copy_on_readv(BdrvChild *child,
>          goto err;
>      }
> 
> +    bdrv_debug_event(bs, BLKDBG_COR_WRITE);
>      if (drv->bdrv_co_pwrite_zeroes &&
>          buffer_is_zero(bounce_buffer, iov.iov_len)) {
>          /* FIXME: Should we (perhaps conditionally) be setting
> -- 
> 2.13.6
> 
> 

Re: [Qemu-devel] [PATCH 2/4] block: Add blkdebug hook for copy-on-read
Posted by Kevin Wolf 8 years, 4 months ago
Am 30.09.2017 um 21:53 hat Eric Blake geschrieben:
> Make it possible to inject errors on writes performed during a
> read operation due to copy-on-read semantics.
> 
> Signed-off-by: Eric Blake <eblake@redhat.com>

Reviewed-by: Kevin Wolf <kwolf@redhat.com>

Re: [Qemu-devel] [PATCH 2/4] block: Add blkdebug hook for copy-on-read
Posted by John Snow 8 years, 4 months ago

On 09/30/2017 03:53 PM, Eric Blake wrote:
> Make it possible to inject errors on writes performed during a
> read operation due to copy-on-read semantics.
> 
> Signed-off-by: Eric Blake <eblake@redhat.com>

I suppose our docs DO say "ehh, see block-core.json" so I suppose no
update is necessary :)

Reviewed-by: John Snow <jsnow@redhat.com>

Re: [Qemu-devel] [Qemu-block] [PATCH 2/4] block: Add blkdebug hook for copy-on-read
Posted by Stefan Hajnoczi 8 years, 4 months ago
On Sat, Sep 30, 2017 at 02:53:43PM -0500, Eric Blake wrote:
> Make it possible to inject errors on writes performed during a
> read operation due to copy-on-read semantics.
> 
> Signed-off-by: Eric Blake <eblake@redhat.com>
> ---
>  qapi/block-core.json | 5 ++++-
>  block/io.c           | 1 +
>  2 files changed, 5 insertions(+), 1 deletion(-)

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>