qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Max Reitz <mreitz@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>
Cc: vsementsov@virtuozzo.com, jsnow@redhat.com,
	qemu-devel@nongnu.org, qemu-block@nongnu.org
Subject: Re: [PATCH v2 1/4] iotests/109: Don't mirror with mismatched size
Date: Mon, 11 May 2020 17:37:17 +0200	[thread overview]
Message-ID: <e46c5b22-1e5e-384f-7ad4-00785118d207@redhat.com> (raw)
In-Reply-To: <20200511152942.GE5661@linux.fritz.box>


[-- Attachment #1.1: Type: text/plain, Size: 2077 bytes --]

On 11.05.20 17:29, Kevin Wolf wrote:
> Am 11.05.2020 um 17:08 hat Max Reitz geschrieben:
>> On 11.05.20 15:58, Kevin Wolf wrote:
>>> This patch makes the raw image the same size as the file in a different
>>> format that is mirrored as raw to it to avoid errors when mirror starts
>>> to enforce that source and target are the same size.
>>>
>>> We check only that the first 512 bytes are zeroed (instead of 64k)
>>> because some image formats create image files that are smaller than 64k,
>>> so trying to read 64k would result in I/O errors. Apart from this, 512
>>> is more appropriate anyway because the raw format driver protects
>>> specifically the first 512 bytes.
>>>
>>> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
>>> ---
>>>  tests/qemu-iotests/109           | 10 ++---
>>>  tests/qemu-iotests/109.out       | 74 +++++++++++++-------------------
>>>  tests/qemu-iotests/common.filter |  5 +++
>>>  3 files changed, 41 insertions(+), 48 deletions(-)
>>>
>>> diff --git a/tests/qemu-iotests/109 b/tests/qemu-iotests/109
>>> index 5bc2e9b001..3ffeaf3c55 100755
>>> --- a/tests/qemu-iotests/109
>>> +++ b/tests/qemu-iotests/109
>>> @@ -77,14 +77,14 @@ for fmt in qcow qcow2 qed vdi vmdk vpc; do
>>>      echo "=== Writing a $fmt header into raw ==="
>>>      echo
>>>  
>>> -    _make_test_img 64M
>>>      TEST_IMG="$TEST_IMG.src" IMGFMT=$fmt _make_test_img 64M
>>> +    _make_test_img $(du -b "$TEST_IMG.src" | cut -f1) | _filter_img_create_size
>>
>> Why du and not the file length (stat -c '%s')?
> 
> Because the test from which I copied had 'du' and the internet claimed
> that 'stat -c' isn't portable. Now I see that we do use it in other test
> cases, so I guess it would have been fine, too. Is there a good reason
> why 'stat' would be better?

Oh, I didn’t know that du -b reports the file length.  Well, then that
works, too.  (I’ve never seen du used for anything but getting the,
well, disk usage.)

(I figured -b would just report the size in bytes.)

Then:

Reviewed-by: Max Reitz <mreitz@redhat.com>


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2020-05-11 15:40 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-11 13:58 [PATCH v2 0/4] mirror: Make sure that source and target size match Kevin Wolf
2020-05-11 13:58 ` [PATCH v2 1/4] iotests/109: Don't mirror with mismatched size Kevin Wolf
2020-05-11 15:08   ` Max Reitz
2020-05-11 15:29     ` Kevin Wolf
2020-05-11 15:37       ` Max Reitz [this message]
2020-05-12 15:00   ` Vladimir Sementsov-Ogievskiy
2020-05-11 13:58 ` [PATCH v2 2/4] iotests/229: Use blkdebug to inject an error Kevin Wolf
2020-05-11 15:18   ` Max Reitz
2020-05-11 15:33     ` Kevin Wolf
2020-05-12 15:54   ` Vladimir Sementsov-Ogievskiy
2020-05-11 13:58 ` [PATCH v2 3/4] mirror: Make sure that source and target size match Kevin Wolf
2020-05-11 15:32   ` Max Reitz
2020-05-12 17:15   ` Vladimir Sementsov-Ogievskiy
2020-05-12 17:16     ` Vladimir Sementsov-Ogievskiy
2020-05-12 18:48     ` Kevin Wolf
2020-05-13 10:44       ` Vladimir Sementsov-Ogievskiy
2020-05-11 13:58 ` [PATCH v2 4/4] iotests: Mirror with different source/target size Kevin Wolf
2020-05-11 15:42   ` Max Reitz
2020-05-13 11:17   ` Vladimir Sementsov-Ogievskiy
2020-05-13 14:21     ` Kevin Wolf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e46c5b22-1e5e-384f-7ad4-00785118d207@redhat.com \
    --to=mreitz@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=vsementsov@virtuozzo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).