From: Fam Zheng <famz@redhat.com>
To: Hu Tao <hutao@cn.fujitsu.com>, Kevin Wolf <kwolf@redhat.com>,
"Daniel P. Berrange" <berrange@redhat.com>,
Peter Lieven <pl@kamp.de>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [RFC PATCH v2 2/6] block: add BlockDriver.bdrv_preallocate.
Date: Wed, 27 Nov 2013 10:35:48 +0800 [thread overview]
Message-ID: <52955A84.9020909@redhat.com> (raw)
In-Reply-To: <20cb22a124616b01eb6d8e901fbe8f2bc37b6e08.1385518315.git.hutao@cn.fujitsu.com>
On 2013年11月27日 10:15, Hu Tao wrote:
> This field is used to preallocate disk space for block
> device.
>
> Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
> ---
> block.c | 13 +++++++++++++
> include/block/block.h | 1 +
> include/block/block_int.h | 3 +++
> 3 files changed, 17 insertions(+)
>
> diff --git a/block.c b/block.c
> index 382ea71..3985133 100644
> --- a/block.c
> +++ b/block.c
> @@ -3102,6 +3102,19 @@ int bdrv_has_zero_init(BlockDriverState *bs)
> return 0;
> }
>
> +int bdrv_preallocate(BlockDriverState *bs, int64_t offset, int64_t length)
> +{
> + if (bs->backing_hd) {
> + return -1;
Better to use -ENOTSUP.
> + }
> +
> + if (bs->drv->bdrv_preallocate) {
> + return bs->drv->bdrv_preallocate(bs, offset, length);
> + }
> +
> + return -1;
-ENOTSUP
Fam
> +}
> +
> typedef struct BdrvCoGetBlockStatusData {
> BlockDriverState *bs;
> BlockDriverState *base;
> diff --git a/include/block/block.h b/include/block/block.h
> index 461eaa4..8d48c8a 100644
> --- a/include/block/block.h
> +++ b/include/block/block.h
> @@ -315,6 +315,7 @@ void bdrv_drain_all(void);
> int bdrv_discard(BlockDriverState *bs, int64_t sector_num, int nb_sectors);
> int bdrv_co_discard(BlockDriverState *bs, int64_t sector_num, int nb_sectors);
> int bdrv_has_zero_init_1(BlockDriverState *bs);
> +int bdrv_preallocate(BlockDriverState *bs, int64_t offset, int64_t length);
> int bdrv_has_zero_init(BlockDriverState *bs);
> int64_t bdrv_get_block_status(BlockDriverState *bs, int64_t sector_num,
> int nb_sectors, int *pnum);
> diff --git a/include/block/block_int.h b/include/block/block_int.h
> index 1666066..6ac3735 100644
> --- a/include/block/block_int.h
> +++ b/include/block/block_int.h
> @@ -227,6 +227,9 @@ struct BlockDriver {
> */
> int (*bdrv_has_zero_init)(BlockDriverState *bs);
>
> + int (*bdrv_preallocate)(BlockDriverState *bs, int64_t offset,
> + int64_t length);
> +
> QLIST_ENTRY(BlockDriver) list;
> };
>
>
next prev parent reply other threads:[~2013-11-27 2:36 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-27 2:15 [Qemu-devel] [RFC PATCH v2 0/6] qemu-img: add preallocation=full Hu Tao
2013-11-27 2:15 ` [Qemu-devel] [RFC PATCH v2 1/6] block: introduce prealloc_mode Hu Tao
2013-11-27 2:15 ` [Qemu-devel] [RFC PATCH v2 2/6] block: add BlockDriver.bdrv_preallocate Hu Tao
2013-11-27 2:35 ` Fam Zheng [this message]
2013-11-27 2:15 ` [Qemu-devel] [RFC PATCH v2 3/6] block/raw-posix: implement bdrv_preallocate Hu Tao
2013-11-27 2:40 ` Fam Zheng
2013-11-27 2:15 ` [Qemu-devel] [RFC PATCH v2 4/6] raw-posix: Add full image preallocation option Hu Tao
2013-11-27 2:15 ` [Qemu-devel] [RFC PATCH v2 5/6] qcow2: implement bdrv_preallocate Hu Tao
2013-11-27 3:01 ` Fam Zheng
2013-11-27 6:01 ` Hu Tao
2013-11-27 6:40 ` Fam Zheng
2013-11-27 10:03 ` Peter Lieven
2013-11-27 10:07 ` Fam Zheng
2013-11-27 10:13 ` Peter Lieven
2013-11-28 8:48 ` Hu Tao
2013-11-28 10:03 ` Peter Lieven
2013-12-11 7:33 ` Hu Tao
2013-12-16 8:24 ` Hu Tao
2013-12-16 9:21 ` Fam Zheng
2013-12-17 2:03 ` Hu Tao
2013-11-27 2:15 ` [Qemu-devel] [RFC PATCH v2 6/6] qcow2: Add full image preallocation option Hu Tao
2013-11-27 3:22 ` [Qemu-devel] [RFC PATCH v2 0/6] qemu-img: add preallocation=full 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=52955A84.9020909@redhat.com \
--to=famz@redhat.com \
--cc=berrange@redhat.com \
--cc=hutao@cn.fujitsu.com \
--cc=kwolf@redhat.com \
--cc=pl@kamp.de \
--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).