[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 6/7] block/nbd-client: early fail nbd_read_re
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH v2 6/7] block/nbd-client: early fail nbd_read_reply_entry if s->quit is set |
Date: |
Tue, 19 Sep 2017 12:03:48 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 |
On 19/09/2017 11:43, Vladimir Sementsov-Ogievskiy wrote:
>>
>> I'm trying to look forward to structured reads, where we will have to
>> deal with more than one server message in reply to a single client
>> request. For read, we just piece together portions of the qiov until
>> the server has sent us all the pieces. But for block query, I really do
>> think we'll want to defer to specialized handlers for doing further
>> reads (the amount of data to be read from the server is not known by the
>> client a priori, so it is a two-part read, one to get the length, and
>> another to read that remaining length); if we need some sort of callback
>> function rather than cramming all the logic here in the main read loop,
>
> by patch 3 I do not mean in any way that I want to have all reading
> staff in one function, ofcourse it should be refactored
> for block-status addition. I just want to have all reading staff in one
> coroutine. Reading from ioc is sequential, so it's
> native to do it sequentially in one coroutine, without switches.
But why is that a goal? See it as a state machine that goes between the
"waiting for header" and "waiting for payload" states. Reading header
corresponds to read_reply_co waiting on the socket (and reading when
it's ready); reading payload corresponds to the request coroutine
waiting on the socket and reading when it's ready.
Paolo
- [Qemu-devel] [PATCH v2 3/7] block/nbd-client: refactor reading reply, (continued)
- [Qemu-devel] [PATCH v2 3/7] block/nbd-client: refactor reading reply, Vladimir Sementsov-Ogievskiy, 2017/09/18
- Re: [Qemu-devel] [PATCH v2 3/7] block/nbd-client: refactor reading reply, Paolo Bonzini, 2017/09/18
- Re: [Qemu-devel] [PATCH v2 3/7] block/nbd-client: refactor reading reply, Eric Blake, 2017/09/18
- Re: [Qemu-devel] [PATCH v2 3/7] block/nbd-client: refactor reading reply, Vladimir Sementsov-Ogievskiy, 2017/09/19
- Re: [Qemu-devel] [PATCH v2 3/7] block/nbd-client: refactor reading reply, Paolo Bonzini, 2017/09/19
- Re: [Qemu-devel] [PATCH v2 3/7] block/nbd-client: refactor reading reply, Vladimir Sementsov-Ogievskiy, 2017/09/19
- Re: [Qemu-devel] [PATCH v2 3/7] block/nbd-client: refactor reading reply, Paolo Bonzini, 2017/09/19
[Qemu-devel] [PATCH v2 6/7] block/nbd-client: early fail nbd_read_reply_entry if s->quit is set, Vladimir Sementsov-Ogievskiy, 2017/09/18
[Qemu-devel] [PATCH v2 5/7] block/nbd-client: nbd_co_send_request: return -EIO if s->quit was set in parallel, Vladimir Sementsov-Ogievskiy, 2017/09/18
[Qemu-devel] [PATCH v2 4/7] block/nbd-client: drop reply field from NBDClientSession, Vladimir Sementsov-Ogievskiy, 2017/09/18
[Qemu-devel] [PATCH v2 2/7] block/nbd-client: exit reply-reading coroutine on incorrect handle, Vladimir Sementsov-Ogievskiy, 2017/09/18