From: Fam Zheng <famz@redhat.com>
To: qemu-devel@nongnu.org
Cc: qemu-block@nongnu.org, Fam Zheng <famz@redhat.com>,
Kevin Wolf <kwolf@redhat.com>, Max Reitz <mreitz@redhat.com>,
Eric Blake <eblake@redhat.com>, John Snow <jsnow@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>
Subject: [Qemu-devel] [PATCH 1/2] block: Fix dst total_sectors after copy offloading
Date: Wed, 4 Jul 2018 14:13:19 +0800 [thread overview]
Message-ID: <20180704061320.2041-2-famz@redhat.com> (raw)
In-Reply-To: <20180704061320.2041-1-famz@redhat.com>
This was noticed by the new image fleecing tests case 222. The issue is
apparent and we should just do the same right things as in
bdrv_aligned_pwritev.
Reported-by: John Snow <jsnow@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
---
block/io.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/block/io.c b/block/io.c
index 1a2272fad3..8e02f4ab95 100644
--- a/block/io.c
+++ b/block/io.c
@@ -2945,6 +2945,10 @@ static int coroutine_fn bdrv_co_copy_range_internal(BdrvChild *src,
dst, dst_offset,
bytes, flags);
}
+ if (ret == 0) {
+ int64_t end_sector = DIV_ROUND_UP(dst_offset + bytes, BDRV_SECTOR_SIZE);
+ dst->bs->total_sectors = MAX(dst->bs->total_sectors, end_sector);
+ }
tracked_request_end(&src_req);
tracked_request_end(&dst_req);
bdrv_dec_in_flight(src->bs);
--
2.17.1
next prev parent reply other threads:[~2018-07-04 6:13 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-04 6:13 [Qemu-devel] [PATCH 0/2] block: Fix dst reading after tail copy offloading Fam Zheng
2018-07-04 6:13 ` Fam Zheng [this message]
2018-07-04 7:44 ` [Qemu-devel] [PATCH 1/2] block: Fix dst total_sectors after " Kevin Wolf
2018-07-04 8:42 ` Fam Zheng
2018-07-04 6:13 ` [Qemu-devel] [PATCH 2/2] block: Add copy offloading trace points 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=20180704061320.2041-2-famz@redhat.com \
--to=famz@redhat.com \
--cc=eblake@redhat.com \
--cc=jsnow@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.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).