I don't want to block this part as it's an improvement over the current state, but all these games of trying to detect if discard zeroes all data despite making no such guarantee whatsoever and being explicitly allowed to zero some but not all data just feels wrong. The right thing would be to use the BLKZEROOUT, but AFAIK the problem is that dm-thin doesn't support that. Given that the dm-thin discard implementation seems do always zero, it should be able to just be reusable for BLKZEROOUT. Can the dm maintainers look into that as it is a pretty glaring omission?