Hi, On 2023-07-19 15:49:59 -0500, Eric Sandeen wrote: > On 7/19/23 3:38 PM, Eric Sandeen wrote: > > On 7/19/23 3:29 PM, Andres Freund wrote: > > > Somewhat tangential: I still would like a fallocate() option that > > > actually > > > zeroes out new extents (via "write zeroes", if supported), rather > > > than just > > > setting them up as unwritten extents. Nor for "data" files, but for > > > WAL/journal files. > > > > Like this? > > > > fallocate(2): > > > > Zeroing file space > > Specifying the FALLOC_FL_ZERO_RANGE flag (available since > > Linux 3.15) in mode zeros space in the byte range starting at offset and > > continuing for len bytes. > > > > Under the covers, that uses efficient zeroing methods when available. > > > > -Eric > > > > Hm sorry, it's been a while. Maybe I'm wrong about this; I know it does > efficient zeroing when pointed at a block device but I guess I've confused > myself about what happens on a filesystem like XFS that supports unwritten > extents. Yea, it's documented to use unwritten extents: Zeroing is done within the filesystem preferably by converting the range into unwritten extents. This approach means that the specified range will not be physically zeroed out on the device (except for partial blocks at the either end of the range), and I/O is (otherwise) required only to update meta‐ data. and an experiment confirms that: $ dd if=/dev/zero of=test bs=1MB count=1 $ filefrag -v test Filesystem type is: 58465342 File size of test is 1000000 (245 blocks of 4096 bytes) ext: logical_offset: physical_offset: length: expected: flags: 0: 0.. 244: 6104864.. 6105108: 245: last,eof test: 1 extent found $ fallocate -z -o 0 -l $((4096*128)) test $ filefrag -v test Filesystem type is: 58465342 File size of test is 1000000 (245 blocks of 4096 bytes) ext: logical_offset: physical_offset: length: expected: flags: 0: 0.. 127: 6105210.. 6105337: 128: unwritten 1: 128.. 244: 6104992.. 6105108: 117: 6105338: last,eof Greetings, Andres Freund