[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v3 1/6] mirror: Do zero write on target if secto
From: |
Fam Zheng |
Subject: |
Re: [Qemu-devel] [PATCH v3 1/6] mirror: Do zero write on target if sectors not allocated |
Date: |
Thu, 14 May 2015 21:52:08 +0800 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
On Thu, 05/14 12:30, Paolo Bonzini wrote:
>
>
> On 12/05/2015 13:48, Fam Zheng wrote:
> > + if (!bdrv_is_allocated_above(source, NULL, sector_num,
> > + nb_sectors, &pnum)) {
> > + op->nb_sectors = pnum;
> > + if (s->source_may_unmap) {
>
> Can you avoid this check by introducing bdrv_get_block_status_above? Then:
>
> - if BDRV_ZERO, you use bdrv_aio_write_zeroes
>
> - if BDRV_ALLOCATED, you use bdrv_aio_readv
>
> - else you use bdrv_aio_discard
OK, that's better.
>
> > + /*
> > + * Source unallocated sectors have zero data. We can't discard
> > + * target even if s->target_may_unmap, because the discard
> > + * granularity may be different.
> > + */
> > + bdrv_aio_write_zeroes(s->target, sector_num, op->nb_sectors,
> > + s->target_may_unmap ? BDRV_REQ_MAY_UNMAP
> > : 0,
>
> You can set the flag unconditionally. But it's probably better to make
> this a drive-mirror argument instead of checking the target's
> BlockDriverInfo.
OK, I'll add a flag.
Fam
- [Qemu-devel] [PATCH v3 0/6] block: Mirror discarded sectors, Fam Zheng, 2015/05/12
- [Qemu-devel] [PATCH v3 1/6] mirror: Do zero write on target if sectors not allocated, Fam Zheng, 2015/05/12
- [Qemu-devel] [PATCH v3 2/6] block: Fix dirty bitmap in bdrv_co_discard, Fam Zheng, 2015/05/12
- [Qemu-devel] [PATCH v3 3/6] block: Remove bdrv_reset_dirty, Fam Zheng, 2015/05/12
- [Qemu-devel] [PATCH v3 4/6] qemu-iotests: Make block job methods common, Fam Zheng, 2015/05/12
- [Qemu-devel] [PATCH v3 6/6] iotests: Use event_wait in wait_ready, Fam Zheng, 2015/05/12
- [Qemu-devel] [PATCH v3 5/6] qemu-iotests: Add test case for mirror with unmap, Fam Zheng, 2015/05/12
- Re: [Qemu-devel] [PATCH v3 0/6] block: Mirror discarded sectors, Fam Zheng, 2015/05/14