qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH for-5.0? v3] qemu-img: Report convert errors by bytes, not sectors
@ 2020-04-02 13:57 Eric Blake
  2020-04-02 21:44 ` Philippe Mathieu-Daudé
  2020-04-03  9:56 ` Max Reitz
  0 siblings, 2 replies; 3+ messages in thread
From: Eric Blake @ 2020-04-02 13:57 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Vladimir Sementsov-Ogievskiy,
	open list:Block layer core, Max Reitz

Various qemu-img commands are inconsistent on whether they report
status/errors in terms of bytes or sector offsets.  The latter is
confusing (especially as more places move to 4k block sizes), so let's
switch everything to just use bytes everywhere.  One iotest is
impacted.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
---

v3: Fix affected iotest [patchew]

 qemu-img.c                 | 8 ++++----
 tests/qemu-iotests/244.out | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/qemu-img.c b/qemu-img.c
index b167376bd72e..821cbf610e5f 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -1924,8 +1924,8 @@ retry:
         if (status == BLK_DATA && !copy_range) {
             ret = convert_co_read(s, sector_num, n, buf);
             if (ret < 0) {
-                error_report("error while reading sector %" PRId64
-                             ": %s", sector_num, strerror(-ret));
+                error_report("error while reading at byte %lld: %s",
+                             sector_num * BDRV_SECTOR_SIZE, strerror(-ret));
                 s->ret = ret;
             }
         } else if (!s->min_sparse && status == BLK_ZERO) {
@@ -1953,8 +1953,8 @@ retry:
                 ret = convert_co_write(s, sector_num, n, buf, status);
             }
             if (ret < 0) {
-                error_report("error while writing sector %" PRId64
-                             ": %s", sector_num, strerror(-ret));
+                error_report("error while writing at byte %lld: %s",
+                             sector_num * BDRV_SECTOR_SIZE, strerror(-ret));
                 s->ret = ret;
             }
         }
diff --git a/tests/qemu-iotests/244.out b/tests/qemu-iotests/244.out
index e6f4dc79934b..56329deb4b9f 100644
--- a/tests/qemu-iotests/244.out
+++ b/tests/qemu-iotests/244.out
@@ -33,7 +33,7 @@ Convert to compressed target with data file:
 Formatting 'TEST_DIR/t.IMGFMT.src', fmt=IMGFMT size=67108864
 wrote 1048576/1048576 bytes at offset 0
 1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-qemu-img: error while writing sector 0: Operation not supported
+qemu-img: error while writing at byte 0: Operation not supported

 Convert uncompressed, then write compressed data manually:
 Images are identical.
-- 
2.26.0.rc2



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

* Re: [PATCH for-5.0? v3] qemu-img: Report convert errors by bytes, not sectors
  2020-04-02 13:57 [PATCH for-5.0? v3] qemu-img: Report convert errors by bytes, not sectors Eric Blake
@ 2020-04-02 21:44 ` Philippe Mathieu-Daudé
  2020-04-03  9:56 ` Max Reitz
  1 sibling, 0 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-04-02 21:44 UTC (permalink / raw)
  To: Eric Blake, qemu-devel
  Cc: Kevin Wolf, Vladimir Sementsov-Ogievskiy,
	open list:Block layer core, Max Reitz

On 4/2/20 3:57 PM, Eric Blake wrote:
> Various qemu-img commands are inconsistent on whether they report
> status/errors in terms of bytes or sector offsets.  The latter is
> confusing (especially as more places move to 4k block sizes), so let's
> switch everything to just use bytes everywhere.  One iotest is
> impacted.
> 
> Signed-off-by: Eric Blake <eblake@redhat.com>
> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> ---
> 
> v3: Fix affected iotest [patchew]
> 
>   qemu-img.c                 | 8 ++++----
>   tests/qemu-iotests/244.out | 2 +-
>   2 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/qemu-img.c b/qemu-img.c
> index b167376bd72e..821cbf610e5f 100644
> --- a/qemu-img.c
> +++ b/qemu-img.c
> @@ -1924,8 +1924,8 @@ retry:
>           if (status == BLK_DATA && !copy_range) {
>               ret = convert_co_read(s, sector_num, n, buf);
>               if (ret < 0) {
> -                error_report("error while reading sector %" PRId64
> -                             ": %s", sector_num, strerror(-ret));
> +                error_report("error while reading at byte %lld: %s",
> +                             sector_num * BDRV_SECTOR_SIZE, strerror(-ret));
>                   s->ret = ret;
>               }
>           } else if (!s->min_sparse && status == BLK_ZERO) {
> @@ -1953,8 +1953,8 @@ retry:
>                   ret = convert_co_write(s, sector_num, n, buf, status);
>               }
>               if (ret < 0) {
> -                error_report("error while writing sector %" PRId64
> -                             ": %s", sector_num, strerror(-ret));
> +                error_report("error while writing at byte %lld: %s",
> +                             sector_num * BDRV_SECTOR_SIZE, strerror(-ret));
>                   s->ret = ret;
>               }
>           }
> diff --git a/tests/qemu-iotests/244.out b/tests/qemu-iotests/244.out
> index e6f4dc79934b..56329deb4b9f 100644
> --- a/tests/qemu-iotests/244.out
> +++ b/tests/qemu-iotests/244.out
> @@ -33,7 +33,7 @@ Convert to compressed target with data file:
>   Formatting 'TEST_DIR/t.IMGFMT.src', fmt=IMGFMT size=67108864
>   wrote 1048576/1048576 bytes at offset 0
>   1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
> -qemu-img: error while writing sector 0: Operation not supported
> +qemu-img: error while writing at byte 0: Operation not supported
> 
>   Convert uncompressed, then write compressed data manually:
>   Images are identical.
> 

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>



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

* Re: [PATCH for-5.0? v3] qemu-img: Report convert errors by bytes, not sectors
  2020-04-02 13:57 [PATCH for-5.0? v3] qemu-img: Report convert errors by bytes, not sectors Eric Blake
  2020-04-02 21:44 ` Philippe Mathieu-Daudé
@ 2020-04-03  9:56 ` Max Reitz
  1 sibling, 0 replies; 3+ messages in thread
From: Max Reitz @ 2020-04-03  9:56 UTC (permalink / raw)
  To: Eric Blake, qemu-devel
  Cc: Kevin Wolf, Vladimir Sementsov-Ogievskiy, open list:Block layer core


[-- Attachment #1.1: Type: text/plain, Size: 750 bytes --]

On 02.04.20 15:57, Eric Blake wrote:
> Various qemu-img commands are inconsistent on whether they report
> status/errors in terms of bytes or sector offsets.  The latter is
> confusing (especially as more places move to 4k block sizes), so let's
> switch everything to just use bytes everywhere.  One iotest is
> impacted.
> 
> Signed-off-by: Eric Blake <eblake@redhat.com>
> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> ---
> 
> v3: Fix affected iotest [patchew]
> 
>  qemu-img.c                 | 8 ++++----
>  tests/qemu-iotests/244.out | 2 +-
>  2 files changed, 5 insertions(+), 5 deletions(-)

Thanks, applied to my block branch:

https://git.xanclic.moe/XanClic/qemu/commits/branch/block

Max


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

end of thread, other threads:[~2020-04-03  9:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-02 13:57 [PATCH for-5.0? v3] qemu-img: Report convert errors by bytes, not sectors Eric Blake
2020-04-02 21:44 ` Philippe Mathieu-Daudé
2020-04-03  9:56 ` Max Reitz

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