aboutsummaryrefslogtreecommitdiff
path: root/blockjob.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 /blockjob.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 'blockjob.c')
-rw-r--r--blockjob.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/blockjob.c b/blockjob.c
index 1fac6bb8a7..c3620ec544 100644
--- a/blockjob.c
+++ b/blockjob.c
@@ -198,6 +198,20 @@ void block_job_remove_all_bdrv(BlockJob *job)
job->nodes = NULL;
}
+bool block_job_has_bdrv(BlockJob *job, BlockDriverState *bs)
+{
+ GSList *el;
+
+ for (el = job->nodes; el; el = el->next) {
+ BdrvChild *c = el->data;
+ if (c->bs == bs) {
+ return true;
+ }
+ }
+
+ return false;
+}
+
int block_job_add_bdrv(BlockJob *job, const char *name, BlockDriverState *bs,
uint64_t perm, uint64_t shared_perm, Error **errp)
{