]> www.infradead.org Git - users/hch/xfstests-dev.git/commitdiff
generic/219: use filesystem blocksize while calculating the file size
authorPankaj Raghav <p.raghav@samsung.com>
Thu, 24 Oct 2024 11:23:10 +0000 (13:23 +0200)
committerZorro Lang <zlang@kernel.org>
Fri, 25 Oct 2024 16:58:59 +0000 (00:58 +0800)
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 <p.raghav@samsung.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
tests/generic/219

index 940b902e84d4afdbdf2a1c165c47e8f287af7bd6..d72aa745fdfcf14e0fcc0ddceb011bd06de80ef3 100755 (executable)
@@ -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
 }