From: Peter Lieven <pl@kamp.de>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, aliguori@us.ibm.com, jcody@redhat.com,
Peter Lieven <pl@kamp.de>,
stefanha@redhat.com, pbonzini@redhat.com
Subject: [Qemu-devel] [PATCH] block/vpc: fix virtual size for images created with disk2vhd
Date: Mon, 21 Oct 2013 16:00:18 +0200 [thread overview]
Message-ID: <1382364019-15651-1-git-send-email-pl@kamp.de> (raw)
Signed-off-by: Peter Lieven <pl@kamp.de>
---
block/vpc.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/block/vpc.c b/block/vpc.c
index b5dca39..1acc1d4 100644
--- a/block/vpc.c
+++ b/block/vpc.c
@@ -211,6 +211,15 @@ static int vpc_open(BlockDriverState *bs, QDict *options, int flags,
bs->total_sectors = (int64_t)
be16_to_cpu(footer->cyls) * footer->heads * footer->secs_per_cyl;
+ /* images created with disk2vhd report a far higher virtual size
+ * than expected with the cyls * heads * sectors_per_cyl formula.
+ * use the footer->size instead if the image was created with
+ * disk2vhd.
+ */
+ if (!strncmp(footer->creator_app, "d2v", 4)) {
+ bs->total_sectors = be64_to_cpu(footer->size) / BDRV_SECTOR_SIZE;
+ }
+
/* Allow a maximum disk size of approximately 2 TB */
if (bs->total_sectors >= 65535LL * 255 * 255) {
ret = -EFBIG;
--
1.7.9.5
next reply other threads:[~2013-10-21 14:01 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-21 14:00 Peter Lieven [this message]
2013-11-06 12:47 ` [Qemu-devel] [PATCH] block/vpc: fix virtual size for images created with disk2vhd Stefan Hajnoczi
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=1382364019-15651-1-git-send-email-pl@kamp.de \
--to=pl@kamp.de \
--cc=aliguori@us.ibm.com \
--cc=jcody@redhat.com \
--cc=kwolf@redhat.com \
--cc=pbonzini@redhat.com \
--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).