mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
btrfs/215: avoid false alert for subpage case
[BUG]
When running btrfs/215 with 64K page size, 4K sectorsize (subpage RW
support), it fails with the following error:
btrfs/215 [failed, exit status 1]- output mismatch (see ~/xfstests-dev/results//btrfs/215.out.bad)
--- tests/btrfs/215.out 2021-03-19 16:34:26.069634953 +0800
+++ ~/xfstests-dev/results//btrfs/215.out.bad 2021-05-17 16:52:34.743514224 +0800
@@ -1,2 +1,3 @@
QA output created by 215
-Silence is golden
+Errors: 8 expected: 2
+(see ~/xfstests-dev/results//btrfs/215.full for details)
...
(Run 'diff -u ~/xfstests-dev/tests/btrfs/215.out ~/xfstests-dev/results//btrfs/215.out.bad' to see the entire diff)
[CAUSE]
For subpage case, btrfs still tries to read the full page, other than
read just one sector for PAGE_SIZE == sectorsize case.
This means for the 2 sectors corrupted case, since they are in the same
page, all the errors will be reported.
[FIX]
Change the following values:
- filesize
Now it's 8 * pagesize.
- expected error number
Now it's 2 * sectors_per_page or 6 * sectors_per_page.
Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
This commit is contained in:
+19
-6
@@ -46,8 +46,21 @@ _scratch_mkfs > /dev/null
|
|||||||
# blobk group
|
# blobk group
|
||||||
_scratch_mount -o nospace_cache
|
_scratch_mount -o nospace_cache
|
||||||
|
|
||||||
|
pagesize=$(get_page_size)
|
||||||
blocksize=$(_get_block_size $SCRATCH_MNT)
|
blocksize=$(_get_block_size $SCRATCH_MNT)
|
||||||
filesize=$((8*$blocksize))
|
|
||||||
|
# For subpage case, since we still do read in full page size, if have 8 corrupted
|
||||||
|
# sectors in one page, then even we just try to read one sector of that page,
|
||||||
|
# all 8 corruption will be reported.
|
||||||
|
# So here we chose the filesize using page size.
|
||||||
|
filesize=$((8*$pagesize))
|
||||||
|
if [ $blocksize -le $pagesize ]; then
|
||||||
|
sectors_per_page=$(($pagesize / $blocksize))
|
||||||
|
else
|
||||||
|
# We don't support multi-page sectorsize yet
|
||||||
|
_notrun "this test doesn't support sectorsize $blocksize with page size $pagesize yet"
|
||||||
|
fi
|
||||||
|
|
||||||
uuid=$(findmnt -n -o UUID "$SCRATCH_MNT")
|
uuid=$(findmnt -n -o UUID "$SCRATCH_MNT")
|
||||||
|
|
||||||
if [ ! -e /sys/fs/btrfs/$uuid/bdi ]; then
|
if [ ! -e /sys/fs/btrfs/$uuid/bdi ]; then
|
||||||
@@ -64,24 +77,24 @@ echo "logical = $logical_extent physical=$physical_extent" >> $seqres.full
|
|||||||
|
|
||||||
# corrupt first 4 blocks of file
|
# corrupt first 4 blocks of file
|
||||||
_scratch_unmount
|
_scratch_unmount
|
||||||
$XFS_IO_PROG -d -c "pwrite -S 0xaa -b $blocksize $physical_extent $((4*$blocksize))" $SCRATCH_DEV > /dev/null
|
$XFS_IO_PROG -d -c "pwrite -S 0xaa -b $pagesize $physical_extent $((4 * $pagesize))" $SCRATCH_DEV > /dev/null
|
||||||
_scratch_mount
|
_scratch_mount
|
||||||
|
|
||||||
# disable readahead to avoid skewing the counter
|
# disable readahead to avoid skewing the counter
|
||||||
echo 0 > /sys/fs/btrfs/$uuid/bdi/read_ahead_kb
|
echo 0 > /sys/fs/btrfs/$uuid/bdi/read_ahead_kb
|
||||||
|
|
||||||
# buffered reads whould result in 2 errors since readahead code always submits
|
# buffered reads whould result in 2 * sectors_per_page errors since readahead code always submits
|
||||||
# at least 1 page worth of IO and it will be counted as an error as well
|
# at least 1 page worth of IO and it will be counted as error(s) as well
|
||||||
$XFS_IO_PROG -c "pread -b $filesize 0 $filesize" "$SCRATCH_MNT/foobar" > /dev/null 2>&1
|
$XFS_IO_PROG -c "pread -b $filesize 0 $filesize" "$SCRATCH_MNT/foobar" > /dev/null 2>&1
|
||||||
errs=$($BTRFS_UTIL_PROG device stats $SCRATCH_DEV | awk '/corruption_errs/ { print $2 }')
|
errs=$($BTRFS_UTIL_PROG device stats $SCRATCH_DEV | awk '/corruption_errs/ { print $2 }')
|
||||||
if [ $errs -ne 2 ]; then
|
if [ $errs -ne $((2 * $sectors_per_page)) ]; then
|
||||||
_fail "Errors: $errs expected: 2"
|
_fail "Errors: $errs expected: 2"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# DIO does check every sector
|
# DIO does check every sector
|
||||||
$XFS_IO_PROG -d -c "pread -b $filesize 0 $filesize" "$SCRATCH_MNT/foobar" > /dev/null 2>&1
|
$XFS_IO_PROG -d -c "pread -b $filesize 0 $filesize" "$SCRATCH_MNT/foobar" > /dev/null 2>&1
|
||||||
errs=$($BTRFS_UTIL_PROG device stats $SCRATCH_DEV | awk '/corruption_errs/ { print $2 }')
|
errs=$($BTRFS_UTIL_PROG device stats $SCRATCH_DEV | awk '/corruption_errs/ { print $2 }')
|
||||||
if [ $errs -ne 6 ]; then
|
if [ $errs -ne $((6 * $sectors_per_page)) ]; then
|
||||||
_fail "Errors: $errs expected: 6"
|
_fail "Errors: $errs expected: 6"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user