qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 3/6] sheepdog: use coroutine based socket functions in coroutine context
Date: Tue, 03 Jul 2012 15:15:03 +0200	[thread overview]
Message-ID: <4FF2F057.7030802@redhat.com> (raw)
In-Reply-To: <1340749583-5292-4-git-send-email-morita.kazutaka@lab.ntt.co.jp>

Am 27.06.2012 00:26, schrieb MORITA Kazutaka:
> This removes blocking network I/Os in coroutine context.
> 
> Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
> ---
>  block/sheepdog.c |   10 ++++++++--
>  1 files changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/block/sheepdog.c b/block/sheepdog.c
> index 0b49c6d..5dc1d7a 100644
> --- a/block/sheepdog.c
> +++ b/block/sheepdog.c
> @@ -541,11 +541,18 @@ static coroutine_fn int send_co_req(int sockfd, SheepdogReq *hdr, void *data,
>      return ret;
>  }
>  
> +static coroutine_fn int do_co_req(int sockfd, SheepdogReq *hdr, void *data,
> +                                  unsigned int *wlen, unsigned int *rlen);
> +
>  static int do_req(int sockfd, SheepdogReq *hdr, void *data,
>                    unsigned int *wlen, unsigned int *rlen)
>  {
>      int ret;
>  
> +    if (qemu_in_coroutine()) {
> +        return do_co_req(sockfd, hdr, data, wlen, rlen);
> +    }
> +
>      socket_set_block(sockfd);
>      ret = send_req(sockfd, hdr, data, wlen);
>      if (ret < 0) {

How about replacing the non-coroutine implementation by code that
creates a new coroutine and executes do_co_req() as well? This would
reduce some code duplication.

Kevin

  parent reply	other threads:[~2012-07-03 13:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1340749583-5292-1-git-send-email-morita.kazutaka@lab.ntt.co.jp>
     [not found] ` <1340749583-5292-3-git-send-email-morita.kazutaka@lab.ntt.co.jp>
2012-07-03 13:09   ` [Qemu-devel] [PATCH 2/6] sheepdog: restart I/O when socket becomes ready in do_co_req() Kevin Wolf
2012-07-03 13:44     ` Paolo Bonzini
     [not found] ` <1340749583-5292-4-git-send-email-morita.kazutaka@lab.ntt.co.jp>
2012-07-03 13:15   ` Kevin Wolf [this message]
2012-07-04  0:25     ` [Qemu-devel] [PATCH 3/6] sheepdog: use coroutine based socket functions in coroutine context Peter Crosthwaite
2012-07-04  8:37       ` Kevin Wolf
2012-07-04 15:27     ` MORITA Kazutaka
2012-07-03 13:26 ` [Qemu-devel] [PATCH 0/6] sheepdog: various fixes Kevin Wolf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4FF2F057.7030802@redhat.com \
    --to=kwolf@redhat.com \
    --cc=morita.kazutaka@lab.ntt.co.jp \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).