From: Tobias Reinhard <trtracer@gmail.com>
To: linux-btrfs@vger.kernel.org
Subject: Effect of punching holes
Date: Tue, 22 Oct 2019 11:47:23 +0200 [thread overview]
Message-ID: <2b75abb1-4dd8-1da4-77be-7557ff53ec75@gmail.com> (raw)
Hi,
I noticed that if you punch a hole in the middle of a file the available
filesystem space seems not to increase.
Kernel is 5.2.11
To reproduce:
->mkfs.btrfs /dev/loop1 -f
btrfs-progs v4.15.1
See http://btrfs.wiki.kernel.org for more information.
Detected a SSD, turning off metadata duplication. Mkfs with -m dup if
you want to force metadata duplication.
Label: (null)
UUID: 415e925a-588a-4b8f-bdc7-c30a4a0f5587
Node size: 16384
Sector size: 4096
Filesystem size: 1.00GiB
Block group profiles:
Data: single 8.00MiB
Metadata: single 8.00MiB
System: single 4.00MiB
SSD detected: yes
Incompat features: extref, skinny-metadata
Number of devices: 1
Devices:
ID SIZE PATH
1 1.00GiB /dev/loop1
->mount /dev/loop1 /srv/btrtest2
->for i in $(seq 1 20); do dd if=/dev/urandom of=test$i bs=16M count=4 ;
sync ; fallocate -p -o 4096 -l 67100672 test$i && sync ; done
this failed from the 16th file on because of no space left
->df -T .
Filesystem Type 1K-blocks Used Available Use% Mounted on
/dev/loop1 btrfs 1048576 935856 2272 100% /srv/btrtest2
->btrfs fi du .
Total Exclusive Set shared Filename
8.00KiB 8.00KiB - ./test1
8.00KiB 8.00KiB - ./test2
8.00KiB 8.00KiB - ./test3
8.00KiB 8.00KiB - ./test4
8.00KiB 8.00KiB - ./test5
8.00KiB 8.00KiB - ./test6
8.00KiB 8.00KiB - ./test7
8.00KiB 8.00KiB - ./test8
8.00KiB 8.00KiB - ./test9
8.00KiB 8.00KiB - ./test10
8.00KiB 8.00KiB - ./test11
8.00KiB 8.00KiB - ./test12
8.00KiB 8.00KiB - ./test13
8.00KiB 8.00KiB - ./test14
8.00KiB 8.00KiB - ./test15
4.00KiB 4.00KiB - ./test16
4.00KiB 4.00KiB - ./test17
4.00KiB 4.00KiB - ./test18
4.00KiB 4.00KiB - ./test19
4.00KiB 4.00KiB - ./test20
140.00KiB 140.00KiB 0.00B .
When doing this on XFS or EXT4 it works as expected:
Filesystem Type 1K-blocks Used Available Use% Mounted on
/dev/loop1 ext4 999320 2764 927744 1% /srv/btrtest
/dev/loop2 xfs 1038336 40456 997880 4% /srv/xfstest
How to i reclaim the space on BTRFS? Defrag does not seem to help.
Best regards
Tobias
next reply other threads:[~2019-10-22 9:47 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-22 9:47 Tobias Reinhard [this message]
2019-10-22 10:01 ` Effect of punching holes Qu Wenruo
2019-10-22 13:04 ` Austin S. Hemmelgarn
2019-10-24 18:52 ` Tobias Reinhard
2019-10-24 19:04 ` Austin S. Hemmelgarn
2019-10-24 18:54 ` Tobias Reinhard
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=2b75abb1-4dd8-1da4-77be-7557ff53ec75@gmail.com \
--to=trtracer@gmail.com \
--cc=linux-btrfs@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).