Re: [PATCH] block: reintroduce discard_zeroes_data sysfs file and BLKDISCARDZEROES

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

 



Lukas,

> Do we also know that the blocks were discarded as we do with
> BLKDISCARD ?

There never was a way to know for sure.

ATA DSM TRIM and SCSI UNMAP are hints by definition. We attempted to
bend their semantics towards getting predictable behavior but ultimately
failed. Too many corner cases.

> As I mentioned before. We relied on discard_zeroes_data in mkfs.ext4
> to make sure that inode tables are zeroed after discard.

The point is that you shouldn't have an if (discard_zeroes_data)
conditional in the first place.

 - If you need to dellocate a block range and you don't care about its
   contents in the future, use BLKDISCARD / FL_PUNCH_HOLE.

 - If you need to zero a block range, use BLKZEROOUT / FL_ZERO_RANGE.

So the mkfs usage model should essentially be:

 - DISCARD the entire partition/device block range

 - ZEROOUT the inode tables and other areas where you need zeroes on
   future reads

And that should be the approach regardless of whether your device is a
disk drive, an SSD, an NVMe device a SCSI array or whatever. DISCARD old
contents, ZEROOUT the pieces you care about. No conditionals or trying
to do things differently based on device capabilities.

-- 
Martin K. Petersen	Oracle Linux Engineering



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux