On 07.08.19 10:07, Vladimir Sementsov-Ogievskiy wrote: > backup_cow_with_offload can transfer more than on cluster. Let > backup_cow_with_bounce_buffer behave similarly. It reduces number > of IO and there are no needs to copy cluster by cluster. > > Signed-off-by: Vladimir Sementsov-Ogievskiy <vsement...@virtuozzo.com> > --- > block/backup.c | 30 +++++++++++++++--------------- > 1 file changed, 15 insertions(+), 15 deletions(-) > > diff --git a/block/backup.c b/block/backup.c > index eb41e4af4f..c765c073ad 100644 > --- a/block/backup.c > +++ b/block/backup.c > @@ -104,22 +104,24 @@ static int coroutine_fn > backup_cow_with_bounce_buffer(BackupBlockJob *job, > int64_t start, > int64_t end, > bool is_write_notifier, > - bool *error_is_read, > - void **bounce_buffer) > + bool *error_is_read) > { > int ret; > BlockBackend *blk = job->common.blk; > int nbytes; > int read_flags = is_write_notifier ? BDRV_REQ_NO_SERIALISING : 0; > + void *bounce_buffer = blk_try_blockalign(blk, end);
s/end/end - start/ (or probably rather s/end/nbytes/ after that has been set). Rest looks good. Max > > - assert(QEMU_IS_ALIGNED(start, job->cluster_size)); > - bdrv_reset_dirty_bitmap(job->copy_bitmap, start, job->cluster_size); > - nbytes = MIN(job->cluster_size, job->len - start); > - if (!*bounce_buffer) { > - *bounce_buffer = blk_blockalign(blk, job->cluster_size); > + if (!bounce_buffer) { > + return -ENOMEM; > }
signature.asc
Description: OpenPGP digital signature