From: Stefano Garzarella <sgarzare@redhat.com>
To: Max Reitz <mreitz@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
qemu-devel@nongnu.org, qemu-block@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v2 04/11] block: Implement .bdrv_has_zero_init_truncate()
Date: Fri, 26 Jul 2019 11:42:44 +0200 [thread overview]
Message-ID: <20190726094244.dyjwewyatjdptmex@steredhat> (raw)
In-Reply-To: <20190724171239.8764-5-mreitz@redhat.com>
On Wed, Jul 24, 2019 at 07:12:32PM +0200, Max Reitz wrote:
> We need to implement .bdrv_has_zero_init_truncate() for every block
> driver that supports truncation and has a .bdrv_has_zero_init()
> implementation.
>
> Implement it the same way each driver implements .bdrv_has_zero_init().
> This is at least not any more unsafe than what we had before.
>
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
> block/file-posix.c | 1 +
> block/file-win32.c | 1 +
> block/gluster.c | 4 ++++
> block/nfs.c | 1 +
> block/qcow2.c | 1 +
> block/qed.c | 1 +
> block/raw-format.c | 6 ++++++
> block/rbd.c | 1 +
> block/sheepdog.c | 1 +
> block/ssh.c | 1 +
> 10 files changed, 18 insertions(+)
>
LGTM.
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Thanks,
Stefano
> diff --git a/block/file-posix.c b/block/file-posix.c
> index 4479cc7ab4..0208006f3c 100644
> --- a/block/file-posix.c
> +++ b/block/file-posix.c
> @@ -2924,6 +2924,7 @@ BlockDriver bdrv_file = {
> .bdrv_co_create = raw_co_create,
> .bdrv_co_create_opts = raw_co_create_opts,
> .bdrv_has_zero_init = bdrv_has_zero_init_1,
> + .bdrv_has_zero_init_truncate = bdrv_has_zero_init_1,
> .bdrv_co_block_status = raw_co_block_status,
> .bdrv_co_invalidate_cache = raw_co_invalidate_cache,
> .bdrv_co_pwrite_zeroes = raw_co_pwrite_zeroes,
> diff --git a/block/file-win32.c b/block/file-win32.c
> index 6b2d67b239..41f55dfece 100644
> --- a/block/file-win32.c
> +++ b/block/file-win32.c
> @@ -635,6 +635,7 @@ BlockDriver bdrv_file = {
> .bdrv_close = raw_close,
> .bdrv_co_create_opts = raw_co_create_opts,
> .bdrv_has_zero_init = bdrv_has_zero_init_1,
> + .bdrv_has_zero_init_truncate = bdrv_has_zero_init_1,
>
> .bdrv_aio_preadv = raw_aio_preadv,
> .bdrv_aio_pwritev = raw_aio_pwritev,
> diff --git a/block/gluster.c b/block/gluster.c
> index f64dc5b01e..64028b2cba 100644
> --- a/block/gluster.c
> +++ b/block/gluster.c
> @@ -1567,6 +1567,7 @@ static BlockDriver bdrv_gluster = {
> .bdrv_co_writev = qemu_gluster_co_writev,
> .bdrv_co_flush_to_disk = qemu_gluster_co_flush_to_disk,
> .bdrv_has_zero_init = qemu_gluster_has_zero_init,
> + .bdrv_has_zero_init_truncate = qemu_gluster_has_zero_init,
> #ifdef CONFIG_GLUSTERFS_DISCARD
> .bdrv_co_pdiscard = qemu_gluster_co_pdiscard,
> #endif
> @@ -1598,6 +1599,7 @@ static BlockDriver bdrv_gluster_tcp = {
> .bdrv_co_writev = qemu_gluster_co_writev,
> .bdrv_co_flush_to_disk = qemu_gluster_co_flush_to_disk,
> .bdrv_has_zero_init = qemu_gluster_has_zero_init,
> + .bdrv_has_zero_init_truncate = qemu_gluster_has_zero_init,
> #ifdef CONFIG_GLUSTERFS_DISCARD
> .bdrv_co_pdiscard = qemu_gluster_co_pdiscard,
> #endif
> @@ -1629,6 +1631,7 @@ static BlockDriver bdrv_gluster_unix = {
> .bdrv_co_writev = qemu_gluster_co_writev,
> .bdrv_co_flush_to_disk = qemu_gluster_co_flush_to_disk,
> .bdrv_has_zero_init = qemu_gluster_has_zero_init,
> + .bdrv_has_zero_init_truncate = qemu_gluster_has_zero_init,
> #ifdef CONFIG_GLUSTERFS_DISCARD
> .bdrv_co_pdiscard = qemu_gluster_co_pdiscard,
> #endif
> @@ -1666,6 +1669,7 @@ static BlockDriver bdrv_gluster_rdma = {
> .bdrv_co_writev = qemu_gluster_co_writev,
> .bdrv_co_flush_to_disk = qemu_gluster_co_flush_to_disk,
> .bdrv_has_zero_init = qemu_gluster_has_zero_init,
> + .bdrv_has_zero_init_truncate = qemu_gluster_has_zero_init,
> #ifdef CONFIG_GLUSTERFS_DISCARD
> .bdrv_co_pdiscard = qemu_gluster_co_pdiscard,
> #endif
> diff --git a/block/nfs.c b/block/nfs.c
> index d93241b3bb..97c815085f 100644
> --- a/block/nfs.c
> +++ b/block/nfs.c
> @@ -863,6 +863,7 @@ static BlockDriver bdrv_nfs = {
> .create_opts = &nfs_create_opts,
>
> .bdrv_has_zero_init = nfs_has_zero_init,
> + .bdrv_has_zero_init_truncate = nfs_has_zero_init,
> .bdrv_get_allocated_file_size = nfs_get_allocated_file_size,
> .bdrv_co_truncate = nfs_file_co_truncate,
>
> diff --git a/block/qcow2.c b/block/qcow2.c
> index 039bdc2f7e..5c40f54d64 100644
> --- a/block/qcow2.c
> +++ b/block/qcow2.c
> @@ -5187,6 +5187,7 @@ BlockDriver bdrv_qcow2 = {
> .bdrv_co_create_opts = qcow2_co_create_opts,
> .bdrv_co_create = qcow2_co_create,
> .bdrv_has_zero_init = bdrv_has_zero_init_1,
> + .bdrv_has_zero_init_truncate = bdrv_has_zero_init_1,
> .bdrv_co_block_status = qcow2_co_block_status,
>
> .bdrv_co_preadv = qcow2_co_preadv,
> diff --git a/block/qed.c b/block/qed.c
> index 77c7cef175..daaedb6864 100644
> --- a/block/qed.c
> +++ b/block/qed.c
> @@ -1668,6 +1668,7 @@ static BlockDriver bdrv_qed = {
> .bdrv_co_create = bdrv_qed_co_create,
> .bdrv_co_create_opts = bdrv_qed_co_create_opts,
> .bdrv_has_zero_init = bdrv_has_zero_init_1,
> + .bdrv_has_zero_init_truncate = bdrv_has_zero_init_1,
> .bdrv_co_block_status = bdrv_qed_co_block_status,
> .bdrv_co_readv = bdrv_qed_co_readv,
> .bdrv_co_writev = bdrv_qed_co_writev,
> diff --git a/block/raw-format.c b/block/raw-format.c
> index bffd424dd0..42c28cc29a 100644
> --- a/block/raw-format.c
> +++ b/block/raw-format.c
> @@ -413,6 +413,11 @@ static int raw_has_zero_init(BlockDriverState *bs)
> return bdrv_has_zero_init(bs->file->bs);
> }
>
> +static int raw_has_zero_init_truncate(BlockDriverState *bs)
> +{
> + return bdrv_has_zero_init_truncate(bs->file->bs);
> +}
> +
> static int coroutine_fn raw_co_create_opts(const char *filename, QemuOpts *opts,
> Error **errp)
> {
> @@ -572,6 +577,7 @@ BlockDriver bdrv_raw = {
> .bdrv_co_ioctl = &raw_co_ioctl,
> .create_opts = &raw_create_opts,
> .bdrv_has_zero_init = &raw_has_zero_init,
> + .bdrv_has_zero_init_truncate = &raw_has_zero_init_truncate,
> .strong_runtime_opts = raw_strong_runtime_opts,
> .mutable_opts = mutable_opts,
> };
> diff --git a/block/rbd.c b/block/rbd.c
> index 59757b3120..057af43d48 100644
> --- a/block/rbd.c
> +++ b/block/rbd.c
> @@ -1288,6 +1288,7 @@ static BlockDriver bdrv_rbd = {
> .bdrv_co_create = qemu_rbd_co_create,
> .bdrv_co_create_opts = qemu_rbd_co_create_opts,
> .bdrv_has_zero_init = bdrv_has_zero_init_1,
> + .bdrv_has_zero_init_truncate = bdrv_has_zero_init_1,
> .bdrv_get_info = qemu_rbd_getinfo,
> .create_opts = &qemu_rbd_create_opts,
> .bdrv_getlength = qemu_rbd_getlength,
> diff --git a/block/sheepdog.c b/block/sheepdog.c
> index 6f402e5d4d..a4e111f981 100644
> --- a/block/sheepdog.c
> +++ b/block/sheepdog.c
> @@ -3228,6 +3228,7 @@ static BlockDriver bdrv_sheepdog = {
> .bdrv_co_create = sd_co_create,
> .bdrv_co_create_opts = sd_co_create_opts,
> .bdrv_has_zero_init = bdrv_has_zero_init_1,
> + .bdrv_has_zero_init_truncate = bdrv_has_zero_init_1,
> .bdrv_getlength = sd_getlength,
> .bdrv_get_allocated_file_size = sd_get_allocated_file_size,
> .bdrv_co_truncate = sd_co_truncate,
> diff --git a/block/ssh.c b/block/ssh.c
> index 501933b855..84d01e892b 100644
> --- a/block/ssh.c
> +++ b/block/ssh.c
> @@ -1390,6 +1390,7 @@ static BlockDriver bdrv_ssh = {
> .bdrv_co_create_opts = ssh_co_create_opts,
> .bdrv_close = ssh_close,
> .bdrv_has_zero_init = ssh_has_zero_init,
> + .bdrv_has_zero_init_truncate = ssh_has_zero_init,
> .bdrv_co_readv = ssh_co_readv,
> .bdrv_co_writev = ssh_co_writev,
> .bdrv_getlength = ssh_getlength,
> --
> 2.21.0
>
--
next prev parent reply other threads:[~2019-07-26 9:43 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-24 17:12 [Qemu-devel] [PATCH v2 00/11] block: Fix some things about bdrv_has_zero_init() Max Reitz
2019-07-24 17:12 ` [Qemu-devel] [PATCH v2 01/11] qemu-img: Fix bdrv_has_zero_init() use in convert Max Reitz
2019-07-25 15:28 ` Maxim Levitsky
2019-07-26 9:36 ` Stefano Garzarella
2019-07-24 17:12 ` [Qemu-devel] [PATCH v2 02/11] mirror: Fix bdrv_has_zero_init() use Max Reitz
2019-07-25 15:28 ` Maxim Levitsky
2019-07-25 16:21 ` Max Reitz
2019-07-25 16:24 ` Max Reitz
2019-07-24 17:12 ` [Qemu-devel] [PATCH v2 03/11] block: Add bdrv_has_zero_init_truncate() Max Reitz
2019-07-25 15:28 ` Maxim Levitsky
2019-07-26 9:04 ` Stefano Garzarella
2019-07-26 10:58 ` Max Reitz
2019-07-26 12:17 ` Stefano Garzarella
2019-07-24 17:12 ` [Qemu-devel] [PATCH v2 04/11] block: Implement .bdrv_has_zero_init_truncate() Max Reitz
2019-07-25 15:29 ` Maxim Levitsky
2019-07-26 9:42 ` Stefano Garzarella [this message]
2019-07-24 17:12 ` [Qemu-devel] [PATCH v2 05/11] block: Use bdrv_has_zero_init_truncate() Max Reitz
2019-07-25 15:29 ` Maxim Levitsky
2019-07-26 9:43 ` Stefano Garzarella
2019-07-26 11:00 ` Max Reitz
2019-07-24 17:12 ` [Qemu-devel] [PATCH v2 06/11] qcow2: Fix .bdrv_has_zero_init() Max Reitz
2019-07-25 15:29 ` Maxim Levitsky
2019-07-24 17:12 ` [Qemu-devel] [PATCH v2 07/11] vdi: " Max Reitz
2019-07-25 15:29 ` Maxim Levitsky
2019-07-24 17:12 ` [Qemu-devel] [PATCH v2 08/11] vhdx: " Max Reitz
2019-07-25 15:30 ` Maxim Levitsky
2019-07-24 17:12 ` [Qemu-devel] [PATCH v2 09/11] iotests: Convert to preallocated encrypted qcow2 Max Reitz
2019-07-25 15:30 ` Maxim Levitsky
2019-07-25 16:27 ` Max Reitz
2019-08-09 19:18 ` Max Reitz
2019-07-24 17:12 ` [Qemu-devel] [PATCH v2 10/11] iotests: Test convert -n to pre-filled image Max Reitz
2019-07-25 15:30 ` Maxim Levitsky
2019-07-24 17:12 ` [Qemu-devel] [PATCH v2 11/11] iotests: Full mirror to existing non-zero image Max Reitz
2019-08-09 19:31 ` [Qemu-devel] [PATCH v2 00/11] block: Fix some things about bdrv_has_zero_init() Max Reitz
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=20190726094244.dyjwewyatjdptmex@steredhat \
--to=sgarzare@redhat.com \
--cc=kwolf@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).