From: Pankaj Raghav Date: Thu, 24 Oct 2024 11:23:10 +0000 (+0200) Subject: generic/219: use filesystem blocksize while calculating the file size X-Git-Tag: xfs-zoned-2024-11-18~75 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=b71de9073a655a01941beb9e40a45c56cfd3bb38;p=users%2Fhch%2Fxfstests-dev.git generic/219: use filesystem blocksize while calculating the file size generic/219 was failing for XFS with 32k and 64k blocksize. Even though we do only 48k IO, XFS will allocate blocks rounded to the nearest blocksize. Signed-off-by: Pankaj Raghav Reviewed-by: Darrick J. Wong Reviewed-by: Zorro Lang Signed-off-by: Zorro Lang --- diff --git a/tests/generic/219 b/tests/generic/219 index 940b902e8..d72aa745f 100755 --- a/tests/generic/219 +++ b/tests/generic/219 @@ -49,12 +49,24 @@ check_usage() fi } +_round_up_to_fs_blksz() +{ + local n=$1 + local bs=$(_get_file_block_size "$SCRATCH_MNT") + local bs_kb=$(( bs >> 10 )) + + echo $(( (n + bs_kb - 1) & ~(bs_kb - 1) )) +} + test_accounting() { - echo "### some controlled buffered, direct and mmapd IO (type=$type)" - echo "--- initiating parallel IO..." >>$seqres.full # Small ios here because ext3 will account for indirect blocks too ... # 48k will fit w/o indirect for 4k blocks (default blocksize) + io_sz=$(_round_up_to_fs_blksz 48) + sz=$(( io_sz * 3 )) + + echo "### some controlled buffered, direct and mmapd IO (type=$type)" + echo "--- initiating parallel IO..." >>$seqres.full $XFS_IO_PROG -c 'pwrite 0 48k' -c 'fsync' \ $SCRATCH_MNT/buffer >>$seqres.full 2>&1 & $XFS_IO_PROG -c 'pwrite 0 48k' -d \ @@ -73,7 +85,7 @@ test_accounting() else id=$qa_group fi - repquota -$type $SCRATCH_MNT | grep "^$id" | check_usage 144 3 + repquota -$type $SCRATCH_MNT | grep "^$id" | check_usage $sz 3 }