On Thu, Aug 17, 2017 at 01:47:13PM -0400, Martin K. Petersen wrote: > 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 Yeah, that's what needs to be done generally, although as I said there are devices where after DISCARD we will read zeroes. Comments in __blkdev_issue_zeroout() even says it will unmap. In that case the discard or zeroout will be redundant and it can take quite some time on bigger devices. -Lukas > > 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