mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-25 18:59:33 +03:00
Fix reservation test cases for large disks
Convert explicit `typeset -i` and `typeset -l` declarations to `typeset` in order to prevent 32-bit overflow from occurs with disks >2G. TEST_ZFSTESTS_DISKSIZE=4G Reviewed-by: George Melikov <mail@gmelikov.ru> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes #5715 Closes #5714
This commit is contained in:
parent
0f676dc228
commit
8eecd4a2de
@ -70,9 +70,9 @@ function zero_reservation
|
|||||||
#
|
#
|
||||||
function within_limits
|
function within_limits
|
||||||
{
|
{
|
||||||
typeset -l valA=$1
|
typeset valA=$1
|
||||||
typeset -l valB=$2
|
typeset valB=$2
|
||||||
typeset -l delta=$3
|
typeset delta=$3
|
||||||
|
|
||||||
if ((valA <= valB)); then
|
if ((valA <= valB)); then
|
||||||
if (((valB - valA) <= delta)); then
|
if (((valB - valA) <= delta)); then
|
||||||
@ -115,14 +115,14 @@ function create_multiple_fs # num_fs base_fs_name base_mnt_name
|
|||||||
#
|
#
|
||||||
function floor_volsize #<largest_volsize> [volblksize]
|
function floor_volsize #<largest_volsize> [volblksize]
|
||||||
{
|
{
|
||||||
typeset -l largest_volsize=$1
|
typeset largest_volsize=$1
|
||||||
typeset -l volblksize=${2:-8192}
|
typeset volblksize=${2:-8192}
|
||||||
|
|
||||||
if ((largest_volsize < volblksize)); then
|
if ((largest_volsize < volblksize)); then
|
||||||
log_fail "The largest_volsize must be greater than volblksize."
|
log_fail "The largest_volsize must be greater than volblksize."
|
||||||
fi
|
fi
|
||||||
typeset -l real_volsize
|
typeset real_volsize
|
||||||
typeset -l n
|
typeset n
|
||||||
|
|
||||||
((n = largest_volsize / volblksize))
|
((n = largest_volsize / volblksize))
|
||||||
((largest_volsize = volblksize * n))
|
((largest_volsize = volblksize * n))
|
||||||
@ -142,26 +142,26 @@ function floor_volsize #<largest_volsize> [volblksize]
|
|||||||
function volsize_to_reservation
|
function volsize_to_reservation
|
||||||
{
|
{
|
||||||
typeset vol=$1
|
typeset vol=$1
|
||||||
typeset -i volsize=$2
|
typeset volsize=$2
|
||||||
|
|
||||||
typeset -i DN_MAX_INDBLKSHIFT=14
|
typeset DN_MAX_INDBLKSHIFT=14
|
||||||
typeset -i SPA_BLKPTRSHIFT=7
|
typeset SPA_BLKPTRSHIFT=7
|
||||||
typeset -i SPA_DVAS_PER_BP=3
|
typeset SPA_DVAS_PER_BP=3
|
||||||
|
|
||||||
typeset -i DNODES_PER_LEVEL_SHIFT=$((DN_MAX_INDBLKSHIFT - \
|
typeset DNODES_PER_LEVEL_SHIFT=$((DN_MAX_INDBLKSHIFT - \
|
||||||
SPA_BLKPTRSHIFT))
|
SPA_BLKPTRSHIFT))
|
||||||
typeset -i DNODES_PER_LEVEL=$((1 << $DNODES_PER_LEVEL_SHIFT))
|
typeset DNODES_PER_LEVEL=$((1 << $DNODES_PER_LEVEL_SHIFT))
|
||||||
|
|
||||||
if ds_is_volume $vol; then
|
if ds_is_volume $vol; then
|
||||||
typeset -i ncopies=$(get_prop copies $vol)
|
typeset ncopies=$(get_prop copies $vol)
|
||||||
typeset -i volblocksize=$(get_prop volblocksize $vol)
|
typeset volblocksize=$(get_prop volblocksize $vol)
|
||||||
else
|
else
|
||||||
typeset -i ncopies=1
|
typeset ncopies=1
|
||||||
typeset -i volblocksize=8192
|
typeset volblocksize=8192
|
||||||
fi
|
fi
|
||||||
typeset -i nblocks=$((volsize / volblocksize))
|
typeset nblocks=$((volsize / volblocksize))
|
||||||
|
|
||||||
typeset -i numdb=7
|
typeset numdb=7
|
||||||
while ((nblocks > 1)); do
|
while ((nblocks > 1)); do
|
||||||
((nblocks += DNODES_PER_LEVEL - 1))
|
((nblocks += DNODES_PER_LEVEL - 1))
|
||||||
((nblocks /= DNODES_PER_LEVEL))
|
((nblocks /= DNODES_PER_LEVEL))
|
||||||
@ -186,9 +186,9 @@ function volsize_to_reservation
|
|||||||
function largest_volsize_from_pool
|
function largest_volsize_from_pool
|
||||||
{
|
{
|
||||||
typeset pool=$1
|
typeset pool=$1
|
||||||
typeset -i poolsize=$(get_prop available $pool)
|
typeset poolsize=$(get_prop available $pool)
|
||||||
typeset -i volsize=$poolsize
|
typeset volsize=$poolsize
|
||||||
typeset -i nvolsize
|
typeset nvolsize
|
||||||
|
|
||||||
while :; do
|
while :; do
|
||||||
# knock 50M off the volsize each time through
|
# knock 50M off the volsize each time through
|
||||||
|
@ -70,13 +70,13 @@ sparsevol=$TESTPOOL/$TESTVOL2
|
|||||||
log_must $ZFS create -V 64M $regvol
|
log_must $ZFS create -V 64M $regvol
|
||||||
log_must $ZFS create -s -V 64M $sparsevol
|
log_must $ZFS create -s -V 64M $sparsevol
|
||||||
|
|
||||||
typeset -i vsize=$(get_prop available $TESTPOOL)
|
typeset vsize=$(get_prop available $TESTPOOL)
|
||||||
typeset -i iterate=10
|
typeset iterate=10
|
||||||
typeset -i regreserv
|
typeset regreserv
|
||||||
typeset -i sparsereserv
|
typeset sparsereserv
|
||||||
typeset -i volblocksize=$(get_prop volblocksize $regvol)
|
typeset volblocksize=$(get_prop volblocksize $regvol)
|
||||||
typeset -i blknum=0
|
typeset blknum=0
|
||||||
typeset -i randomblknum
|
typeset randomblknum
|
||||||
((blknum = vsize / volblocksize))
|
((blknum = vsize / volblocksize))
|
||||||
|
|
||||||
while ((iterate > 1)); do
|
while ((iterate > 1)); do
|
||||||
|
@ -60,7 +60,7 @@ fs_child=$TESTPOOL/$TESTFS/$TESTFS
|
|||||||
|
|
||||||
space_avail=$(get_prop available $fs)
|
space_avail=$(get_prop available $fs)
|
||||||
reserv_val=$(get_prop reservation $fs)
|
reserv_val=$(get_prop reservation $fs)
|
||||||
typeset -l reservsize=$space_avail
|
typeset reservsize=$space_avail
|
||||||
((reservsize = reservsize / 2))
|
((reservsize = reservsize / 2))
|
||||||
log_must $ZFS set reservation=$reservsize $fs
|
log_must $ZFS set reservation=$reservsize $fs
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user