Thread (13 messages) read the whole thread 13 messages, 4 authors, 2022-09-21

Re: [PATCH mdadm v2 1/2] mdadm: Add --discard option for Create

From: Roman Mamedov <hidden>
Date: 2022-09-09 12:02:01

On Fri, 9 Sep 2022 11:57:49 +0200
Mariusz Tkaczyk [off-list ref] wrote:
BTW. I'm not sure if discard ensures that data will be all zero. It causes that
drive drops all references but I doesn't mean that data is zeroed. Could you
please check it in documentation? Should we expect zeroes?
Indeed, the references are dropped, but the actual data is still on disk.
Physically wiping it would be time-consuming. Instead the "zeroing" is achieved
via the fact that trying to read back areas for which the drive has no
reference, makes the drive return all zeroes instead.

The behavior varies per SSD model. Some do not return zeroes after a discard,
but some binary garbage instead.

In the ATA layer there is the sysfs file "discard_zeroes_data", which tells
whether or not to expect zeroes after a discard. That flag does not appear to
be always correct, e.g. I have some SSDs which do observably read back zeroes
after a discard, but the flag still says "0". Rather than relying on that flag
Logan opted for a manual check, reading back the actual disk data to check for
zeroes, which I think could employ the optimization safely enough much more
often, than simply going per the flag value would allow.

-- 
With respect,
Roman
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help