On Wed, Mar 14, 2012 at 01:01:35PM +0100, Kevin Wolf wrote: > Paolo mentioned a use case as a fast way for guests to write zeros, but > is it really faster than a normal write when we have to emulate it by a > bdrv_write with a temporary buffer of zeros? On the other hand we have > the cases where discard really means "I don't care about the data any > more" and emulating it by writing zeros is just a waste of resources there.
On raw a real discard also will destroy the preallocation, which might absolutely kill your performance on filesystems. XFS provides a XFS_IOC_ZERO_RANGE ioctl (same calloing convention as XFS_IOC_RESVSP), which would provide a good backend for WRITE SAME emulation in this context.