qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v4 4/8] nbd: Minimal structured read for server


From: Vladimir Sementsov-Ogievskiy
Subject: Re: [Qemu-devel] [PATCH v4 4/8] nbd: Minimal structured read for server
Date: Mon, 16 Oct 2017 12:49:01 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0

15.10.2017 04:01, Eric Blake wrote:
From: Vladimir Sementsov-Ogievskiy <address@hidden>

Minimal implementation of structured read: one structured reply chunk,
no segmentation.
Minimal structured error implementation: no text message.
Support DF flag, but just ignore it, as there is no segmentation any
way.

Signed-off-by: Vladimir Sementsov-Ogievskiy <address@hidden>
Signed-off-by: Eric Blake <address@hidden>

---
v4: better _DF flag handling, convert errno to wire format, add
comments and tracing, rework structured error for less churn when adding
text message later, don't kill connection on redundant client option
---
  nbd/server.c     | 106 +++++++++++++++++++++++++++++++++++++++++++++++++------
  nbd/trace-events |   2 ++
  2 files changed, 98 insertions(+), 10 deletions(-)

diff --git a/nbd/server.c b/nbd/server.c
index efb6003364..23dc6be708 100644
--- a/nbd/server.c
+++ b/nbd/server.c
@@ -100,6 +100,8 @@ struct NBDClient {
      QTAILQ_ENTRY(NBDClient) next;
      int nb_requests;
      bool closing;
+
+    bool structured_reply;
  };

  /* That's all folks */
@@ -762,6 +764,23 @@ static int nbd_negotiate_options(NBDClient *client, 
uint16_t myflags,
                      return ret;
                  }
                  break;
+
+            case NBD_OPT_STRUCTURED_REPLY:
+                if (client->structured_reply) {
+                    ret = nbd_negotiate_send_rep_err(
+                        client->ioc, NBD_REP_ERR_INVALID, option, errp,
+                        "structured reply already negotiated");

You were going to send a patch to spec for this..

+                } else {
+                    ret = nbd_negotiate_send_rep(client->ioc, NBD_REP_ACK,
+                                                 option, errp);
+                }
+                if (ret < 0) {
+                    return ret;
+                }
+                client->structured_reply = true;
+                myflags |= NBD_CMD_FLAG_DF;

it should be NBD_FLAG_SEND_DF

[...]

the following looks ok.

--
Best regards,
Vladimir




reply via email to

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