From: Kevin Wolf <kwolf@redhat.com>
To: 김태하 <thlab.kim@samsung.com>
Cc: kthguru@gmail.net, qemu-devel@nongnu.org, qemu-block@nongnu.org
Subject: Re: [Qemu-devel] [Qemu-block][PATCH]block/truncate: qcow2’s resize status is not showed to
Date: Wed, 15 Jul 2015 10:50:09 +0200 [thread overview]
Message-ID: <20150715085009.GA3582@noname.redhat.com> (raw)
In-Reply-To: <1310916852.125556.1436925467887.JavaMail.weblogic@mdmob08>
Am 15.07.2015 um 03:57 hat 김태하 geschrieben:
> To put it briefly, when resize qcow2 image, the "file" tool detected increased
> size. However, the "ls", “stat”, and “du” utility still don't know increased
> size. The following patch enables to let userland tools - ls, du, stat - know
> and apply changed size after resizing qcow2 image created by the qemu-img tool.
> Currently, can know only using “file” utility without this patch.
Even your goal is already wrong. For any image format other than raw,
the file size doesn't represent the virtual disk size. It's just the
size that the image file actually takes on the host, and that's
something entirely different.
The correct way to check the virtual disk size is 'qemu-img info'.
> ======================
>
> Signed-off-by: Taeha Kim <thlab.kim@samsung.com>
>
> diff --git a/block.c b/block.c
> index 5e80336..277adf3 100644
> --- a/block.c
> +++ b/block.c
> @@ -2473,6 +2473,9 @@ int bdrv_truncate(BlockDriverState *bs, int64_t offset)
> if (bs->blk) {
> blk_dev_resize_cb(bs->blk);
> }
> + if (ret == 0) {
> + ret = truncate(bs->filename, offset);
> + }
> }
> return ret;
> }
Even if your goal were right, this wouldn't work because images don't
have to be local files.
And to be clear: Truncating the image file is not only misguided and
unnecessary, but it will actively corrupt image files, because qcow2
images can be larger than the virtual disk size (e.g. if you have taken
some snapshots). In this case you would destroy the image by throwing
away part of it.
Kevin
parent reply other threads:[~2015-07-15 8:50 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <1310916852.125556.1436925467887.JavaMail.weblogic@mdmob08>]
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=20150715085009.GA3582@noname.redhat.com \
--to=kwolf@redhat.com \
--cc=kthguru@gmail.net \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=thlab.kim@samsung.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).