Il 10/01/2014 19:07, Peter Lieven ha scritto:
> 
> 
> 
> Von meinem iPad gesendet
> 
> Am 10.01.2014 um 19:05 schrieb "Paolo Bonzini" <pbonz...@redhat.com>:
> 
>> Il 10/01/2014 18:16, ronnie sahlberg ha scritto:
>>>
>>> There is a common exception though, for the case where you read past
>>> the end of file.
>>> So short reads should normally not happen. Unless QEMU or the guest
>>> sends a request to libnfs to read past the end of the file.
>>
>> Yes, this can happen in QEMU and the various drivers are careful to pad
>> with zeroes.  It could perhaps be moved to block.c, but for now each
>> driver handles it separately.
> 
> ok i will add this as well. however, i thought i had seen code for this in 
> block.c  already?,

No, it corresponds to this code in block/raw-posix.c:

static int aio_worker(void *arg)
{
    RawPosixAIOData *aiocb = arg;
    ssize_t ret = 0;

    switch (aiocb->aio_type & QEMU_AIO_TYPE_MASK) {
    case QEMU_AIO_READ:
        ret = handle_aiocb_rw(aiocb);
        if (ret >= 0 && ret < aiocb->aio_nbytes && aiocb->bs->growable) {
            iov_memset(aiocb->aio_iov, aiocb->aio_niov, ret,
                      0, aiocb->aio_nbytes - ret);

            ret = aiocb->aio_nbytes;
        }
        if (ret == aiocb->aio_nbytes) {
            ret = 0;
        } else if (ret >= 0 && ret < aiocb->aio_nbytes) {
            ret = -EINVAL;
        }
        break;

Paolo

Reply via email to