61 lines
2.0 KiB
Markdown
61 lines
2.0 KiB
Markdown
# Test Case: statfs with 48-bit Block Count
|
|
|
|
**Test ID**: TC010-statfs-48bit
|
|
**Category**: Filesystem Metadata
|
|
**Priority**: Medium
|
|
|
|
## Objective
|
|
|
|
Verify a nonzero 48-bit block-count high word survives mount validation and is
|
|
exported without truncation through FreeBSD `statfs(2)` and `df(1)`.
|
|
|
|
## Fixture Qualification
|
|
|
|
```sh
|
|
work=$(mktemp -d /tmp/repo22-tc010.XXXXXX)
|
|
tests/prepare_error_fixtures.sh "$work/fixtures"
|
|
python3 tests/erofs_fixture.py inspect \
|
|
"$work/fixtures/48bit-statfs-prefix.erofs"
|
|
grep '^48bit-statfs-prefix ' "$work/fixtures/fixture-evidence.txt"
|
|
sha256 -q "$work/fixtures/48bit-statfs-prefix.erofs"
|
|
```
|
|
|
|
Read `total_blocks` and `required_provider_length` from the evidence. The
|
|
fixture sets incompat bit `0x80`, `rb.blocks_hi=1`, and a nonzero
|
|
`rootnid_8b`, then recomputes CRC32C. Its small prefix hash identifies the
|
|
metadata; the qualified provider is that exact prefix followed by sparse zeros
|
|
to the required media size.
|
|
|
|
## FreeBSD Procedure
|
|
|
|
```sh
|
|
provider="$work/48bit-statfs-provider.raw"
|
|
cp "$work/fixtures/48bit-statfs-prefix.erofs" "$provider"
|
|
truncate -s "$required_provider_length" "$provider"
|
|
stat -f 'size=%z blocks=%b' "$provider"
|
|
unit=$(mdconfig -a -t vnode -f "$provider")
|
|
diskinfo -v "/dev/$unit"
|
|
mkdir "$work/mnt"
|
|
mount -t erofs -o ro "/dev/$unit" "$work/mnt"
|
|
df -kT "$work/mnt"
|
|
df -iT "$work/mnt"
|
|
actual_1k=$(df -k "$work/mnt" | awk 'NR == 2 { print $2 }')
|
|
used_1k=$(df -k "$work/mnt" | awk 'NR == 2 { print $3 }')
|
|
avail_1k=$(df -k "$work/mnt" | awk 'NR == 2 { print $4 }')
|
|
expected_1k=$((total_blocks * 4))
|
|
test "$actual_1k" -eq "$expected_1k"
|
|
test "$used_1k" -eq "$expected_1k"
|
|
test "$avail_1k" -eq 0
|
|
umount "$work/mnt"
|
|
mdconfig -d -u "${unit#md}"
|
|
rm -f "$provider"
|
|
```
|
|
|
|
## Expected Results
|
|
|
|
`diskinfo` reports at least the declared 16 TiB-plus media size. Mount succeeds,
|
|
the `df -k` total equals `total_blocks * 4`, Used equals total because
|
|
`f_bfree=0`, and Avail is zero.
|
|
If the filesystem cannot create or attach the sparse provider, record SHELVED
|
|
with all failed commands; a short-provider `ENXIO` is not PASS.
|