From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
To: qemu-devel@nongnu.org, qemu-block@nongnu.org
Cc: kwolf@redhat.com, vsementsov@virtuozzo.com,
wencongyang2@huawei.com, xiechanglong.d@gmail.com,
armbru@redhat.com, mreitz@redhat.com, den@openvz.org,
jsnow@redhat.com
Subject: [Qemu-devel] [PATCH 4/4] block: drop bs->job
Date: Thu, 6 Jun 2019 18:41:32 +0300 [thread overview]
Message-ID: <20190606154132.153330-5-vsementsov@virtuozzo.com> (raw)
In-Reply-To: <20190606154132.153330-1-vsementsov@virtuozzo.com>
Drop remaining users of bs->job:
1. assertions actually duplicated by assert(!bs->refcnt)
2. trace-point seems not enough reason to change stream_start to return
BlockJob pointer
3. Restricting creation of two jobs based on same bs is bad idea, as
3.1 Some jobs creates filters to be their main node, so, this check
don't actually prevent creating second job on same real node (which
will create another filter node) (but I hope it is restricted by
other mechanisms)
3.2 Even without bs->job we have two systems of permissions:
op-blockers and BLK_PERM
3.3 We may want to run several jobs on one node one day
And finally, drop bs->job pointer itself. Hurrah!
Suggested-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
---
include/block/block_int.h | 3 ---
block.c | 2 --
blockdev.c | 2 +-
blockjob.c | 8 --------
block/trace-events | 2 +-
5 files changed, 2 insertions(+), 15 deletions(-)
diff --git a/include/block/block_int.h b/include/block/block_int.h
index 8bb1cfb80a..a498c2670b 100644
--- a/include/block/block_int.h
+++ b/include/block/block_int.h
@@ -812,9 +812,6 @@ struct BlockDriverState {
/* operation blockers */
QLIST_HEAD(, BdrvOpBlocker) op_blockers[BLOCK_OP_TYPE_MAX];
- /* long-running background operation */
- BlockJob *job;
-
/* The node that this node inherited default options from (and a reopen on
* which can affect this node by changing these defaults). This is always a
* parent node of this node. */
diff --git a/block.c b/block.c
index e3e77feee0..ceb2ea23c5 100644
--- a/block.c
+++ b/block.c
@@ -3905,7 +3905,6 @@ static void bdrv_close(BlockDriverState *bs)
BdrvAioNotifier *ban, *ban_next;
BdrvChild *child, *next;
- assert(!bs->job);
assert(!bs->refcnt);
bdrv_drained_begin(bs); /* complete I/O */
@@ -4146,7 +4145,6 @@ out:
static void bdrv_delete(BlockDriverState *bs)
{
- assert(!bs->job);
assert(bdrv_op_blocker_is_empty(bs));
assert(!bs->refcnt);
diff --git a/blockdev.c b/blockdev.c
index 58aa1369a4..51eb5e86d7 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -3264,7 +3264,7 @@ void qmp_block_stream(bool has_job_id, const char *job_id, const char *device,
goto out;
}
- trace_qmp_block_stream(bs, bs->job);
+ trace_qmp_block_stream(bs);
out:
aio_context_release(aio_context);
diff --git a/blockjob.c b/blockjob.c
index 7b6737adde..d64ea2623a 100644
--- a/blockjob.c
+++ b/blockjob.c
@@ -84,9 +84,7 @@ BlockJob *block_job_get(const char *id)
void block_job_free(Job *job)
{
BlockJob *bjob = container_of(job, BlockJob, job);
- BlockDriverState *bs = blk_bs(bjob->blk);
- bs->job = NULL;
block_job_remove_all_bdrv(bjob);
blk_unref(bjob->blk);
error_free(bjob->blocker);
@@ -403,11 +401,6 @@ void *block_job_create(const char *job_id, const BlockJobDriver *driver,
BlockJob *job;
int ret;
- if (bs->job) {
- error_setg(errp, QERR_DEVICE_IN_USE, bdrv_get_device_name(bs));
- return NULL;
- }
-
if (job_id == NULL && !(flags & JOB_INTERNAL)) {
job_id = bdrv_get_device_name(bs);
}
@@ -450,7 +443,6 @@ void *block_job_create(const char *job_id, const BlockJobDriver *driver,
error_setg(&job->blocker, "block device is in use by block job: %s",
job_type_str(&job->job));
block_job_add_bdrv(job, "main node", bs, 0, BLK_PERM_ALL, &error_abort);
- bs->job = job;
bdrv_op_unblock(bs, BLOCK_OP_TYPE_DATAPLANE, job->blocker);
diff --git a/block/trace-events b/block/trace-events
index eab51497fc..912f84af39 100644
--- a/block/trace-events
+++ b/block/trace-events
@@ -53,7 +53,7 @@ qmp_block_job_resume(void *job) "job %p"
qmp_block_job_complete(void *job) "job %p"
qmp_block_job_finalize(void *job) "job %p"
qmp_block_job_dismiss(void *job) "job %p"
-qmp_block_stream(void *bs, void *job) "bs %p job %p"
+qmp_block_stream(void *bs) "bs %p"
# file-posix.c
# file-win32.c
--
2.18.0
next prev parent reply other threads:[~2019-06-06 15:43 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-06 15:41 [Qemu-devel] [PATCH 0/4] block: drop bs->job Vladimir Sementsov-Ogievskiy
2019-06-06 15:41 ` [Qemu-devel] [PATCH 1/4] block/replication: drop usage of bs->job Vladimir Sementsov-Ogievskiy
2019-06-06 15:41 ` [Qemu-devel] [PATCH 2/4] block/block-backend: blk_iostatus_reset: " Vladimir Sementsov-Ogievskiy
2019-06-06 15:41 ` [Qemu-devel] [PATCH 3/4] blockdev: blockdev_mark_auto_del: " Vladimir Sementsov-Ogievskiy
2019-06-06 15:41 ` Vladimir Sementsov-Ogievskiy [this message]
2019-06-17 16:58 ` [Qemu-devel] [PATCH 4/4] block: drop bs->job Kevin Wolf
2019-06-18 6:53 ` Vladimir Sementsov-Ogievskiy
2019-06-06 16:37 ` [Qemu-devel] [PATCH 0/4] " no-reply
2019-06-14 10:17 ` Kevin Wolf
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=20190606154132.153330-5-vsementsov@virtuozzo.com \
--to=vsementsov@virtuozzo.com \
--cc=armbru@redhat.com \
--cc=den@openvz.org \
--cc=jsnow@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=wencongyang2@huawei.com \
--cc=xiechanglong.d@gmail.com \
/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).