From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54869) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bnq1v-0003tw-Ev for qemu-devel@nongnu.org; Sat, 24 Sep 2016 12:42:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bnq1p-000091-KK for qemu-devel@nongnu.org; Sat, 24 Sep 2016 12:42:22 -0400 References: <57E5752C.3080407@virtuozzo.com> <20160923212126.vo3hvb4hxojjh7s4@grep.be> <57E66C60.8040102@virtuozzo.com> From: Vladimir Sementsov-Ogievskiy Message-ID: <57E6ACDD.7080205@virtuozzo.com> Date: Sat, 24 Sep 2016 19:42:05 +0300 MIME-Version: 1.0 In-Reply-To: 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: Alex Bligh Cc: Wouter Verhelst , Eric Blake , "qemu-devel@nongnu.org" , qemu block , "nbd-general@lists.sourceforge.net" , Kevin Wolf , "Denis V. Lunev" , Paolo Bonzini , "Stefan stefanha@redhat. com" On 24.09.2016 19:31, Alex Bligh wrote: >> On 24 Sep 2016, at 13:06, Vladimir Sementsov-Ogievskiy wrote: >> >> 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. > If you look at the block size extension, the size of the disk must be an exact multiple of the minimum block size. So that would work. > But there is no guarantee that disk_size/block_size < INT_MAX.. May be, additional option, specifying the shift would be better. With convention that if offset+length exceeds disk size, length should be recalculated as disk_size-offset. -- Best regards, Vladimir