From nobody Tue Feb 10 00:02:31 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1567517962; cv=none; d=zoho.com; s=zohoarc; b=P3RYVMfeZk/sIKINIZQz+N4xiKLIn9nX/7dKMh5q+Ghp06F8ebBHYTvvWE/hr8wvMs4ER/2Ed9z9EAJ5KJhqzTjAPuo/CfRyNJwXjKvobbKNZCJZyu8lFP/efbXDneBcT40BJoUH6YEFM2P1PoxLnXQCGhHhdHL049Xs6lm5oIs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1567517962; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=3XQG7TokpNOtvXIuI6mE6XdQ337M7AHjETWNqKoD/R0=; b=d8hW/7jCk5ba7nVZys8Q/401+0tPoTrXMV7i/BSnHEJtW8+pzz03Z1w0Gta/1L4nYkYkTGyYgu0dDT1LE/Du7Qww46WzVTpJFbikMEwBVEyvSpw+XHRPTBPQ7MS1DUalquLeA4rV2AKptYEMJ4SZQkRX7J0if4jZHfua2LLpw8I= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1567517962847354.55207660984684; Tue, 3 Sep 2019 06:39:22 -0700 (PDT) Received: from localhost ([::1]:46286 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i591l-0005CH-8Y for importer@patchew.org; Tue, 03 Sep 2019 09:39:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55791) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i58yf-0002CB-U3 for qemu-devel@nongnu.org; Tue, 03 Sep 2019 09:36:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i58ye-0006G5-HP for qemu-devel@nongnu.org; Tue, 03 Sep 2019 09:36:09 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54532) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i58yb-0006Cb-VB; Tue, 03 Sep 2019 09:36:06 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 421D189810B; Tue, 3 Sep 2019 13:36:05 +0000 (UTC) Received: from localhost (ovpn-204-98.brq.redhat.com [10.40.204.98]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CCA3E60C63; Tue, 3 Sep 2019 13:36:04 +0000 (UTC) From: Max Reitz To: qemu-block@nongnu.org Date: Tue, 3 Sep 2019 15:35:41 +0200 Message-Id: <20190903133553.6500-5-mreitz@redhat.com> In-Reply-To: <20190903133553.6500-1-mreitz@redhat.com> References: <20190903133553.6500-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.67]); Tue, 03 Sep 2019 13:36:05 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL v2 04/16] iotests: Test allocate_first_block() with O_DIRECT X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , qemu-devel@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Nir Soffer Using block_resize we can test allocate_first_block() with file descriptor opened with O_DIRECT, ensuring that it works for any size larger than 4096 bytes. Testing smaller sizes is tricky as the result depends on the filesystem used for testing. For example on NFS any size will work since O_DIRECT does not require any alignment. Signed-off-by: Nir Soffer Reviewed-by: Max Reitz Message-id: 20190827010528.8818-3-nsoffer@redhat.com Signed-off-by: Max Reitz --- tests/qemu-iotests/175 | 28 ++++++++++++++++++++++++++++ tests/qemu-iotests/175.out | 8 ++++++++ 2 files changed, 36 insertions(+) diff --git a/tests/qemu-iotests/175 b/tests/qemu-iotests/175 index 7ba28b3c1b..55db2803ed 100755 --- a/tests/qemu-iotests/175 +++ b/tests/qemu-iotests/175 @@ -49,6 +49,23 @@ _filter_blocks() -e "s/blocks=3D$((extra_blocks + img_size / 512))\\(\$\\|[^0-9]\\)= /max allocation/" } =20 +# Resize image using block_resize. +# Parameter 1: image path +# Parameter 2: new size +_block_resize() +{ + local path=3D$1 + local size=3D$2 + + $QEMU -qmp stdio -nographic -nodefaults \ + -blockdev file,node-name=3Dfile,filename=3D$path,cache.direct=3Don= \ + </dev/null + stat -c "size=3D%s, blocks=3D%b" $TEST_IMG | _filter_blocks $extra_blo= cks $min_blocks $new_size +done + # success, all done echo "*** done" rm -f $seq.full diff --git a/tests/qemu-iotests/175.out b/tests/qemu-iotests/175.out index 263e521262..39c2ee0f62 100644 --- a/tests/qemu-iotests/175.out +++ b/tests/qemu-iotests/175.out @@ -15,4 +15,12 @@ size=3D1048576, max allocation =3D=3D creating image with preallocation falloc =3D=3D Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1048576 preallocation= =3Dfalloc size=3D1048576, max allocation + +=3D=3D resize empty image with block_resize =3D=3D +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D0 +size=3D4096, min allocation + +=3D=3D resize empty image with block_resize =3D=3D +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D0 +size=3D1048576, min allocation *** done --=20 2.21.0