From: Kevin Wolf <kwolf@redhat.com>
To: Peter Crosthwaite <peter.crosthwaite@petalogix.com>
Cc: qemu-devel@nongnu.org, MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Subject: Re: [Qemu-devel] [PATCH 3/6] sheepdog: use coroutine based socket functions in coroutine context
Date: Wed, 04 Jul 2012 10:37:07 +0200 [thread overview]
Message-ID: <4FF400B3.6050003@redhat.com> (raw)
In-Reply-To: <CAEgOgz6_i_NBVEBf-jSvBFf7Z-anydugMDRo37y6LtsJ8H_tsA@mail.gmail.com>
Am 04.07.2012 02:25, schrieb Peter Crosthwaite:
> On Tue, Jul 3, 2012 at 11:15 PM, Kevin Wolf <kwolf@redhat.com> wrote:
>> 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.
>>
>
> +1. I presume it can it be done such that there is no if
> (qemu_in_coroutine()) logic that way?
That was not my intention, and actually I don't think it would help your
case here because this is a function truly internal to the block layer
(or actually even a single block driver).
Kevin
next prev parent reply other threads:[~2012-07-04 8:37 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 ` [Qemu-devel] [PATCH 3/6] sheepdog: use coroutine based socket functions in coroutine context Kevin Wolf
2012-07-04 0:25 ` Peter Crosthwaite
2012-07-04 8:37 ` Kevin Wolf [this message]
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=4FF400B3.6050003@redhat.com \
--to=kwolf@redhat.com \
--cc=morita.kazutaka@lab.ntt.co.jp \
--cc=peter.crosthwaite@petalogix.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.