* !!!!!help!I wouldn't be able to meet the deadline!(about read operation in qemu-img-xen)
@ 2012-12-19 8:24 hxkhust
2012-12-19 10:28 ` Mats Petersson
0 siblings, 1 reply; 3+ messages in thread
From: hxkhust @ 2012-12-19 8:24 UTC (permalink / raw)
To: xen-devel
[-- Attachment #1.1: Type: text/plain, Size: 1831 bytes --]
Hi,guys,
what I concern is the following (which is in the /xen-4.1.2/tools/ioemu-qemu-xen/block-qcow.c) :
static void qcow_aio_read_cb(void *opaque, int ret)
{
........
if (!acb->cluster_offset) {
if (bs->backing_hd) {
/* read from the base image */
acb->hd_aiocb = bdrv_aio_read(bs->backing_hd, //*************
acb->sector_num, acb->buf, acb->n, qcow_aio_read_cb, acb); //**************
//I read what the acb->buf points to, but find the reading operation is not finished.
if (acb->hd_aiocb == NULL)
goto fail;
} else {
/* Note: in this case, no need to wait */
memset(acb->buf, 0, 512 * acb->n);
goto redo;
}
} else if (acb->cluster_offset & QCOW_OFLAG_COMPRESSED) {
/* add AIO support for compressed blocks ? */
if (decompress_cluster(s, acb->cluster_offset) < 0)
goto fail;
memcpy(acb->buf,
s->cluster_cache + index_in_cluster * 512, 512 * acb->n);
goto redo;
.........
//********************************************************************************************8
when the statement:
acb->hd_aiocb = bdrv_aio_read(bs->backing_hd,
acb->sector_num, acb->buf, acb->n, qcow_aio_read_cb, acb);n
has been completed, the content which the acb->buf points to has not been prepared.This is a asynchronous read operation.Who could tell me the principle or process about this asynchronous read operation about these codes? if you describe it using the codes in xen,that will be so kind of you.I need to know when the data has been copied to the memory which the acb->buf points to, and this problem is important to me.as the title mentioned ,I have to solve it as soon as possible.
A newbie
[-- Attachment #1.2: Type: text/html, Size: 3323 bytes --]
[-- Attachment #2: Type: text/plain, Size: 126 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: !!!!!help!I wouldn't be able to meet the deadline!(about read operation in qemu-img-xen)
2012-12-19 8:24 !!!!!help!I wouldn't be able to meet the deadline!(about read operation in qemu-img-xen) hxkhust
@ 2012-12-19 10:28 ` Mats Petersson
0 siblings, 0 replies; 3+ messages in thread
From: Mats Petersson @ 2012-12-19 10:28 UTC (permalink / raw)
To: xen-devel
On 19/12/12 08:24, hxkhust wrote:
> Hi,guys,
>
> what I concern is the following (which is in the
> /xen-4.1.2/tools/ioemu-qemu-xen/block-qcow.c) :
> static void qcow_aio_read_cb(void *opaque, int ret)
> {
> ........
> if (!acb->cluster_offset) {
> if (bs->backing_hd) {
> /* read from the base image */
> acb->hd_aiocb = bdrv_aio_read(bs->backing_hd, //*************
> acb->sector_num, acb->buf, acb->n, qcow_aio_read_cb, acb);
> //**************
> //I read what the acb->buf points to, but find the reading operation
> is not finished.
> if (acb->hd_aiocb == NULL)
> goto fail;
> } else {
> /* Note: in this case, no need to wait */
> memset(acb->buf, 0, 512 * acb->n);
> goto redo;
> }
> } else if (acb->cluster_offset & QCOW_OFLAG_COMPRESSED) {
> /* add AIO support for compressed blocks ? */
> if (decompress_cluster(s, acb->cluster_offset) < 0)
> goto fail;
> memcpy(acb->buf,
> s->cluster_cache + index_in_cluster * 512, 512 * acb->n);
> goto redo;
> .........
> //********************************************************************************************8
> when the statement:
> acb->hd_aiocb = bdrv_aio_read(bs->backing_hd,
> acb->sector_num, acb->buf, acb->n, qcow_aio_read_cb, acb);n
> has been completed, the content which the acb->buf points to has not
> been prepared.This is a asynchronous read operation.Who could tell me
> the principle or process about this asynchronous read operation about
> these codes? if you describe it using the codes in xen,that will be so
> kind of you.I need to know when the data has been copied to the memory
> which the acb->buf points to, and this problem is important to me.as
> the title mentioned ,I have to solve it as soon as possible.
>
> A newbie
For reference:
http://www.catb.org/esr/faqs/smart-questions.html#urgent
http://www.catb.org/esr/faqs/smart-questions.html#goal
It would probably help if you described what you are trying to solve.
(Please take some time to read the WHOLE of the above page, as you may
actually learn something useful, that will help you for the rest of your
life...)
I'm sure you are correct in that the buffer isn't (guaranteed to be)
filled in when the read function returns (it is also not guaranteed that
it's NOT filled in - if the read preceeding this call asked for the
section of disk immediately preceeding where this request is for, you
may well end up with the data already available, and thus the buffer is
filled in immediately).
If you read about asynchronous IO, for example here:
http://www.kernel.org/doc/man-pages/online/pages/man7/aio.7.html
there are functions, such as aio_suspend, which are called to "wait for
IO to complete".
I'm not familiar with this particular piece of code, so I don't know
where the aio_suspend (or whatever similar function it uses) gets
called, but I'm pretty sure that's how it works.
--
Mats
^ permalink raw reply [flat|nested] 3+ messages in thread
* !!!!!help!I wouldn't be able to meet the deadline!(about read operation in qemu-img-xen)
@ 2012-12-19 8:22 hxkhust
0 siblings, 0 replies; 3+ messages in thread
From: hxkhust @ 2012-12-19 8:22 UTC (permalink / raw)
To: xen-devel
[-- Attachment #1.1: Type: text/plain, Size: 1828 bytes --]
Hi,gays,
what I concern is the following (which is in the /xen-4.1.2/tools/ioemu-qemu-xen/block-qcow.c) :
static void qcow_aio_read_cb(void *opaque, int ret)
{
........
if (!acb->cluster_offset) {
if (bs->backing_hd) {
/* read from the base image */
acb->hd_aiocb = bdrv_aio_read(bs->backing_hd, //*************
acb->sector_num, acb->buf, acb->n, qcow_aio_read_cb, acb); //**************
//I read what the acb->buf points to, but find the reading operation is not finished.
if (acb->hd_aiocb == NULL)
goto fail;
} else {
/* Note: in this case, no need to wait */
memset(acb->buf, 0, 512 * acb->n);
goto redo;
}
} else if (acb->cluster_offset & QCOW_OFLAG_COMPRESSED) {
/* add AIO support for compressed blocks ? */
if (decompress_cluster(s, acb->cluster_offset) < 0)
goto fail;
memcpy(acb->buf,
s->cluster_cache + index_in_cluster * 512, 512 * acb->n);
goto redo;
.........
//********************************************************************************************8
when the statement:
acb->hd_aiocb = bdrv_aio_read(bs->backing_hd,
acb->sector_num, acb->buf, acb->n, qcow_aio_read_cb, acb);n
has been completed, the content which the acb->buf points to has not been prepared.This is a asynchronous read operation.Who could tell me the principle or process about this asynchronous read operation about these codes? if you describe it using the codes in xen,that will be so kind of you.I need to know when the data has been copied to the memory which the acb->buf points to, and this problem is important to me.as the title mentioned ,I have to solve it as soon as possible.
A newbie
[-- Attachment #1.2: Type: text/html, Size: 3158 bytes --]
[-- Attachment #2: Type: text/plain, Size: 126 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-12-19 10:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-19 8:24 !!!!!help!I wouldn't be able to meet the deadline!(about read operation in qemu-img-xen) hxkhust
2012-12-19 10:28 ` Mats Petersson
-- strict thread matches above, loose matches on Subject: below --
2012-12-19 8:22 hxkhust
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.