[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 12/14] backup: Use BlockBackend for I/O
From: |
Max Reitz |
Subject: |
Re: [Qemu-devel] [PATCH 12/14] backup: Use BlockBackend for I/O |
Date: |
Fri, 13 May 2016 17:25:15 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.0 |
On 04.05.2016 11:39, Kevin Wolf wrote:
> This changes the backup block job to use the job's BlockBackend for
> performing its I/O. job->bs isn't used by the backup code any more
> afterwards.
>
> Signed-off-by: Kevin Wolf <address@hidden>
> ---
> block/backup.c | 42
> ++++++++++++++++++++++--------------------
> block/block-backend.c | 14 ++++++++++++++
> block/io.c | 9 ---------
> blockdev.c | 4 +---
> include/block/block.h | 2 --
> include/sysemu/block-backend.h | 2 ++
> trace-events | 2 +-
> 7 files changed, 40 insertions(+), 35 deletions(-)
>
> diff --git a/block/backup.c b/block/backup.c
> index 670ba50..ba9eb42 100644
> --- a/block/backup.c
> +++ b/block/backup.c
[...]
> @@ -548,9 +547,11 @@ void backup_start(BlockDriverState *bs, BlockDriverState
> *target,
> goto error;
> }
>
> + job->target = blk_new(&error_abort);
*cough*
> + blk_insert_bs(job->target, target);
> +
> job->on_source_error = on_source_error;
> job->on_target_error = on_target_error;
> - job->target = target;
> job->sync_mode = sync_mode;
> job->sync_bitmap = sync_mode == MIRROR_SYNC_MODE_INCREMENTAL ?
> sync_bitmap : NULL;
[...]
> diff --git a/block/block-backend.c b/block/block-backend.c
> index 8dc3aa5..2b3c55f 100644
> --- a/block/block-backend.c
> +++ b/block/block-backend.c
> @@ -807,6 +807,20 @@ int coroutine_fn blk_co_readv(BlockBackend *blk, int64_t
> sector_num,
> nb_sectors << BDRV_SECTOR_BITS, qiov, 0);
> }
>
> +int coroutine_fn blk_co_readv_no_serialising(BlockBackend *blk,
> + int64_t sector_num, int nb_sectors, QEMUIOVector *qiov)
> +{
> + trace_blk_co_readv_no_serialising(blk, blk_bs(blk), sector_num,
> nb_sectors);
> +
> + if (nb_sectors < 0 || nb_sectors > BDRV_REQUEST_MAX_SECTORS) {
> + return -EINVAL;
> + }
> +
> + return blk_co_preadv(blk, sector_num << BDRV_SECTOR_BITS,
> + nb_sectors << BDRV_SECTOR_BITS, qiov,
> + BDRV_REQ_NO_SERIALISING);
> +}
> +
Same concern as in the other places whether we really want this to have
a sector-based interface...
> int coroutine_fn blk_co_copy_on_readv(BlockBackend *blk,
> int64_t sector_num, int nb_sectors, QEMUIOVector *qiov)
> {
[...]
> diff --git a/blockdev.c b/blockdev.c
> index 7a0196f..fa381ce 100644
> --- a/blockdev.c
> +++ b/blockdev.c
> @@ -3268,8 +3268,8 @@ static void do_drive_backup(const char *device, const
> char *target,
> backup_start(bs, target_bs, speed, sync, bmap,
> on_source_error, on_target_error,
> block_job_cb, bs, txn, &local_err);
> + bdrv_unref(target_bs);
Alternatively you could pull it down under the "out" label and then
remove another bdrv_unref(target_bs) instance in this function.
Max
> if (local_err != NULL) {
> - bdrv_unref(target_bs);
> error_propagate(errp, local_err);
> goto out;
> }
signature.asc
Description: OpenPGP digital signature
- Re: [Qemu-devel] [PATCH 14/14] blockjob: Remove BlockJob.bs, (continued)