mirror of
https://git.freebsd.org/src.git
synced 2026-01-11 19:57:22 +00:00
mdconfig_test: determine page size at run time rather than assuming 4k
Sponsored by: Netflix Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D52736
This commit is contained in:
parent
376508ef2f
commit
24458c2431
1 changed files with 8 additions and 7 deletions
|
|
@ -274,22 +274,23 @@ attach_size_rounddown()
|
|||
attach_size_rounddown_body()
|
||||
{
|
||||
local md
|
||||
local ss=8192
|
||||
local ms=$(($ss + 4096))
|
||||
local ms2=$((2 * $ss + 4096))
|
||||
local pgsz=$(pagesize)
|
||||
local ss=$(($pgsz * 2))
|
||||
local ms=$(($ss + $pgsz))
|
||||
local ms2=$((2 * $ss + $pgsz))
|
||||
|
||||
# Use a sector size that's a likely multiple of PAGE_SIZE, as md(4)
|
||||
# Use a sector size that's a multiple of the kernel page size, as md(4)
|
||||
# expects that for swap MDs.
|
||||
atf_check -s exit:0 -o save:mdconfig.out -e empty \
|
||||
-x "mdconfig -a -t swap -S $ss -s ${ms}b"
|
||||
md=$(cat mdconfig.out)
|
||||
# 12288 bytes should be rounded down to one sector.
|
||||
check_diskinfo "$md" 8192 1 $ss
|
||||
# one sector plus one page should be rounded down to one sector.
|
||||
check_diskinfo "$md" $ss 1 $ss
|
||||
|
||||
# Resize and verify that the new size was also rounded down.
|
||||
atf_check -s exit:0 -o empty -e empty \
|
||||
-x "mdconfig -r -u ${md#md} -s ${ms2}b"
|
||||
check_diskinfo "$md" 16384 2 $ss
|
||||
check_diskinfo "$md" $((2 * $ss)) 2 $ss
|
||||
}
|
||||
attach_size_rounddown_cleanup()
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue