qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/2] Fix VHDX qemu-iotests 033 failure
@ 2015-04-15  9:27 Kevin Wolf
  2015-04-15  9:27 ` [Qemu-devel] [PATCH 1/2] blkdebug: Add bdrv_truncate() Kevin Wolf
  2015-04-15  9:27 ` [Qemu-devel] [PATCH 2/2] vhdx: Fix zero-fill iov length Kevin Wolf
  0 siblings, 2 replies; 5+ messages in thread
From: Kevin Wolf @ 2015-04-15  9:27 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, jcody, qemu-devel

Kevin Wolf (2):
  blkdebug: Add bdrv_truncate()
  vhdx: Fix zero-fill iov length

 block/blkdebug.c | 6 ++++++
 block/vhdx.c     | 4 ++--
 2 files changed, 8 insertions(+), 2 deletions(-)

-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Qemu-devel] [PATCH 1/2] blkdebug: Add bdrv_truncate()
  2015-04-15  9:27 [Qemu-devel] [PATCH 0/2] Fix VHDX qemu-iotests 033 failure Kevin Wolf
@ 2015-04-15  9:27 ` Kevin Wolf
  2015-04-15 11:35   ` Jeff Cody
  2015-04-15  9:27 ` [Qemu-devel] [PATCH 2/2] vhdx: Fix zero-fill iov length Kevin Wolf
  1 sibling, 1 reply; 5+ messages in thread
From: Kevin Wolf @ 2015-04-15  9:27 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, jcody, qemu-devel

This is, amongst others, required for qemu-iotests 033 to run as
intended on VHDX, which uses explicit bdrv_truncate() calls to bs->file
when allocating new blocks.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/blkdebug.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/block/blkdebug.c b/block/blkdebug.c
index 63611e0..3c30edb 100644
--- a/block/blkdebug.c
+++ b/block/blkdebug.c
@@ -721,6 +721,11 @@ static int64_t blkdebug_getlength(BlockDriverState *bs)
     return bdrv_getlength(bs->file);
 }
 
+static int blkdebug_truncate(BlockDriverState *bs, int64_t offset)
+{
+    return bdrv_truncate(bs->file, offset);
+}
+
 static void blkdebug_refresh_filename(BlockDriverState *bs)
 {
     QDict *opts;
@@ -779,6 +784,7 @@ static BlockDriver bdrv_blkdebug = {
     .bdrv_file_open         = blkdebug_open,
     .bdrv_close             = blkdebug_close,
     .bdrv_getlength         = blkdebug_getlength,
+    .bdrv_truncate          = blkdebug_truncate,
     .bdrv_refresh_filename  = blkdebug_refresh_filename,
 
     .bdrv_aio_readv         = blkdebug_aio_readv,
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Qemu-devel] [PATCH 2/2] vhdx: Fix zero-fill iov length
  2015-04-15  9:27 [Qemu-devel] [PATCH 0/2] Fix VHDX qemu-iotests 033 failure Kevin Wolf
  2015-04-15  9:27 ` [Qemu-devel] [PATCH 1/2] blkdebug: Add bdrv_truncate() Kevin Wolf
@ 2015-04-15  9:27 ` Kevin Wolf
  2015-04-15 11:32   ` Jeff Cody
  1 sibling, 1 reply; 5+ messages in thread
From: Kevin Wolf @ 2015-04-15  9:27 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, jcody, qemu-devel

Fix the length of the zero-fill for the back, which was accidentally
using the same value as for the front. This is caught by qemu-iotests
033.

For consistency, change the code for the front as well to use the length
stored in the iov (it is the same value, copied four lines above).

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/vhdx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/block/vhdx.c b/block/vhdx.c
index bb3ed45..e24062f 100644
--- a/block/vhdx.c
+++ b/block/vhdx.c
@@ -1269,7 +1269,7 @@ static coroutine_fn int vhdx_co_writev(BlockDriverState *bs, int64_t sector_num,
                         iov1.iov_base = qemu_blockalign(bs, iov1.iov_len);
                         memset(iov1.iov_base, 0, iov1.iov_len);
                         qemu_iovec_concat_iov(&hd_qiov, &iov1, 1, 0,
-                                              sinfo.block_offset);
+                                              iov1.iov_len);
                         sectors_to_write += iov1.iov_len >> BDRV_SECTOR_BITS;
                     }
 
@@ -1285,7 +1285,7 @@ static coroutine_fn int vhdx_co_writev(BlockDriverState *bs, int64_t sector_num,
                         iov2.iov_base = qemu_blockalign(bs, iov2.iov_len);
                         memset(iov2.iov_base, 0, iov2.iov_len);
                         qemu_iovec_concat_iov(&hd_qiov, &iov2, 1, 0,
-                                              sinfo.block_offset);
+                                              iov2.iov_len);
                         sectors_to_write += iov2.iov_len >> BDRV_SECTOR_BITS;
                     }
                 }
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH 2/2] vhdx: Fix zero-fill iov length
  2015-04-15  9:27 ` [Qemu-devel] [PATCH 2/2] vhdx: Fix zero-fill iov length Kevin Wolf
@ 2015-04-15 11:32   ` Jeff Cody
  0 siblings, 0 replies; 5+ messages in thread
