On 09/17/2011 08:29 AM, MORITA Kazutaka wrote:
>  +#else
>  +        struct iovec *p = iov;
>  +        ret = 0;
>  +        while (iovlen>  0) {
>  +            int rc;
>  +            if (do_sendv) {
>  +                rc = send(sockfd, p->iov_base, p->iov_len, 0);
>  +            } else {
>  +                rc = qemu_recv(sockfd, p->iov_base, p->iov_len, 0);
>  +            }
>  +            if (rc == -1) {
>  +                if (errno == EINTR) {
>  +                    continue;
>  +                }
>  +                if (ret == 0) {
>  +                    ret = -1;
>  +                }
>  +                break;
>  +            }
>  +            iovlen--, p++;
>  +            ret += rc;
>  +        }
This code can be called inside coroutines with a non-blocking fd, so
should we avoid busy waiting?

It doesn't busy wait, it exits with EAGAIN. I'll squash in here the first hunk of patch 4, which is needed.

qemu_co_recvv already handles reads that return zero, unlike sheepdog's do_readv_writev. I probably moved it there inadvertently while moving code around to cutils.c, but in order to fix qemu-ga I need to create a new file qemu-coroutine-io.c.

Kevin, do you want me to resubmit everything, or are you going to apply some more patches to the block branch (5 to 12 should be fine)?

Paolo

Reply via email to