From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
To: qemu-block@nongnu.org
Cc: qemu-devel@nongnu.org, armbru@redhat.com, mreitz@redhat.com,
kwolf@redhat.com, vsementsov@virtuozzo.com, jsnow@redhat.com
Subject: [PATCH 2/5] test-blockjob-txn: don't abuse job->blk
Date: Thu, 6 May 2021 17:13:54 +0300 [thread overview]
Message-ID: <20210506141357.314257-3-vsementsov@virtuozzo.com> (raw)
In-Reply-To: <20210506141357.314257-1-vsementsov@virtuozzo.com>
Here we use job->blk to drop our own reference in job cleanup. Let's do
simpler: drop our reference immediately after job creation.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
---
tests/unit/test-blockjob-txn.c | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
diff --git a/tests/unit/test-blockjob-txn.c b/tests/unit/test-blockjob-txn.c
index 8bd13b9949..c69028b450 100644
--- a/tests/unit/test-blockjob-txn.c
+++ b/tests/unit/test-blockjob-txn.c
@@ -25,14 +25,6 @@ typedef struct {
int *result;
} TestBlockJob;
-static void test_block_job_clean(Job *job)
-{
- BlockJob *bjob = container_of(job, BlockJob, job);
- BlockDriverState *bs = blk_bs(bjob->blk);
-
- bdrv_unref(bs);
-}
-
static int coroutine_fn test_block_job_run(Job *job, Error **errp)
{
TestBlockJob *s = container_of(job, TestBlockJob, common.job);
@@ -73,7 +65,6 @@ static const BlockJobDriver test_block_job_driver = {
.free = block_job_free,
.user_resume = block_job_user_resume,
.run = test_block_job_run,
- .clean = test_block_job_clean,
},
};
@@ -105,6 +96,7 @@ static BlockJob *test_block_job_start(unsigned int iterations,
s = block_job_create(job_id, &test_block_job_driver, txn, bs,
0, BLK_PERM_ALL, 0, JOB_DEFAULT,
test_block_job_cb, data, &error_abort);
+ bdrv_unref(bs); /* referenced by job now */
s->iterations = iterations;
s->use_timer = use_timer;
s->rc = rc;
--
2.29.2
next prev parent reply other threads:[~2021-05-06 14:19 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-06 14:13 [PATCH 0/5] block-job: drop BlockJob.blk Vladimir Sementsov-Ogievskiy
2021-05-06 14:13 ` [PATCH 1/5] blockjob: implement and use block_job_get_aio_context Vladimir Sementsov-Ogievskiy
2021-05-06 14:13 ` Vladimir Sementsov-Ogievskiy [this message]
2021-05-06 14:13 ` [PATCH 3/5] block/stream: add own blk Vladimir Sementsov-Ogievskiy
2021-05-06 14:13 ` [PATCH 4/5] test-bdrv-drain: don't use BlockJob.blk Vladimir Sementsov-Ogievskiy
2021-05-06 14:13 ` [PATCH 5/5] blockjob: drop BlockJob.blk field Vladimir Sementsov-Ogievskiy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210506141357.314257-3-vsementsov@virtuozzo.com \
--to=vsementsov@virtuozzo.com \
--cc=armbru@redhat.com \
--cc=jsnow@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).