fallocate on ext4 creating holes

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

 



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



[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux