diff options
Diffstat (limited to 'block/amend.c')
-rw-r--r-- | block/amend.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/block/amend.c b/block/amend.c index 392df9ef83..f465738665 100644 --- a/block/amend.c +++ b/block/amend.c @@ -53,10 +53,29 @@ static int coroutine_fn blockdev_amend_run(Job *job, Error **errp) return ret; } +static int blockdev_amend_pre_run(BlockdevAmendJob *s, Error **errp) +{ + if (s->bs->drv->bdrv_amend_pre_run) { + return s->bs->drv->bdrv_amend_pre_run(s->bs, errp); + } + + return 0; +} + +static void blockdev_amend_clean(Job *job) +{ + BlockdevAmendJob *s = container_of(job, BlockdevAmendJob, common); + + if (s->bs->drv->bdrv_amend_clean) { + s->bs->drv->bdrv_amend_clean(s->bs); + } +} + static const JobDriver blockdev_amend_job_driver = { .instance_size = sizeof(BlockdevAmendJob), .job_type = JOB_TYPE_AMEND, .run = blockdev_amend_run, + .clean = blockdev_amend_clean, }; void qmp_x_blockdev_amend(const char *job_id, @@ -113,5 +132,11 @@ void qmp_x_blockdev_amend(const char *job_id, s->bs = bs, s->opts = QAPI_CLONE(BlockdevAmendOptions, options), s->force = has_force ? force : false; + + if (blockdev_amend_pre_run(s, errp)) { + job_early_fail(&s->common); + return; + } + job_start(&s->common); } |