qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
	"open list:Block layer core" <qemu-block@nongnu.org>,
	Max Reitz <mreitz@redhat.com>
Subject: [PATCH for-5.0?] qemu-img: Report convert errors by bytes, not sectors
Date: Tue, 31 Mar 2020 17:24:42 -0500	[thread overview]
Message-ID: <20200331222442.273158-1-eblake@redhat.com> (raw)

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.

Signed-off-by: Eric Blake <eblake@redhat.com>
---

Noticed while investigating https://bugzilla.redhat.com/1819240

By the way, I found it odd that even without --salvage, qemu-img
convert will process up to 8 EIO failures (based on its default
coroutine depth of 8) before finally exiting, rather than quitting
immediately on the first EIO failure.

 qemu-img.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/qemu-img.c b/qemu-img.c
index b167376bd72e..77219e25b33b 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -1924,8 +1924,9 @@ 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 %" PRId64
+                             ": %s", sector_num * BDRV_SECTOR_SIZE,
+                             strerror(-ret));
                 s->ret = ret;
             }
         } else if (!s->min_sparse && status == BLK_ZERO) {
@@ -1953,8 +1954,9 @@ 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 %" PRId64
+                             ": %s", sector_num * BDRV_SECTOR_SIZE,
+                             strerror(-ret));
                 s->ret = ret;
             }
         }
-- 
2.26.0.rc2



             reply	other threads:[~2020-03-31 22:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-31 22:24 Eric Blake [this message]
2020-04-01  5:26 ` [PATCH for-5.0?] qemu-img: Report convert errors by bytes, not sectors Vladimir Sementsov-Ogievskiy
2020-04-01  8:33 ` no-reply
2020-04-01 14:09   ` Eric Blake
2020-04-01  8:37 ` no-reply

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=20200331222442.273158-1-eblake@redhat.com \
    --to=eblake@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --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).