Re: [PATCH v2] dm-integrity: if we have discard support, use it when recalculating

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi again,

On Wednesday, 28 April 2021 23:00:23 CEST Mikulas Patocka wrote:
> Here I'm sending version 2 of the patch - it increases version number of
> the target, so that userspace can test if this feature is present.
> 
> From: Mikulas Patocka <mpatocka@xxxxxxxxxx>
> 
> If we have discard support, we don't have to recalculate hash - we can
> just fill the metadata with the discard pattern.
> 
> Signed-off-by: Mikulas Patocka <mpatocka@xxxxxxxxxx>

I had a look at this patch. If I understand correctly, this logic only applies 
to dm-integrity recalculation, so for example from userspace with:
$ integritysetup --integrity-recalculate --allow-discards open <dev> <name>

In such a case, it will fill all tag values with discard filler instead of 
reading from the drive and computing the tags. If that is true I think this is 
not desired behaviour, consider the following:

* SSD with existing data /dev/sda1.
* Device for dm-integrity metadata /dev/vg/is_sda1_meta.
* $ integritysetup --data-device /dev/sda1 --no-wipe /dev/vg/is_sda1_meta
* $ integritysetup --data-device /dev/sda1 --integrity-recalculate \
	--allow-discards open /dev/vg/is_sda1_meta is_sda1

In current production version, this causes a full read of the SSD to 
recalculate integrity tags, which is as expected and works very nicely. With 
this patch, wouldn't it result in all integrity tags being set to the discard 
filler? Does this patch assume a device is fully discarded when recalculating?
Perhaps I am reading it wrong, I am not familiar with the dm kernel modules.


Also, a bit unrelated to any of the above. When doing a format operation 
(without --no-wipe) on a device supporting discard, would it not be possible 
to format via discards instead of the current data write operations? That 
would significantly improve speed for SSDs and also reduce wear on the drive.

Thanks,

-- 
Melvin Vermeeren
Systems engineer

Attachment: signature.asc
Description: This is a digitally signed message part.

--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://listman.redhat.com/mailman/listinfo/dm-devel

[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux