Files
erofs-freebsd-out-tree/tests/TC018-48bit-large-fs.md
T
2026-08-13 10:44:59 +02:00

67 lines
2.6 KiB
Markdown

# Test Case: Large Filesystem with 48-bit Addressing
**Test ID**: TC018-48bit-large-fs
**Category**: Filesystem Metadata
**Priority**: Low
## Objective
Verify a real FLAT_PLAIN read whose extended inode has `startblk_hi=1`, so the
provider I/O occurs above 16 TiB rather than only reporting a large `statfs`
total.
## Fixture Qualification
```sh
work=$(mktemp -d /tmp/repo22-tc018.XXXXXX)
tests/prepare_error_fixtures.sh "$work/fixtures"
python3 tests/erofs_fixture.py inspect \
"$work/fixtures/48bit-high-file-prefix.erofs" --path /high-offset.txt
grep '^48bit-high-file-prefix ' "$work/fixtures/fixture-evidence.txt"
sha256 -q "$work/fixtures/48bit-high-file-prefix.erofs"
```
Require an extended nonempty FLAT_PLAIN inode, `startblk_hi=1`, a physical
`data_offset >= 17592186044416`, a valid CRC, and an end offset within
`required_provider_length`. The mutator zeros the original low-block payload,
so a reader that ignores `startblk_hi` cannot return the expected source bytes.
Read `required_provider_length`, `start_block`, `data_offset`,
`low_decoy_offset`, and `file_size` from the evidence line.
## FreeBSD Procedure
```sh
provider="$work/48bit-high-file-provider.raw"
cp "$work/fixtures/48bit-high-file-prefix.erofs" "$provider"
truncate -s "$required_provider_length" "$provider"
dd if="$work/fixtures/source/high-offset.txt" of="$provider" bs=4096 \
seek="$start_block" conv=notrunc
cc -O2 -Wall -Wextra -std=c17 tests/read_probe.c -o "$work/read_probe"
"$work/read_probe" pread "$provider" "$low_decoy_offset" "$file_size" \
"$work/raw-low-offset.txt"
"$work/read_probe" pread "$provider" "$data_offset" "$file_size" \
"$work/raw-high-offset.txt"
dd if=/dev/zero of="$work/zero.bin" bs="$file_size" count=1
cmp "$work/zero.bin" "$work/raw-low-offset.txt"
! cmp -s "$work/fixtures/source/high-offset.txt" "$work/raw-low-offset.txt"
cmp "$work/fixtures/source/high-offset.txt" "$work/raw-high-offset.txt"
unit=$(mdconfig -a -t vnode -f "$provider")
diskinfo -v "/dev/$unit"
mkdir "$work/mnt"
mount -t erofs -o ro "/dev/$unit" "$work/mnt"
cmp "$work/fixtures/source/high-offset.txt" "$work/mnt/high-offset.txt"
cmp "$work/fixtures/source/control.txt" "$work/mnt/control.txt"
df -h "$work/mnt"
umount "$work/mnt"
mdconfig -d -u "${unit#md}"
rm -f "$provider"
```
## Expected Results
The raw provider probe and mounted file both return the exact source bytes from
above 16 TiB, while a low-offset control remains valid. Record the prefix hash,
sparse media size/allocation, high offset, source/data hash, dmesg delta, and
cleanup. If sparse high-offset I/O is unavailable, mark SHELVED with all
attempts; a large `df` result alone cannot pass TC018.