BLKDISCARDZEROES won't work properly with scini devices - they do not guarantee the zeroing out of discarded regions (this fact is published in the sysfs queue entries of our scini devices).
The reason for this lack of guarantee lies in the fact that any discard region that is not 1MB aligned in offset and size will be completed with “success” without any operation taking place (for example if you discard a single sector at some offset).
So, let’s say you have data “A” in sector 0 of your volume and discard that single sector at offset 0 and then read that sector from offset 0, you will read data “A”.
The exception is when your discard is aligned to 1MB: if the discard region is 1M aligned in offset and size then we guarantee it will be zeroed; otherwise not.
Hope it helps!
Thanks for detailed description of the discard behavior, it's very helpful! I think that info should be added to ScaleIO user guide, because it's very important for virtualization tools that uses zero write optimizations.
Also, I don't want to hardcode alignment value in my code. Can I rely on the sysfs 'queue/discard_granularity' or 'queue/discard_max_bytes' value for the discard alignment?