Re: [discussion] proposal to bypass zero data for dm-crypt
From: James Bottomley
Date: Mon Jan 06 2025 - 21:14:59 EST
On Sat, 2024-12-21 at 10:34 +0800, Yu Kuai wrote:
> Background
>
> We provide virtual machines for customers to use, which include an
> important feature: in the initial state, the disks in the virtual
> machine do not occupy actual storage space, and the data read by
> users is all zeros until the user writes data for the first time.
> This can save a large amount of storage.
>
> Problem
>
> However, after introducing dm-crypt, this feature has failed. Because
> we expect the data read by users in the initial state to be zero, we
> have to write all zeros from dm-crypt.
Why do you expect the user to read all zeros? For DM crypt on a new
physical disk, we don't set the disk contents to an initial value
because there's no expectation on the part of the user that they can
read a sector they haven't written and get a sensible result instead of
the dm-crypt of whatever the sector contained. Why can't your cloud
system just behave like a physical disk?
Even for an unencrypted physical disk, there's no expectation of any
particular value being in a sector, so why do your users have the
expectation of all zeros?
Regards,
James