util-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* fallocate on ext4 creating holes
@ 2020-10-16 18:30 Thomas Stringer
  2020-10-18 14:45 ` Theodore Y. Ts'o
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Stringer @ 2020-10-16 18:30 UTC (permalink / raw)
  To: util-linux

I've found that in recent kernel versions (5.7+) that fallocate creates 
files on ext4 filesystem with holes. Here is a repo:

$ sudo fallocate -l 512MiB /mnt/swapfile
$ sudo filefrag -e /mnt/swapfile
Filesystem type is: ef53
File size of /mnt/swapfile is 536870912 (131072 blocks of 4096 bytes)
  ext:     logical_offset:        physical_offset: length: expected: flags:
    0:        0..   63487:      34816..     98303: 63488:             
unwritten
    1:    63488..  126975:     100352..    163839:  63488: 98304: unwritten
    2:   126976..  131071:     165888..    169983:   4096: 163840: 
last,unwritten,eof
/mnt/swapfile: 3 extents found
$ sudo chmod 0600 /mnt/swapfile
$ sudo mkswap /mnt/swapfile
$ sudo swapon /mnt/swapfile
swapon: /mnt/swapfile: swapon failed: Invalid argument
$ sudo journalctl | grep hole
Oct 15 15:42:59 hostname kernel: swapon: swapfile has holes
Oct 15 15:43:09 hostname kernel: swapon: swapfile has holes
Oct 15 15:43:23 hostname kernel: swapon: swapfile has holes

But in previous versions (4.19 verified) this operation succeeds and 
swapon doesn't indicate holes in the file.

Is the behavior of creating files with fallocate on ext4 filesystems 
with holes expected and by-design?

Thank you in advance for any insight!
Thomas

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-10-18 14:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-16 18:30 fallocate on ext4 creating holes Thomas Stringer
2020-10-18 14:45 ` Theodore Y. Ts'o

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).