From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46217) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1anC2Z-0000jt-6g for qemu-devel@nongnu.org; Mon, 04 Apr 2016 17:28:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1anC2U-0007OH-6c for qemu-devel@nongnu.org; Mon, 04 Apr 2016 17:28:07 -0400 Received: from mail-am1on0111.outbound.protection.outlook.com ([157.56.112.111]:51740 helo=emea01-am1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1anC2T-0007OC-Ix for qemu-devel@nongnu.org; Mon, 04 Apr 2016 17:28:02 -0400 References: <1459787950-15286-1-git-send-email-eblake@redhat.com> <7AD0DCB1-1868-4AAD-A03D-C976A728DD75@alex.org.uk> <5702C1AB.8020601@redhat.com> <5702C8C3.1050300@openvz.org> <5702CAEA.4060804@openvz.org> <5702CE48.40302@openvz.org> <5702D279.6080905@redhat.com> <5702D6E2.1090901@openvz.org> <5702D9FA.20207@redhat.com> From: "Denis V. Lunev" Message-ID: <5702DC59.9010809@openvz.org> Date: Tue, 5 Apr 2016 00:27:53 +0300 MIME-Version: 1.0 In-Reply-To: <5702D9FA.20207@redhat.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [Nbd] [PATCH v2] doc: Add NBD_CMD_BLOCK_STATUS extension List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake , Alex Bligh Cc: "nbd-general@lists.sourceforge.net" , Kevin Wolf , "qemu-devel@nongnu.org" , Pavel Borzenkov , "Stefan stefanha@redhat. com" , Wouter Verhelst , Paolo Bonzini On 04/05/2016 12:17 AM, Eric Blake wrote: > On 04/04/2016 03:04 PM, Denis V. Lunev wrote: >> In v1 we have had 'status' field, which can have the >> following values for dirty request: >> >> + - `NBD_STATE_DIRTY` (0x0), LBA extent is dirty; >> + - `NBD_STATE_CLEAN` (0x1), LBA extent is clean. >> >> in the extent structure: >> >> + * 64 bits, offset (unsigned) >> + * 32 bits, length (unsigned) >> + * 16 bits, status (unsigned) > Between v1 and v2, we dropped 64-bit offset (offset is now implied, by > adding lengths of all earlier descriptors), and widened status from 16 > bits to 32 bits (so that each descriptor is now naturally 8-byte aligned > and therefore easier to make a C array). > >> with an additional NBD_STATE_DIRTY_HOLE or (DIRTY_DEALLOCATED) >> we could report the entire state using one query. The user could be >> able to read entire state which is useful for backup at once. >> >> Your current proposal is more tricky and it was misunderstood by Alex: >> >> + * 32 bits, status flags >> >> and you describe flags as >> >> + - `NBD_STATE_HOLE` (bit 0); if set, the block represents a hole >> + - `NBD_STATE_ZERO` (bit 1), if set, the block contents read as >> + - `NBD_STATE_CLEAN` (bit 2); if set, the block represents a >> and opinion of Alex was that all 3 bits could be set in reply to >> NBD_CMD_BLOCK_STATUS >> with NBD_CMD_FLAG_STATUS_DIRTY set. >> >> This confused him. This confuses me too. > There's nothing that says that NBD_STATE_CLEAN can't be reassigned to > bit 0. Conversely, we may want to add a future NBD_CMD_FLAG_FOO that > lets you read allocation and dirty information in the same call, in > which case having the bits be distinct will make that easier; but where > we would also make it obvious that the server is allowed to reject that > command flag as unsupported (we already state the server can reject > NBD_CMD_FLAG_STATUS_DIRTY with EINVAL as unsupported; and that it if > does not reject a dirtiness request but cannot otherwise report > anything, then the entire region is reported as dirty). > > I don't have any strong opinions on whether NBD_STATE_CLEAN should > remain bit 2 or be renumbered to bit 0, although renumbering it to bit 0 > would make it painfully obvious that you cannot query allocation and > dirtiness at the same time. I think it is worth to do to avoid this type of the confusion. >> If allocated state is not replied to command with NBD_CMD_FLAG_STATUS_DIRTY >> then why to have different meaning of bits. > Because we still have room - no need to overlap the meaning of bits as > long as we have more bits to choose from. > ok