On 29/09/2016 04:21, Fam Zheng wrote: > On Wed, 09/28 18:11, Max Reitz wrote: >> Note that BDRV_REQ_MAY_UNMAP does not mean "Yes, please discard" but >> just "You may discard if it's easier for you". But it's actually not >> easier for us, so I don't see why we're doing it. >> >> As far as I can guess you actually want some way to tell a block driver >> to actually make an effort to discard clusters as long they then read >> back as zero (which is why you cannot simply use bdrv_pdiscard()). >> However, I think this would require a new flag called >> BDRV_REQ_SHOULD_UNMAP (which should imply BDRV_REQ_MAY_UNMAP). > > This flag doesn't make sense to me, if the protocol doesn't know how to unmap, > it can ignore BDRV_REQ_MAY_UNMAP, but not BDRV_REQ_SHOULD_UNMAP. It just > complicates things a little.
I don't think we actually have a use for a "MAY" unmap flag. Either we keep the not-so-perfect name or we replace MAY_UNMAP with "should" or "want" or "would_like" unmap... But Fam's patch does do what was intended for the flag (which is the equivalent of the UNMAP bit in the SCSI WRITE SAME command). Paolo