Start a Conversation

This post is more than 5 years old

Solved!

Go to Solution

2297

December 9th, 2017 18:00

Blocks discarding and BLKDISCARDZEROES ioctl support

Hi to all!

Does scini devices supports BLKDISCARDZEROES ioctl call (queue/discard_zeroes_data in sysfs), i.e. guarantees that discarded blocks read back as zeroes?

I'm using ScaleIO R2_0.13000.211 on CentOS 7.2.1511 with kernel 3.10.0-327.36.3, and blkdiscard syscall works as expected: discarded blocks shows as 'trimmed capacity' and was immediately read back as zeroes. But BLKDISCARDZEROES ioctl call returns zero, which actually incorrect.

306 Posts

December 12th, 2017 02:00

Hi,

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!

Cheers,

Pawel

4 Posts

December 12th, 2017 09:00

Hi Pawel,

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?

306 Posts

December 18th, 2017 02:00

Hi,

Yes, the sysfs values can be trusted.

Cheers,

Pawel

No Events found!

Top