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

Reply via email to