Received: from eggs.gnu.org ([2001:4830:134:3::10]:46202) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bQ9y3-0000YO-9B for qemu-devel@nongnu.org; Thu, 21 Jul 2016 05:08:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bQ9xz-0001J0-QH for qemu-devel@nongnu.org; Thu, 21 Jul 2016 05:08:31 -0400 Received: from mail-lf0-x22e.google.com ([2a00:1450:4010:c07::22e]:36139) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bQ9xz-0001Ic-Hx for qemu-devel@nongnu.org; Thu, 21 Jul 2016 05:08:27 -0400 Received: by mail-lf0-x22e.google.com with SMTP id g62so55817543lfe.3 for ; Thu, 21 Jul 2016 02:08:27 -0700 (PDT) Sender: Paolo Bonzini References: <577A6955.6020603@kamp.de> <57900AB3.3040705@redhat.com> From: Paolo Bonzini Message-ID: <0da28a84-5b9a-ac8c-0bd8-e03cfc824bcb@redhat.com> Date: Thu, 21 Jul 2016 11:08:22 +0200 MIME-Version: 1.0 In-Reply-To: <57900AB3.3040705@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] Regression: block: Add .bdrv_co_pwrite_zeroes() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake , Peter Lieven , "qemu-devel@nongnu.org" Cc: Kevin Wolf On 21/07/2016 01:35, Eric Blake wrote: > Also, while the device is advertising that the optimal discard alignment > is 15M, that does not tell me the minimum granularity that it can > actually discard. Can you determine that value? That is, if I try to > discard only 1M, does that actually result in a 1M allocation hole, or > is it ignored? It sounds like qemu should be tracking 2 separate > values: the minimum discard granularity (I suspect this number is a > power of 2, at least the block size, and perhaps precisely equal to the > block size) It's very unlikely to be equal to the block size. The block size is probably 512, perhaps 4096, while the optimal discard alignment is usually at least 64K. > Or put another way, I get that I can't discard more than 15M at a time. I don't think so; optimal discard alignment is 15M but maximum discard size is most likely _not_ 15M. > Optimal size not being a power of 2 is not a problem, but I still > suspect MINIMUM alignment is a power of 2, and I need to know how much > head and tail to discard in the new byte-based discard routines in order > to align requests up to the minimal discard alignment boundaries. But why does it matter if it is a power of 2? Can't you just use DIV_ROUND_UP? Paolo