On 09/09/2016 07:31 AM, Denis V. Lunev wrote: > bdrv_is_allocated_above() returns true in the case even for completel
s/completel/completely/ > zeroed areas as BDRV_BLOCK_ALLOCATED flag is set in both cases. > > The patch stops using bdrv_is_allocated_above() wrapper and switches to > bdrv_get_block_status_above() to distinguish zeroed areas and areas with > data to avoid extra IO operations if possible. > > Signed-off-by: Denis V. Lunev <d...@openvz.org> > CC: Stefan Hajnoczi <stefa...@redhat.com> > CC: Fam Zheng <f...@redhat.com> > CC: Kevin Wolf <kw...@redhat.com> > CC: Max Reitz <mre...@redhat.com> > CC: Jeff Cody <jc...@redhat.com> > --- > block/mirror.c | 18 ++++++++++++------ > 1 file changed, 12 insertions(+), 6 deletions(-) > > @@ -597,13 +602,14 @@ static int coroutine_fn > mirror_dirty_init(MirrorBlockJob *s) > return 0; > } > > - ret = bdrv_is_allocated_above(bs, base, sector_num, nb_sectors, &n); > - if (ret < 0) { > - return ret; > + status = bdrv_get_block_status_above(bs, base, sector_num, > + nb_sectors, &n, &file); Eventually, we should probably fix bdrv_get_block_status_above() to be byte-based, but that's not a problem with this patch. Looks okay to me, but I haven't thought closely enough about potential corner cases to feel comfortable with giving R-b yet... -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature