Page MenuHomeFreeBSD

cp: Adjust the sparse file tests.
ClosedPublic

Authored by des on Feb 7 2023, 1:10 PM.
Tags
None
Referenced Files
F103986316: D38414.diff
Mon, Dec 2, 1:28 AM
Unknown Object (File)
Tue, Nov 26, 7:54 PM
Unknown Object (File)
Tue, Nov 26, 7:54 PM
Unknown Object (File)
Tue, Nov 26, 7:53 PM
Unknown Object (File)
Tue, Nov 26, 7:52 PM
Unknown Object (File)
Tue, Nov 26, 6:09 PM
Unknown Object (File)
Tue, Nov 26, 4:21 AM
Unknown Object (File)
Wed, Nov 20, 11:06 AM
Subscribers

Details

Summary
  • The sparsity check was ineffective: it compared the apparent size in bytes to the actual size in blocks.
  • Some of the seq commands were missing an argument.
  • Based on empirical evidence, 1 MB holes are not necessarily large enough to be preserved by the underlying filesystem. Increase the hole size to 16 MB.

MFC after: 1 week
Sponsored by: Klara, Inc.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 49596
Build 46486: arc lint + arc unit

Event Timeline

des requested review of this revision.Feb 7 2023, 1:10 PM
This revision is now accepted and ready to land.Feb 8 2023, 2:29 PM
markj added inline comments.
bin/cp/tests/cp_test.sh
204

Hmm, I think this is a bit too simplistic. On ZFS I see:

markj@nuc> jot 4096 1 1 > 1
markj@nuc> du -h 1
512B    1
markj@nuc> du -hA 1
8.0K    1
markj@nuc> dd if=/dev/random of=2 bs=4K count=1
1+0 records in
1+0 records out
4096 bytes transferred in 0.000220 secs (18653284 bytes/sec)
markj@nuc> du -h 2
4.5K    2
markj@nuc> du -hA 2
4.0K    2

Neither of these files is sparse obviously, and it looks like ZFS is reporting the size of the dnode as well as a compressed size.

I can't think of a way to check for holes from the shell.

des marked an inline comment as done.Feb 8 2023, 3:55 PM
des added inline comments.
bin/cp/tests/cp_test.sh
204

That's a good point. I suppose I could write a hole detection tool in C. It's still better than the previous version (which would report every file as sparse).

des marked an inline comment as done.

Use a custom tool to detect sparseness.

This revision now requires review to proceed.Feb 8 2023, 4:21 PM
This revision is now accepted and ready to land.Feb 8 2023, 4:46 PM
This revision was automatically updated to reflect the committed changes.