From nobody Sat Oct 4 18:47:15 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1559835800; cv=none; d=zoho.com; s=zohoarc; b=FYTBIV1twHTBZZjk2ZTINSFHJeeNVZ6ZgwMbUBJ5ghFmmbPGPuVWmLHvliGzT9xkUXtPYQTId8fqpG9nFYH0NvJr0qKuBXKzhrw7P/vWqkj20gkBnoG2so/tp2iq4RqFrqR1dNge7YPn4DStW8E97omoVFEzRDRQPehVvZD8oJU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1559835800; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=m0+CuR5H0xiwi7aixrLqpFH24pJ6dLVgEo7YtHXzLvA=; b=KCsa4SGOJVlFVZ/lTROrt3TccPpZYaUfUd5AiosCcEOPAT/qUmH8fGUeunV5FYb7ipkT3yLcrYNH1znW///vpkR/Qkk36MVkE/zReojmbUB87Vjb/SHgJMJlX5NCvSES+PuHKM4ui5pNeLxH+VRhCk+MInWJAr/Iy7MV2Nu7Ty8= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1559835800013671.823390577608; Thu, 6 Jun 2019 08:43:20 -0700 (PDT) Received: from localhost ([127.0.0.1]:34174 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hYuXu-0001Ul-P9 for importer@patchew.org; Thu, 06 Jun 2019 11:43:18 -0400 Received: from eggs.gnu.org ([209.51.188.92]:44559) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hYuWK-0000Vl-E3 for qemu-devel@nongnu.org; Thu, 06 Jun 2019 11:41:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hYuWJ-0004a9-7v for qemu-devel@nongnu.org; Thu, 06 Jun 2019 11:41:40 -0400 Received: from relay.sw.ru ([185.231.240.75]:50226) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hYuWJ-0004X8-0F; Thu, 06 Jun 2019 11:41:39 -0400 Received: from [10.94.3.0] (helo=kvm.qa.sw.ru) by relay.sw.ru with esmtp (Exim 4.91) (envelope-from ) id 1hYuWD-0000xX-CX; Thu, 06 Jun 2019 18:41:33 +0300 From: Vladimir Sementsov-Ogievskiy To: qemu-devel@nongnu.org, qemu-block@nongnu.org Date: Thu, 6 Jun 2019 18:41:32 +0300 Message-Id: <20190606154132.153330-5-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20190606154132.153330-1-vsementsov@virtuozzo.com> References: <20190606154132.153330-1-vsementsov@virtuozzo.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 185.231.240.75 Subject: [Qemu-devel] [PATCH 4/4] block: drop bs->job X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 Signed-off-by: Vladimir Sementsov-Ogievskiy --- 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]; =20 - /* long-running background operation */ - BlockJob *job; - /* The node that this node inherited default options from (and a reope= n on * which can affect this node by changing these defaults). This is alw= ays 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; =20 - assert(!bs->job); assert(!bs->refcnt); =20 bdrv_drained_begin(bs); /* complete I/O */ @@ -4146,7 +4145,6 @@ out: =20 static void bdrv_delete(BlockDriverState *bs) { - assert(!bs->job); assert(bdrv_op_blocker_is_empty(bs)); assert(!bs->refcnt); =20 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 *jo= b_id, const char *device, goto out; } =20 - trace_qmp_block_stream(bs, bs->job); + trace_qmp_block_stream(bs); =20 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 =3D container_of(job, BlockJob, job); - BlockDriverState *bs =3D blk_bs(bjob->blk); =20 - bs->job =3D 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 Block= JobDriver *driver, BlockJob *job; int ret; =20 - if (bs->job) { - error_setg(errp, QERR_DEVICE_IN_USE, bdrv_get_device_name(bs)); - return NULL; - } - if (job_id =3D=3D NULL && !(flags & JOB_INTERNAL)) { job_id =3D bdrv_get_device_name(bs); } @@ -450,7 +443,6 @@ void *block_job_create(const char *job_id, const BlockJ= obDriver *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 =3D job; =20 bdrv_op_unblock(bs, BLOCK_OP_TYPE_DATAPLANE, job->blocker); =20 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" =20 # file-posix.c # file-win32.c --=20 2.18.0