test-bdrv-drain: don't use BlockJob.blk
We are going to drop BlockJob.blk in further commit. For tests it's enough to simply pass bs pointer. Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Reviewed-by: Nikita Lapshin <nikita.lapshin@virtuozzo.com>
This commit is contained in:
parent
048954e2f6
commit
1b177bbea0
@ -772,6 +772,7 @@ static void test_iothread_drain_subtree(void)
|
||||
|
||||
typedef struct TestBlockJob {
|
||||
BlockJob common;
|
||||
BlockDriverState *bs;
|
||||
int run_ret;
|
||||
int prepare_ret;
|
||||
bool running;
|
||||
@ -783,7 +784,7 @@ static int test_job_prepare(Job *job)
|
||||
TestBlockJob *s = container_of(job, TestBlockJob, common.job);
|
||||
|
||||
/* Provoke an AIO_WAIT_WHILE() call to verify there is no deadlock */
|
||||
blk_flush(s->common.blk);
|
||||
bdrv_flush(s->bs);
|
||||
return s->prepare_ret;
|
||||
}
|
||||
|
||||
@ -792,7 +793,7 @@ static void test_job_commit(Job *job)
|
||||
TestBlockJob *s = container_of(job, TestBlockJob, common.job);
|
||||
|
||||
/* Provoke an AIO_WAIT_WHILE() call to verify there is no deadlock */
|
||||
blk_flush(s->common.blk);
|
||||
bdrv_flush(s->bs);
|
||||
}
|
||||
|
||||
static void test_job_abort(Job *job)
|
||||
@ -800,7 +801,7 @@ static void test_job_abort(Job *job)
|
||||
TestBlockJob *s = container_of(job, TestBlockJob, common.job);
|
||||
|
||||
/* Provoke an AIO_WAIT_WHILE() call to verify there is no deadlock */
|
||||
blk_flush(s->common.blk);
|
||||
bdrv_flush(s->bs);
|
||||
}
|
||||
|
||||
static int coroutine_fn test_job_run(Job *job, Error **errp)
|
||||
@ -915,6 +916,7 @@ static void test_blockjob_common_drain_node(enum drain_type drain_type,
|
||||
tjob = block_job_create("job0", &test_job_driver, NULL, src,
|
||||
0, BLK_PERM_ALL,
|
||||
0, 0, NULL, NULL, &error_abort);
|
||||
tjob->bs = src;
|
||||
job = &tjob->common;
|
||||
block_job_add_bdrv(job, "target", target, 0, BLK_PERM_ALL, &error_abort);
|
||||
|
||||
@ -1538,6 +1540,7 @@ typedef struct TestDropBackingBlockJob {
|
||||
bool should_complete;
|
||||
bool *did_complete;
|
||||
BlockDriverState *detach_also;
|
||||
BlockDriverState *bs;
|
||||
} TestDropBackingBlockJob;
|
||||
|
||||
static int coroutine_fn test_drop_backing_job_run(Job *job, Error **errp)
|
||||
@ -1557,7 +1560,7 @@ static void test_drop_backing_job_commit(Job *job)
|
||||
TestDropBackingBlockJob *s =
|
||||
container_of(job, TestDropBackingBlockJob, common.job);
|
||||
|
||||
bdrv_set_backing_hd(blk_bs(s->common.blk), NULL, &error_abort);
|
||||
bdrv_set_backing_hd(s->bs, NULL, &error_abort);
|
||||
bdrv_set_backing_hd(s->detach_also, NULL, &error_abort);
|
||||
|
||||
*s->did_complete = true;
|
||||
@ -1657,6 +1660,7 @@ static void test_blockjob_commit_by_drained_end(void)
|
||||
job = block_job_create("job", &test_drop_backing_job_driver, NULL,
|
||||
bs_parents[2], 0, BLK_PERM_ALL, 0, 0, NULL, NULL,
|
||||
&error_abort);
|
||||
job->bs = bs_parents[2];
|
||||
|
||||
job->detach_also = bs_parents[0];
|
||||
job->did_complete = &job_has_completed;
|
||||
|
Loading…
Reference in New Issue
Block a user