From: hxkhust Subject: !!!!!help!I wouldn't be able to meet the deadline!(about read operation in qemu-img-xen) Date: Wed, 19 Dec 2012 16:24:23 +0800 (CST) Message-ID: <5b77509e.1174a.13bb2437601.Coremail.hxkhust@126.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============3799715335036896564==" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel List-Id: xen-devel@lists.xenproject.org --===============3799715335036896564== Content-Type: multipart/alternative; boundary="----=_Part_270381_109645334.1355905463809" ------=_Part_270381_109645334.1355905463809 Content-Type: text/plain; charset=GBK Content-Transfer-Encoding: 7bit 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 ------=_Part_270381_109645334.1355905463809 Content-Type: text/html; charset=GBK Content-Transfer-Encoding: 7bit
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,                           //*************
    &nb sp;           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 & QC OW_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




------=_Part_270381_109645334.1355905463809-- --===============3799715335036896564== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --===============3799715335036896564==--