From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50594) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bnph7-00041s-On for qemu-devel@nongnu.org; Sat, 24 Sep 2016 12:20:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bnph3-0000Ld-KK for qemu-devel@nongnu.org; Sat, 24 Sep 2016 12:20:52 -0400 References: <57E5752C.3080407@virtuozzo.com> <20160923212126.vo3hvb4hxojjh7s4@grep.be> <57E66C60.8040102@virtuozzo.com> <57E682AC.8070704@virtuozzo.com> From: Vladimir Sementsov-Ogievskiy Message-ID: <57E6A7D4.4040000@virtuozzo.com> Date: Sat, 24 Sep 2016 19:20:36 +0300 MIME-Version: 1.0 In-Reply-To: <57E682AC.8070704@virtuozzo.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] write_zeroes/trim on the whole disk List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Wouter Verhelst , Eric Blake Cc: qemu-devel , qemu-block@nongnu.org, nbd-general@lists.sourceforge.net, kwolf@redhat.com, "Denis V. Lunev" , Paolo Bonzini , Stefan Hajnoczi , Alex Bligh On 24.09.2016 16:42, Vladimir Sementsov-Ogievskiy wrote: > On 24.09.2016 15:06, Vladimir Sementsov-Ogievskiy wrote: >> On 24.09.2016 00:21, Wouter Verhelst wrote: >>> On Fri, Sep 23, 2016 at 02:00:06PM -0500, Eric Blake wrote: >>>> My preference would be a new flag to the existing commands, with >>>> explicit documentation that 0 offset and 0 length must be used with >>>> that >>>> flag, when requesting a full-device wipe. >>> Alternatively, what about a flag that says "if you use this flag, the >>> size should be left-shifted by X bits before processing"? That allows >>> you to do TRIM or WRITE_ZEROES on much larger chunks, without being >>> limited to "whole disk" commands. We should probably make it an illegal >>> flag for any command that actually sends data over the wire, though. >>> >> >> >> Note: if disk size is not aligned to X we will have to send request >> larger than the disk size to clear the whole disk. > > which is not beautiful.. And splitting the request into two: > (disk_size / X * X) and (disk_size % X) is not beautiful too. May be > flag, that says 'whole disk request' is more appropriate? Nothing > prevents adding then flag about X-shift. > > Also, accordingly to documentation, NBD_CMD_TRIM is not appropriate for disk clearing: * `NBD_CMD_TRIM` (4) A hint to the server that the data defined by len and offset is no longer needed. A server MAY discard len bytes starting at offset, but is not required to. After issuing this command, a client MUST NOT make any assumptions about the contents of the export affected by this command, until overwriting it again with `NBD_CMD_WRITE`. - it may do nothing.. So, what to do with this? add flag FORCE_TRIM for this command? Or add FORCE_HOLES flag to WRITE_ZEROES? -- Best regards, Vladimir