qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2 03/15] sheepdog: move coroutine send/recv fun


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH v2 03/15] sheepdog: move coroutine send/recv function to generic code
Date: Sat, 17 Sep 2011 16:49:22 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:6.0.2) Gecko/20110906 Thunderbird/6.0.2

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

[Prev in Thread] Current Thread [Next in Thread]