On 09/18/2017 08:59 AM, Vladimir Sementsov-Ogievskiy wrote: > Drop 'reply' from NBDClientSession. It's used to only deliver request > return code to receiving coroutine. Instead introduce per-request ret > variable to simplify the scheme and make further refactoring possible. > > Signed-off-by: Vladimir Sementsov-Ogievskiy <[email protected]> > --- > block/nbd-client.h | 2 +- > block/nbd-client.c | 22 +++++++++------------- > 2 files changed, 10 insertions(+), 14 deletions(-) > > diff --git a/block/nbd-client.h b/block/nbd-client.h > index 3f97d31013..4bc8fe3993 100644 > --- a/block/nbd-client.h > +++ b/block/nbd-client.h > @@ -22,6 +22,7 @@ typedef struct { > bool receiving; /* waiting for read_reply_co? */ > NBDRequest *request; > QEMUIOVector *qiov; > + int ret; > } NBDClientRequest;
I like this idea. However, I note that:
> @@ -211,11 +211,7 @@ static int nbd_co_receive_reply(NBDClientSession *s,
> NBDRequest *request)
> if (!s->ioc || s->quit) {
> ret = -EIO;
> } else {
> - assert(s->reply.handle == request->handle);
> - ret = -s->reply.error;
> -
> - /* Tell the read handler to read another header. */
> - s->reply.handle = 0;
> + ret = s->requests[i].ret;
you are removing the assert you added in 2/7, where I questioned whether
we needed NBDClientRequest.request in the first place. So there may be
some rebase churn, depending on how that conversation pans out.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature
