[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [PATCH v12 1/2] mirror: Rewrite mirror_iteration
From: |
Max Reitz |
Subject: |
Re: [Qemu-block] [PATCH v12 1/2] mirror: Rewrite mirror_iteration |
Date: |
Sat, 6 Feb 2016 14:24:09 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 |
On 05.02.2016 03:00, Fam Zheng wrote:
> The "pnum < nb_sectors" condition in deciding whether to actually copy
> data is unnecessarily strict, and the qiov initialization is
> unnecessarily for bdrv_aio_write_zeroes and bdrv_aio_discard.
>
> Rewrite mirror_iteration to fix both flaws.
>
> The output of iotests 109 is updated because we now report the offset
> and len slightly differently in mirroring progress.
>
> Signed-off-by: Fam Zheng <address@hidden>
> ---
> block/mirror.c | 335
> +++++++++++++++++++++++++++------------------
> tests/qemu-iotests/109.out | 80 +++++------
> trace-events | 1 -
> 3 files changed, 243 insertions(+), 173 deletions(-)
>
> diff --git a/block/mirror.c b/block/mirror.c
> index 2c0edfa..48cd0b3 100644
> --- a/block/mirror.c
> +++ b/block/mirror.c
[...]
> @@ -449,16 +520,16 @@ static void coroutine_fn mirror_run(void *opaque)
> */
> bdrv_get_backing_filename(s->target, backing_filename,
> sizeof(backing_filename));
> - if (backing_filename[0] && !s->target->backing) {
> - ret = bdrv_get_info(s->target, &bdi);
> - if (ret < 0) {
> - goto immediate_exit;
> - }
> - if (s->granularity < bdi.cluster_size) {
> - s->buf_size = MAX(s->buf_size, bdi.cluster_size);
> - s->cow_bitmap = bitmap_new(length);
> - }
> + if (!bdrv_get_info(s->target, &bdi) && bdi.cluster_size) {
This should be bdi.has_cluster_size...
> + target_cluster_size = bdi.cluster_size;
...and maybe we want an explicit minimum of BDRV_SECTOR_SIZE here; but I
guess this is already assumed all over the block layer, so it may be
fine without.
> }
> + if (backing_filename[0] && !s->target->backing
> + && s->granularity < target_cluster_size) {
> + s->buf_size = MAX(s->buf_size, target_cluster_size);
> + s->cow_bitmap = bitmap_new(length);
> + }
> + s->target_cluster_sectors = target_cluster_size >> BDRV_SECTOR_BITS;
(this shouldn't be 0, so target_cluster_size needs to be at least
BDRV_SECTOR_SIZE)
Max
signature.asc
Description: OpenPGP digital signature
- [Qemu-block] [PATCH v12 0/2] mirror: Improve zero write and discard, Fam Zheng, 2016/02/04
- [Qemu-block] [PATCH v12 2/2] mirror: Add mirror_wait_for_io, Fam Zheng, 2016/02/04
- [Qemu-block] [PATCH v12 1/2] mirror: Rewrite mirror_iteration, Fam Zheng, 2016/02/04
- Re: [Qemu-block] [PATCH v12 1/2] mirror: Rewrite mirror_iteration,
Max Reitz <=
- Re: [Qemu-block] [PATCH v12 1/2] mirror: Rewrite mirror_iteration, Fam Zheng, 2016/02/07
- Re: [Qemu-block] [PATCH v12 1/2] mirror: Rewrite mirror_iteration, Max Reitz, 2016/02/08
- Re: [Qemu-block] [PATCH v12 1/2] mirror: Rewrite mirror_iteration, Fam Zheng, 2016/02/14
- Re: [Qemu-block] [Qemu-devel] [PATCH v12 1/2] mirror: Rewrite mirror_iteration, Jeff Cody, 2016/02/14
- Re: [Qemu-block] [Qemu-devel] [PATCH v12 1/2] mirror: Rewrite mirror_iteration, Fam Zheng, 2016/02/14