* [Qemu-devel] [PATCH] qemu-img: print error codes when convert fails
@ 2011-08-17 16:41 Stefan Hajnoczi
2011-08-17 18:40 ` Kevin Wolf
0 siblings, 1 reply; 3+ messages in thread
From: Stefan Hajnoczi @ 2011-08-17 16:41 UTC (permalink / raw)
To: qemu-devel; +Cc: Kevin Wolf, Stefan Hajnoczi
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
---
qemu-img.c | 13 ++++++++-----
1 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/qemu-img.c b/qemu-img.c
index b205e98..d9e6fc8 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -890,7 +890,8 @@ static int img_convert(int argc, char **argv)
ret = bdrv_read(bs[bs_i], bs_num, buf2, nlow);
if (ret < 0) {
- error_report("error while reading");
+ error_report("error while reading sector %" PRId64 ": %s",
+ bs_num, strerror(-ret));
goto out;
}
@@ -908,8 +909,8 @@ static int img_convert(int argc, char **argv)
ret = bdrv_write_compressed(out_bs, sector_num, buf,
cluster_sectors);
if (ret != 0) {
- error_report("error while compressing sector %" PRId64,
- sector_num);
+ error_report("error while compressing sector %" PRId64
+ ": %s", sector_num, strerror(-ret));
goto out;
}
}
@@ -972,7 +973,8 @@ static int img_convert(int argc, char **argv)
ret = bdrv_read(bs[bs_i], sector_num - bs_offset, buf, n);
if (ret < 0) {
- error_report("error while reading");
+ error_report("error while reading sector %" PRId64 ": %s",
+ sector_num - bs_offset, strerror(-ret));
goto out;
}
/* NOTE: at the same time we convert, we do not write zero
@@ -991,7 +993,8 @@ static int img_convert(int argc, char **argv)
is_allocated_sectors(buf1, n, &n1)) {
ret = bdrv_write(out_bs, sector_num, buf1, n1);
if (ret < 0) {
- error_report("error while writing");
+ error_report("error while writing sector %" PRId64
+ ": %s", sector_num, strerror(-ret));
goto out;
}
}
--
1.7.5.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] qemu-img: print error codes when convert fails
2011-08-17 16:41 [Qemu-devel] [PATCH] qemu-img: print error codes when convert fails Stefan Hajnoczi
@ 2011-08-17 18:40 ` Kevin Wolf
2011-08-18 14:22 ` Stefan Hajnoczi
0 siblings, 1 reply; 3+ messages in thread
From: Kevin Wolf @ 2011-08-17 18:40 UTC (permalink / raw)
To: Stefan Hajnoczi; +Cc: qemu-devel
Am 17.08.2011 18:41, schrieb Stefan Hajnoczi:
> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Thanks, applied to the block branch.
(But is it really helpful to include sector numbers in the error
message? Especially since we're not reading/writing single sectors)
Kevin
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] qemu-img: print error codes when convert fails
2011-08-17 18:40 ` Kevin Wolf
@ 2011-08-18 14:22 ` Stefan Hajnoczi
0 siblings, 0 replies; 3+ messages in thread
From: Stefan Hajnoczi @ 2011-08-18 14:22 UTC (permalink / raw)
To: Kevin Wolf; +Cc: qemu-devel
On Wed, Aug 17, 2011 at 08:40:57PM +0200, Kevin Wolf wrote:
> Am 17.08.2011 18:41, schrieb Stefan Hajnoczi:
> > Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
>
> Thanks, applied to the block branch.
>
> (But is it really helpful to include sector numbers in the error
> message? Especially since we're not reading/writing single sectors)
The intention is that it would show suspicious sectors numbers, e.g. ~2
GB or ~4 GB.
In the best case it saves a round-trip on a bug report. In the worst
case the sector number is a distraction :).
Stefan
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-08-18 14:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-17 16:41 [Qemu-devel] [PATCH] qemu-img: print error codes when convert fails Stefan Hajnoczi
2011-08-17 18:40 ` Kevin Wolf
2011-08-18 14:22 ` Stefan Hajnoczi
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).