From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42150) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bofWt-000816-5c for qemu-devel@nongnu.org; Mon, 26 Sep 2016 19:41:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bofWn-0005b5-O6 for qemu-devel@nongnu.org; Mon, 26 Sep 2016 19:41:46 -0400 Date: Tue, 27 Sep 2016 01:41:32 +0200 From: Wouter Verhelst Message-ID: <20160926234132.xllehw4ib434ness@grep.be> References: <1474893981-5302-1-git-send-email-vsementsov@virtuozzo.com> <7193be9e-4155-c5dc-282e-55ab1cf5f231@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7193be9e-4155-c5dc-282e-55ab1cf5f231@redhat.com> Subject: Re: [Qemu-devel] [Nbd] [PATCH] proto: add 'shift' extension. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: Vladimir Sementsov-Ogievskiy , qemu-devel@nongnu.org, qemu-block@nongnu.org, nbd-general@lists.sourceforge.net, kwolf@redhat.com, den@virtuozzo.com, stefanha@redhat.com, pbonzini@redhat.com On Mon, Sep 26, 2016 at 03:21:46PM -0500, Eric Blake wrote: > I'd much rather support a single flag that says to zero the entire disk > than to introduce stateful variable-amount shifting. That's almost exactly the opposite of what I said :) Now, I don't feel very strong either way, but what matters to me is: - NBD is a simple, easy to understand protocol; that is a feature, and so it should remain that way. - Every time we add another option, flag, or command, we make the protocol slightly more complex, which is counter to that goal. - Adding a command with a single use case (i.e., a "wipe the whole device" command) seems like it would not see much use, except perhaps in the use case that Virtuozzo is thinking about. In other words, it makes things slightly more complex for little benefit. I thought a negotiated shift size could be creatively used for other things beyond just "wipe the whole disk" commands, and that it might be elegant in that way. On the other hand, I recognize that adding state in that manner also complicates the protocol in that an observer which sees only part of the traffic may not understand what's going on anymore. So let's just say that an NBD_CMD_FLAG_SHIFT would: - Left-shift the size by 16 bits; no more, no less - 2^32-1 is too large a granularity for this to be useful beyond "wipe whole disk" commands; 2^16-1 (65535) seems like a more useful granularity. - This allows for a maximum number of 2^48-1 bytes (one byte shy of 256 tebibytes) to be affected by a single command, which seems sufficient for the given purpose. - If someone really wants to wipe 2^64-1 bytes (i.e., 16 exbibytes), they are probably using the wrong tools. - Be only valid for commands that don't send or expect data to be sent out over the wire. - currently TRIM and WRITE_ZEROES, but not READ or WRITE. Thoughts? -- < ron> I mean, the main *practical* problem with C++, is there's like a dozen people in the world who think they really understand all of its rules, and pretty much all of them are just lying to themselves too. -- #debian-devel, OFTC, 2016-02-12