From nobody Sat Feb 7 04:40:22 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.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 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1511967603858307.24210198660455; Wed, 29 Nov 2017 07:00:03 -0800 (PST) Received: from localhost ([::1]:43515 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eK3qD-000588-4Q for importer@patchew.org; Wed, 29 Nov 2017 10:00:01 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41730) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eK3il-0006WE-Re for qemu-devel@nongnu.org; Wed, 29 Nov 2017 09:52:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eK3ik-0006YF-Gk for qemu-devel@nongnu.org; Wed, 29 Nov 2017 09:52:19 -0500 Received: from mx1.redhat.com ([209.132.183.28]:38242) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eK3if-0006R8-KW; Wed, 29 Nov 2017 09:52:13 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AEC4AC0587D8; Wed, 29 Nov 2017 14:52:12 +0000 (UTC) Received: from lemon.redhat.com (ovpn-12-98.pek2.redhat.com [10.72.12.98]) by smtp.corp.redhat.com (Postfix) with ESMTP id 919C45C670; Wed, 29 Nov 2017 14:52:02 +0000 (UTC) From: Fam Zheng To: qemu-devel@nongnu.org Date: Wed, 29 Nov 2017 22:49:55 +0800 Message-Id: <20171129144956.11409-9-famz@redhat.com> In-Reply-To: <20171129144956.11409-1-famz@redhat.com> References: <20171129144956.11409-1-famz@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 29 Nov 2017 14:52:12 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH RFC 8/9] block: Drop old drained_{begin, end} callbacks 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: Kevin Wolf , Fam Zheng , qemu-block@nongnu.org, jcody@redhat.com, Max Reitz , Stefan Hajnoczi , pbonzini@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Fam Zheng --- block.c | 24 ------------------------ block/block-backend.c | 22 ---------------------- blockjob.c | 6 ------ include/block/block.h | 16 ---------------- include/block/block_int.h | 11 ----------- include/sysemu/block-backend.h | 8 -------- 6 files changed, 87 deletions(-) diff --git a/block.c b/block.c index 949f0dec11..4434441df5 100644 --- a/block.c +++ b/block.c @@ -810,18 +810,6 @@ static char *bdrv_child_get_parent_desc(BdrvChild *c) return g_strdup(bdrv_get_device_or_node_name(parent)); } =20 -static void bdrv_child_cb_drained_begin(BdrvChild *child) -{ - BlockDriverState *bs =3D child->opaque; - bdrv_drained_begin(bs); -} - -static void bdrv_child_cb_drained_end(BdrvChild *child) -{ - BlockDriverState *bs =3D child->opaque; - bdrv_drained_end(bs); -} - static int bdrv_child_cb_inactivate(BdrvChild *child) { BlockDriverState *bs =3D child->opaque; @@ -887,8 +875,6 @@ static void bdrv_inherited_options(int *child_flags, QD= ict *child_options, const BdrvChildRole child_file =3D { .get_parent_desc =3D bdrv_child_get_parent_desc, .inherit_options =3D bdrv_inherited_options, - .drained_begin =3D bdrv_child_cb_drained_begin, - .drained_end =3D bdrv_child_cb_drained_end, .inactivate =3D bdrv_child_cb_inactivate, }; =20 @@ -909,8 +895,6 @@ static void bdrv_inherited_fmt_options(int *child_flags= , QDict *child_options, const BdrvChildRole child_format =3D { .get_parent_desc =3D bdrv_child_get_parent_desc, .inherit_options =3D bdrv_inherited_fmt_options, - .drained_begin =3D bdrv_child_cb_drained_begin, - .drained_end =3D bdrv_child_cb_drained_end, .inactivate =3D bdrv_child_cb_inactivate, }; =20 @@ -1022,8 +1006,6 @@ const BdrvChildRole child_backing =3D { .attach =3D bdrv_backing_attach, .detach =3D bdrv_backing_detach, .inherit_options =3D bdrv_backing_options, - .drained_begin =3D bdrv_child_cb_drained_begin, - .drained_end =3D bdrv_child_cb_drained_end, .inactivate =3D bdrv_child_cb_inactivate, .update_filename =3D bdrv_backing_update_filename, }; @@ -1973,9 +1955,6 @@ static void bdrv_replace_child_noperm(BdrvChild *chil= d, assert(bdrv_get_aio_context(old_bs) =3D=3D bdrv_get_aio_context(ne= w_bs)); } if (old_bs) { - if (old_bs->quiesce_counter && child->role->drained_end) { - child->role->drained_end(child); - } if (child->role->detach) { child->role->detach(child); } @@ -1986,9 +1965,6 @@ static void bdrv_replace_child_noperm(BdrvChild *chil= d, =20 if (new_bs) { QLIST_INSERT_HEAD(&new_bs->parents, child, next_parent); - if (new_bs->quiesce_counter && child->role->drained_begin) { - child->role->drained_begin(child); - } =20 if (child->role->attach) { child->role->attach(child); diff --git a/block/block-backend.c b/block/block-backend.c index baef8e7abc..05855ab767 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -68,7 +68,6 @@ struct BlockBackend { =20 NotifierList remove_bs_notifiers, insert_bs_notifiers; =20 - int quiesce_counter; VMChangeStateEntry *vmsh; bool force_allow_inactivate; }; @@ -245,9 +244,6 @@ static const BdrvChildRole child_root =3D { .get_name =3D blk_root_get_name, .get_parent_desc =3D blk_root_get_parent_desc, =20 - .drained_begin =3D blk_root_drained_begin, - .drained_end =3D blk_root_drained_end, - .activate =3D blk_root_activate, .inactivate =3D blk_root_inactivate, }; @@ -887,11 +883,6 @@ void blk_set_dev_ops(BlockBackend *blk, const BlockDev= Ops *ops, =20 blk->dev_ops =3D ops; blk->dev_opaque =3D opaque; - - /* Are we currently quiesced? Should we enforce this right now? */ - if (blk->quiesce_counter && ops->drained_begin) { - ops->drained_begin(opaque); - } } =20 /* @@ -2068,12 +2059,6 @@ static void blk_root_drained_begin(BdrvChild *child) { BlockBackend *blk =3D child->opaque; =20 - if (++blk->quiesce_counter =3D=3D 1) { - if (blk->dev_ops && blk->dev_ops->drained_begin) { - blk->dev_ops->drained_begin(blk->dev_opaque); - } - } - /* Note that blk->root may not be accessible here yet if we are just * attaching to a BlockDriverState that is drained. Use child instead.= */ =20 @@ -2085,14 +2070,7 @@ static void blk_root_drained_begin(BdrvChild *child) static void blk_root_drained_end(BdrvChild *child) { BlockBackend *blk =3D child->opaque; - assert(blk->quiesce_counter); =20 assert(blk->public.throttle_group_member.io_limits_disabled); atomic_dec(&blk->public.throttle_group_member.io_limits_disabled); - - if (--blk->quiesce_counter =3D=3D 0) { - if (blk->dev_ops && blk->dev_ops->drained_end) { - blk->dev_ops->drained_end(blk->dev_opaque); - } - } } diff --git a/blockjob.c b/blockjob.c index 86d060c89c..809111bf24 100644 --- a/blockjob.c +++ b/blockjob.c @@ -160,11 +160,6 @@ static void block_job_drained_end(void *opaque) block_job_resume(job); } =20 -static const BlockDevOps block_job_dev_ops =3D { - .drained_begin =3D block_job_drained_begin, - .drained_end =3D block_job_drained_end, -}; - void block_job_unref(BlockJob *job) { if (--job->refcnt =3D=3D 0) { @@ -680,7 +675,6 @@ void *block_job_create(const char *job_id, const BlockJ= obDriver *driver, block_job_add_bdrv(job, "main node", bs, 0, BLK_PERM_ALL, &error_abort= ); bs->job =3D job; =20 - blk_set_dev_ops(blk, &block_job_dev_ops, job); aio_context_add_drain_ops(blk_get_aio_context(blk), block_job_drained_begin, block_job_drained_e= nd, job); diff --git a/include/block/block.h b/include/block/block.h index c05cac57e5..df73e77200 100644 --- a/include/block/block.h +++ b/include/block/block.h @@ -579,22 +579,6 @@ int bdrv_probe_geometry(BlockDriverState *bs, HDGeomet= ry *geo); void bdrv_io_plug(BlockDriverState *bs); void bdrv_io_unplug(BlockDriverState *bs); =20 -/** - * bdrv_parent_drained_begin: - * - * Begin a quiesced section of all users of @bs. This is part of - * bdrv_drained_begin. - */ -void bdrv_parent_drained_begin(BlockDriverState *bs); - -/** - * bdrv_parent_drained_end: - * - * End a quiesced section of all users of @bs. This is part of - * bdrv_drained_end. - */ -void bdrv_parent_drained_end(BlockDriverState *bs); - /** * bdrv_drained_begin: * diff --git a/include/block/block_int.h b/include/block/block_int.h index e107163594..8eed595682 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -535,17 +535,6 @@ struct BdrvChildRole { * caller is responsible for freeing the memory. */ char *(*get_parent_desc)(BdrvChild *child); =20 - /* - * If this pair of functions is implemented, the parent doesn't issue = new - * requests after returning from .drained_begin() until .drained_end()= is - * called. - * - * Note that this can be nested. If drained_begin() was called twice, = new - * I/O is allowed only after drained_end() was called twice, too. - */ - void (*drained_begin)(BdrvChild *child); - void (*drained_end)(BdrvChild *child); - /* Notifies the parent that the child has been activated/inactivated (= e.g. * when migration is completing) and it can start/stop requesting * permissions and doing I/O on it. */ diff --git a/include/sysemu/block-backend.h b/include/sysemu/block-backend.h index c4e52a5fa3..9e81232a83 100644 --- a/include/sysemu/block-backend.h +++ b/include/sysemu/block-backend.h @@ -58,14 +58,6 @@ typedef struct BlockDevOps { * Runs when the size changed (e.g. monitor command block_resize) */ void (*resize_cb)(void *opaque); - /* - * Runs when the backend receives a drain request. - */ - void (*drained_begin)(void *opaque); - /* - * Runs when the backend's last drain request ends. - */ - void (*drained_end)(void *opaque); } BlockDevOps; =20 /* This struct is embedded in (the private) BlockBackend struct and contai= ns --=20 2.14.3