From: Jeff Cody @ 2015-04-15 11:32 UTC (permalink / raw)
  To: Kevin Wolf; +Cc: qemu-devel, qemu-block

On Wed, Apr 15, 2015 at 11:27:26AM +0200, Kevin Wolf wrote:
> Fix the length of the zero-fill for the back, which was accidentally
> using the same value as for the front. This is caught by qemu-iotests
> 033.
> 
> For consistency, change the code for the front as well to use the length
> stored in the iov (it is the same value, copied four lines above).
> 
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
>  block/vhdx.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/block/vhdx.c b/block/vhdx.c
> index bb3ed45..e24062f 100644
> --- a/block/vhdx.c
> +++ b/block/vhdx.c
> @@ -1269,7 +1269,7 @@ static coroutine_fn int vhdx_co_writev(BlockDriverState *bs, int64_t sector_num,
>                          iov1.iov_base = qemu_blockalign(bs, iov1.iov_len);
>                          memset(iov1.iov_base, 0, iov1.iov_len);
>                          qemu_iovec_concat_iov(&hd_qiov, &iov1, 1, 0,
> -                                              sinfo.block_offset);
> +                                              iov1.iov_len);

Better form here, although should be identical

>                          sectors_to_write += iov1.iov_len >> BDRV_SECTOR_BITS;
>                      }
>  
> @@ -1285,7 +1285,7 @@ static coroutine_fn int vhdx_co_writev(BlockDriverState *bs, int64_t sector_num,
>                          iov2.iov_base = qemu_blockalign(bs, iov2.iov_len);
>                          memset(iov2.iov_base, 0, iov2.iov_len);
>                          qemu_iovec_concat_iov(&hd_qiov, &iov2, 1, 0,
> -                                              sinfo.block_offset);
> +                                              iov2.iov_len);

Definite bug fix here

>                          sectors_to_write += iov2.iov_len >> BDRV_SECTOR_BITS;
>                      }
>                  }
> -- 
> 1.8.3.1
>

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH 1/2] blkdebug: Add bdrv_truncate()
  2015-04-15  9:27 ` [Qemu-devel] [PATCH 1/2] blkdebug: Add bdrv_truncate() Kevin Wolf
@ 2015-04-15 11:35   ` Jeff Cody
  0 siblings, 0 replies; 5+ messages in thread
From: Jeff Cody @ 2015-04-15 11:35 UTC (permalink / raw)
  To: Kevin Wolf; +Cc: qemu-devel, qemu-block

On Wed, Apr 15, 2015 at 11:27:25AM +0200, Kevin Wolf wrote:
> This is, amongst others, required for qemu-iotests 033 to run as
> intended on VHDX, which uses explicit bdrv_truncate() calls to bs->file
> when allocating new blocks.
> 
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
>  block/blkdebug.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/block/blkdebug.c b/block/blkdebug.c
> index 63611e0..3c30edb 100644
> --- a/block/blkdebug.c
> +++ b/block/blkdebug.c
> @@ -721,6 +721,11 @@ static int64_t blkdebug_getlength(BlockDriverState *bs)
>      return bdrv_getlength(bs->file);
>  }
>  
> +static int blkdebug_truncate(BlockDriverState *bs, int64_t offset)
> +{
> +    return bdrv_truncate(bs->file, offset);
> +}
> +
>  static void blkdebug_refresh_filename(BlockDriverState *bs)
>  {
>      QDict *opts;
> @@ -779,6 +784,7 @@ static BlockDriver bdrv_blkdebug = {
>      .bdrv_file_open         = blkdebug_open,
>      .bdrv_close             = blkdebug_close,
>      .bdrv_getlength         = blkdebug_getlength,
> +    .bdrv_truncate          = blkdebug_truncate,
>      .bdrv_refresh_filename  = blkdebug_refresh_filename,
>  
>      .bdrv_aio_readv         = blkdebug_aio_readv,
> -- 
> 1.8.3.1
>

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-04-15 11:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-15  9:27 [Qemu-devel] [PATCH 0/2] Fix VHDX qemu-iotests 033 failure Kevin Wolf
2015-04-15  9:27 ` [Qemu-devel] [PATCH 1/2] blkdebug: Add bdrv_truncate() Kevin Wolf
2015-04-15 11:35   ` Jeff Cody
2015-04-15  9:27 ` [Qemu-devel] [PATCH 2/2] vhdx: Fix zero-fill iov length Kevin Wolf
2015-04-15 11:32   ` Jeff Cody

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).