aboutsummaryrefslogtreecommitdiff
path: root/blockdev.c
diff options
context:
space:
mode:
authorVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>2019-06-06 18:41:31 +0300
committerKevin Wolf <kwolf@redhat.com>2019-06-18 16:41:10 +0200
commit8164102ffe02dfc6478c0b3f8ffce29705a9a53b (patch)
tree2927ab69eb93dc66110ca00ce3486c6025b4b3ea /blockdev.c
parent68d00e429395a273cf25827f89f036548fb67bdd (diff)
blockdev: blockdev_mark_auto_del: drop usage of bs->job
We are going to remove bs->job pointer. Drop it's usage in blockdev_mark_auto_del: instead of looking at bs->job let's check all jobs for references to bs. Suggested-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'blockdev.c')
-rw-r--r--blockdev.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/blockdev.c b/blockdev.c
index b5c0fd3c49..a9dd73eafc 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -140,22 +140,21 @@ void override_max_devs(BlockInterfaceType type, int max_devs)
void blockdev_mark_auto_del(BlockBackend *blk)
{
DriveInfo *dinfo = blk_legacy_dinfo(blk);
- BlockDriverState *bs = blk_bs(blk);
- AioContext *aio_context;
+ BlockJob *job;
if (!dinfo) {
return;
}
- if (bs) {
- aio_context = bdrv_get_aio_context(bs);
- aio_context_acquire(aio_context);
+ for (job = block_job_next(NULL); job; job = block_job_next(job)) {
+ if (block_job_has_bdrv(job, blk_bs(blk))) {
+ AioContext *aio_context = job->job.aio_context;
+ aio_context_acquire(aio_context);
- if (bs->job) {
- job_cancel(&bs->job->job, false);
- }
+ job_cancel(&job->job, false);
- aio_context_release(aio_context);
+ aio_context_release(aio_context);
+ }
}
dinfo->auto_del = 1;