qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Fam Zheng <famz@redhat.com>
Cc: qemu-devel@nongnu.org, Jeff Cody <jcody@redhat.com>,
	Max Reitz <mreitz@redhat.com>,
	qemu-block@nongnu.org
Subject: Re: [Qemu-devel] [PATCH for-2.6 v2 1/3] mirror: Don't extend the last sub-chunk
Date: Wed, 20 Apr 2016 16:03:52 +0200	[thread overview]
Message-ID: <20160420140352.GM6517@noname.str.redhat.com> (raw)
In-Reply-To: <1461120516-14569-2-git-send-email-famz@redhat.com>

Am 20.04.2016 um 04:48 hat Fam Zheng geschrieben:
> The last sub-chunk is rounded up to the copy granularity in the target
> image, resulting in a larger size than the source.
> 
> Add a function to clip the copied sectors to the end.
> 
> This undoes the "wrong" changes to tests/qemu-iotests/109.out in
> e5b43573e28. The remaining two offset changes are okay.
> 
> Reported-by: Kevin Wolf <kwolf@redhat.com>
> Signed-off-by: Fam Zheng <famz@redhat.com>

I think you're missing at least one place where we need DIV_ROUND_UP
now. Specifically I'm talking about the calculation of nb_chunks in
mirror_iteration_done(), which causes the partial last cluster to stay
marked as in-flight forever.

I would also have used DIV_ROUND_UP in mirror_iteration(), but there we
have a sector_num < end check which saves us from an endless loop.

In order to reproduce the bug, this hangs for me without DIV_ROUND_UP:

$ ls -l /tmp/test.raw
-rw-r--r--. 1 kwolf kwolf 1049600 20. Apr 15:57 /tmp/test.raw
$ (echo -e "drive_mirror none0 /tmp/copy.raw raw\n"; sleep 1; echo -e 'qemu-io none0 "write 1M 512"\nblock_job_complete none0\nquit') | x86_64-softmmu/qemu-system-x86_64 -drive if=none,file=/tmp/test.raw -monitor stdio

Kevin

  reply	other threads:[~2016-04-20 14:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-20  2:48 [Qemu-devel] [PATCH for-2.6 v2 0/3] block: Fix drive-mirror with image size unaligned with granularity Fam Zheng
2016-04-20  2:48 ` [Qemu-devel] [PATCH for-2.6 v2 1/3] mirror: Don't extend the last sub-chunk Fam Zheng
2016-04-20 14:03   ` Kevin Wolf [this message]
2016-04-20  2:48 ` [Qemu-devel] [PATCH for-2.6 v2 2/3] iotests: Add iotests.image_size Fam Zheng
2016-04-20  2:48 ` [Qemu-devel] [PATCH for-2.6 v2 3/3] iotests: Test case for drive-mirror with unaligned image size Fam Zheng

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=20160420140352.GM6517@noname.str.redhat.com \
    --to=kwolf@redhat.com \
    --cc=famz@redhat.com \
    --cc=jcody@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /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).