util-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Stringer <trstringer@gmail.com>
To: util-linux@vger.kernel.org
Subject: fallocate on ext4 creating holes
Date: Fri, 16 Oct 2020 14:30:10 -0400	[thread overview]
Message-ID: <58f7cb75-1e2b-ec2b-221f-0af2c80b2728@gmail.com> (raw)

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

             reply	other threads:[~2020-10-16 18:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-16 18:30 Thomas Stringer [this message]
2020-10-18 14:45 ` fallocate on ext4 creating holes Theodore Y. Ts'o

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=58f7cb75-1e2b-ec2b-221f-0af2c80b2728@gmail.com \
    --to=trstringer@gmail.com \
    --cc=util-linux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).