From: "Guangmu Zhu" <guangmuzhu@gmail.com>
To: "Kevin Wolf" <kwolf@redhat.com>
Cc: qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] No error report when using the qemu-img.exetoconvert a disk to vmdk format which is saved on a disk that has nomorespace
Date: Thu, 24 Sep 2015 09:34:48 +0800 [thread overview]
Message-ID: <tencent_3CBAF4FC2AD0F7701399A6FD@qq.com> (raw)
In-Reply-To: <20150923120425.GB4557@noname.redhat.com>
[-- Attachment #1: Type: text/plain, Size: 2621 bytes --]
I'll try the patch and report in a week for I'm too busy these days. And if I could, I would like to help to maintain the Windows backend.
Sincerely.
Guangmu Zhu
-------------------------------------------------
Am 23.09.2015 um 13:30 hat Guangmu Zhu geschrieben:
> If the "BlockDriver" is "bdrv_vmdk", the function "vmdk_co_write" will be
> called instead. In function "vmdk_write_extent" I see "ret = bdrv_pwrite
> (extent->file, write_offset, write_buf, write_len);". So the "extend->file" is
> "bdrv_file", is it?
Yes, exactly. You'll go through bdrv_vmdk first, and then the nested
call goes to bdrv_file.
> -------------------------------------------------
>
> Correct a mistake:
> So though the "count" would be "-EINVAL" if error occurred while writing some
> file, the return value will always be zero. Maybe I missed something?
I think you're right. Instead of setting count = 0/-EINVAL in
aio_worker, we should be setting ret.
Can you try the patch below and report back?
> 3. The "bs->drv->bdrv_aio_writev" is function "raw_aio_writev" in file
> "raw-win32.c" and the quemu-img uses synchronous IO always, so the function
> "paio_submit" in the same file will be called. This function submits the "aio"
> to "worker_thread" with the callback "aio_worker". There are some codes in
> "aio_worker":
>
> ssize_t ret = 0;
> ......
> case QEMU_AIO_WRITE:
> count = handle_aiocb_rw(aiocb);
> if (count == aiocb->aio_nbytes) {
> count = 0;
> } else {
> count = -EINVAL;
> }
> break;
> ......
> return ret;
Independently of your problem, the code in aio_worker() looks a bit
fishy, because handle_aiocb_rw() can't distinguish between an error
and 0 bytes transferred.
For writes, that probably doesn't matter, but for reads, I think we
return a successful read of zeroes instead of signalling an error. This
might need another patch.
Generally, the Windows backend is not getting a lot of attention and
could use someone who checks it, cleans it up and fixes bugs.
Kevin
diff --git a/block/raw-win32.c b/block/raw-win32.c
index 68f2338..b562c94 100644
--- a/block/raw-win32.c
+++ b/block/raw-win32.c
@@ -119,9 +119,9 @@ static int aio_worker(void *arg)
case QEMU_AIO_WRITE:
count = handle_aiocb_rw(aiocb);
if (count == aiocb->aio_nbytes) {
- count = 0;
+ ret = 0;
} else {
- count = -EINVAL;
+ ret = -EINVAL;
}
break;
case QEMU_AIO_FLUSH:
[-- Attachment #2: Type: text/html, Size: 3891 bytes --]
next prev parent reply other threads:[~2015-09-24 1:35 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-22 6:09 [Qemu-devel] No error report when using the qemu-img.exe to convert a disk to vmdk format which is saved on a disk that has no more space Guangmu Zhu
2015-09-22 15:07 ` Kevin Wolf
2015-09-23 11:02 ` [Qemu-devel] No error report when using the qemu-img.exe toconvert a disk to vmdk format which is saved on a disk that has no morespace Guangmu Zhu
2015-09-23 11:11 ` Guangmu Zhu
2015-09-23 11:30 ` Guangmu Zhu
2015-09-23 12:04 ` Kevin Wolf
2015-09-24 1:34 ` Guangmu Zhu [this message]
2015-09-24 8:01 ` [Qemu-devel] No error report when using the qemu-img.exetoconvert a disk to vmdk format which is saved on a disk that has nomorespace Guangmu Zhu
2015-09-24 9:14 ` Kevin Wolf
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=tencent_3CBAF4FC2AD0F7701399A6FD@qq.com \
--to=guangmuzhu@gmail.com \
--cc=kwolf@redhat.com \
--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).