[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [PATCH v8 8/9] qcow2: skip writing zero buffers to empt
From: |
Alberto Garcia |
Subject: |
Re: [Qemu-block] [PATCH v8 8/9] qcow2: skip writing zero buffers to empty COW areas |
Date: |
Fri, 16 Mar 2018 14:58:58 +0100 |
User-agent: |
Notmuch/0.18.2 (http://notmuchmail.org) Emacs/24.4.1 (i586-pc-linux-gnu) |
On Mon 12 Mar 2018 11:16:57 AM CET, Anton Nefedov wrote:
> --- a/qapi/block-core.json
> +++ b/qapi/block-core.json
> @@ -2584,6 +2584,8 @@
> #
> # @cor_write: a write due to copy-on-read (since 2.11)
> #
> +# @cluster_alloc_space: an allocation of a cluster file space (since 2.12)
That doesn't sound like correct English to me.
> +static bool is_unallocated(BlockDriverState *bs, int64_t offset, int64_t
> bytes)
> +{
> + int64_t nr;
> + return !bytes ||
> + (!bdrv_is_allocated_above(bs, NULL, offset, bytes, &nr) && nr ==
> bytes);
> +}
> +
Is this really more efficient than the previous is_zero() call ?
It seems that in both cases the code ends up calling
bdrv_common_block_status_above().
> +static bool is_zero_cow(BlockDriverState *bs, QCowL2Meta *m)
> +{
> + /* content with false negatives, giving is_allocated() is faster than
> + * a proper zero detection with possible actual image seeks, which is
> + * performed by is_zero() */
It took me a bit to understand this sentence, maybe some native English
speaker can suggest an alternate wording?
"is_allocated() is not as accurate as is_zero() and can give us some
false negatives, but it is much more efficient so let's use it here"
> + return is_unallocated(bs, m->offset + m->cow_start.offset,
> + m->cow_start.nb_bytes) &&
> + is_unallocated(bs, m->offset + m->cow_end.offset,
> + m->cow_end.nb_bytes);
> +}
Berto
- Re: [Qemu-block] [PATCH v8 1/9] mirror: inherit supported write/zero flags, (continued)
- [Qemu-block] [PATCH v8 4/9] block: introduce BDRV_REQ_ALLOCATE flag, Anton Nefedov, 2018/03/12
- [Qemu-block] [PATCH v8 3/9] quorum: set supported write/zero flags, Anton Nefedov, 2018/03/12
- [Qemu-block] [PATCH v8 9/9] iotest 134: test cluster-misaligned encrypted write, Anton Nefedov, 2018/03/12
- [Qemu-block] [PATCH v8 6/9] file-posix: support BDRV_REQ_ALLOCATE, Anton Nefedov, 2018/03/12
- [Qemu-block] [PATCH v8 8/9] qcow2: skip writing zero buffers to empty COW areas, Anton Nefedov, 2018/03/12
- Re: [Qemu-block] [PATCH v8 8/9] qcow2: skip writing zero buffers to empty COW areas,
Alberto Garcia <=
- [Qemu-block] [PATCH v8 5/9] block: treat BDRV_REQ_ALLOCATE as serialising, Anton Nefedov, 2018/03/12
- [Qemu-block] [PATCH v8 7/9] block: support BDRV_REQ_ALLOCATE in passthrough drivers, Anton Nefedov, 2018/03/12