From: Hanabishi <i.r.e.c.c.a.k.u.n+kernel.org@gmail.com>
To: Qu Wenruo <quwenruo.btrfs@gmx.com>, linux-btrfs@vger.kernel.org
Subject: Re: 'btrfs filesystem defragment' makes files explode in size, especially fallocated ones
Date: Tue, 6 Aug 2024 13:22:54 +0000 [thread overview]
Message-ID: <0c6112d6-3d65-4791-9642-927c97f9b926@gmail.com> (raw)
In-Reply-To: <69ac8794-8a36-4a67-ba54-c11c44bf5044@gmail.com>
On 8/6/24 12:17, Hanabishi wrote:
> In fact fiemap "TOTAL" adds up correctly to the actual file size here.
> So maybe it is actually compsize lying with "Disk Usage" or something else weird happening.
I reproduced the results on a dedicated disk.
No, compsize is not lying. Confirmed by looking at total fs usage.
# compsize mingw-w64-gcc-13.1.0-1-x86_64.pkg.tar.zst
Processed 1 file, 3 regular extents (3 refs), 0 inline.
Type Perc Disk Usage Uncompressed Referenced
TOTAL 100% 449M 449M 224M
none 100% 449M 449M 224M
# btrfs filesystem usage /mnt
Overall:
Device size: 29.88GiB
Device allocated: 1.52GiB
Device unallocated: 28.36GiB
Device missing: 0.00B
Device slack: 0.00B
Used: 450.82MiB
Free (estimated): 28.92GiB (min: 14.74GiB)
Free (statfs, df): 28.92GiB
Data ratio: 1.00
Metadata ratio: 2.00
Global reserve: 5.50MiB (used: 16.00KiB)
Multiple profiles: no
Data,single: Size:1.00GiB, Used:449.51MiB (43.90%)
/dev/sdc1 1.00GiB
Metadata,DUP: Size:256.00MiB, Used:656.00KiB (0.25%)
/dev/sdc1 512.00MiB
System,DUP: Size:8.00MiB, Used:16.00KiB (0.20%)
/dev/sdc1 16.00MiB
Unallocated:
/dev/sdc1 28.36GiB
Notice that the space overhead does *not* belong to metadata. It is the actual data space wasted. So the problem is real.
Which also means that fiemap is the one who lies here.
# xfs_io -c "fiemap -v" mingw-w64-gcc-13.1.0-1-x86_64.pkg.tar.zst
mingw-w64-gcc-13.1.0-1-x86_64.pkg.tar.zst:
EXT: FILE-OFFSET BLOCK-RANGE TOTAL FLAGS
0: [0..460287]: 7335440..7795727 460288 0x0
1: [460288..460303]: 7335424..7335439 16 0x1
next prev parent reply other threads:[~2024-08-06 13:22 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-04 9:20 'btrfs filesystem defragment' makes files explode in size, especially fallocated ones i.r.e.c.c.a.k.u.n+kernel.org
2024-08-04 22:19 ` Qu Wenruo
2024-08-05 18:16 ` Hanabishi
2024-08-05 22:47 ` Qu Wenruo
2024-08-06 7:19 ` Hanabishi
2024-08-06 9:55 ` Qu Wenruo
2024-08-06 10:23 ` Hanabishi
2024-08-06 10:42 ` Qu Wenruo
2024-08-06 11:05 ` Hanabishi
2024-08-06 11:23 ` Qu Wenruo
2024-08-06 12:08 ` Hanabishi
2024-08-06 22:10 ` Qu Wenruo
2024-08-06 22:42 ` Hanabishi
2024-08-06 22:51 ` Qu Wenruo
2024-08-06 23:04 ` Hanabishi
2024-08-06 12:17 ` Hanabishi
2024-08-06 13:22 ` Hanabishi [this message]
2024-08-06 22:18 ` Qu Wenruo
2024-08-06 22:55 ` Hanabishi
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=0c6112d6-3d65-4791-9642-927c97f9b926@gmail.com \
--to=i.r.e.c.c.a.k.u.n+kernel.org@gmail.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=quwenruo.btrfs@gmx.com \
/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