From patchwork Tue May 30 18:09:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 13260874 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 53B7DC7EE24 for ; Tue, 30 May 2023 18:12:18 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q43nw-0006bH-P8; Tue, 30 May 2023 14:10:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q43nt-0006Z9-PM for qemu-devel@nongnu.org; Tue, 30 May 2023 14:10:42 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q43nq-0005Cn-Am for qemu-devel@nongnu.org; Tue, 30 May 2023 14:10:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685470237; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lITSxMKIy5BCBhtpkqwgAwb4vAOKPBcBqjiX2PUq5bE=; b=RnAmxD1MtvqMR58HKZQyTVrQGfwyGY45QlH+sBrLF38sUBqIqH95UuA7VYNAwDl8cXsfJG T9VaqMfph8MtpYBmmt9bXZhjrPYFG3eLCA1t9jKyZAufjtuCxX0SUsqvwwpqOk7PUogeuD A7OxhxzYU+cpPhzTcuro6rHvhD/8GGY= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-154-3boQAr7ZMlW1O_l3e_kMEA-1; Tue, 30 May 2023 14:10:35 -0400 X-MC-Unique: 3boQAr7ZMlW1O_l3e_kMEA-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6EAC1101A55C; Tue, 30 May 2023 18:10:34 +0000 (UTC) Received: from localhost (unknown [10.39.192.97]) by smtp.corp.redhat.com (Postfix) with ESMTP id C7AF4C15612; Tue, 30 May 2023 18:10:33 +0000 (UTC) From: Stefan Hajnoczi To: qemu-devel@nongnu.org Cc: Paolo Bonzini , eblake@redhat.com, Hanna Reitz , Fam Zheng , sgarzare@redhat.com, qemu-block@nongnu.org, xen-devel@lists.xenproject.org, Julia Suvorova , Stefano Stabellini , =?utf-8?q?Philippe_Mathieu-Dau?= =?utf-8?q?d=C3=A9?= , Paul Durrant , Kevin Wolf , Anthony Perard , "Michael S. Tsirkin" , Stefan Hajnoczi , Aarushi Mehta Subject: [PATCH v3 6/6] block: remove bdrv_co_io_plug() API Date: Tue, 30 May 2023 14:09:59 -0400 Message-Id: <20230530180959.1108766-7-stefanha@redhat.com> In-Reply-To: <20230530180959.1108766-1-stefanha@redhat.com> References: <20230530180959.1108766-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Received-SPF: pass client-ip=170.10.133.124; envelope-from=stefanha@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.167, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org No block driver implements .bdrv_co_io_plug() anymore. Get rid of the function pointers. Signed-off-by: Stefan Hajnoczi Reviewed-by: Eric Blake Reviewed-by: Stefano Garzarella --- include/block/block-io.h | 3 --- include/block/block_int-common.h | 11 ---------- block/io.c | 37 -------------------------------- 3 files changed, 51 deletions(-) diff --git a/include/block/block-io.h b/include/block/block-io.h index a27e471a87..43af816d75 100644 --- a/include/block/block-io.h +++ b/include/block/block-io.h @@ -259,9 +259,6 @@ void coroutine_fn bdrv_co_leave(BlockDriverState *bs, AioContext *old_ctx); AioContext *child_of_bds_get_parent_aio_context(BdrvChild *c); -void coroutine_fn GRAPH_RDLOCK bdrv_co_io_plug(BlockDriverState *bs); -void coroutine_fn GRAPH_RDLOCK bdrv_co_io_unplug(BlockDriverState *bs); - bool coroutine_fn GRAPH_RDLOCK bdrv_co_can_store_new_dirty_bitmap(BlockDriverState *bs, const char *name, uint32_t granularity, Error **errp); diff --git a/include/block/block_int-common.h b/include/block/block_int-common.h index 6492a1e538..958962aa3a 100644 --- a/include/block/block_int-common.h +++ b/include/block/block_int-common.h @@ -753,11 +753,6 @@ struct BlockDriver { void coroutine_fn GRAPH_RDLOCK_PTR (*bdrv_co_debug_event)( BlockDriverState *bs, BlkdebugEvent event); - /* io queue for linux-aio */ - void coroutine_fn GRAPH_RDLOCK_PTR (*bdrv_co_io_plug)(BlockDriverState *bs); - void coroutine_fn GRAPH_RDLOCK_PTR (*bdrv_co_io_unplug)( - BlockDriverState *bs); - /** * bdrv_drain_begin is called if implemented in the beginning of a * drain operation to drain and stop any internal sources of requests in @@ -1227,12 +1222,6 @@ struct BlockDriverState { unsigned int in_flight; unsigned int serialising_in_flight; - /* - * counter for nested bdrv_io_plug. - * Accessed with atomic ops. - */ - unsigned io_plugged; - /* do we need to tell the quest if we have a volatile write cache? */ int enable_write_cache; diff --git a/block/io.c b/block/io.c index 4d54fda593..56b0c1ce6c 100644 --- a/block/io.c +++ b/block/io.c @@ -3219,43 +3219,6 @@ void *qemu_try_blockalign0(BlockDriverState *bs, size_t size) return mem; } -void coroutine_fn bdrv_co_io_plug(BlockDriverState *bs) -{ - BdrvChild *child; - IO_CODE(); - assert_bdrv_graph_readable(); - - QLIST_FOREACH(child, &bs->children, next) { - bdrv_co_io_plug(child->bs); - } - - if (qatomic_fetch_inc(&bs->io_plugged) == 0) { - BlockDriver *drv = bs->drv; - if (drv && drv->bdrv_co_io_plug) { - drv->bdrv_co_io_plug(bs); - } - } -} - -void coroutine_fn bdrv_co_io_unplug(BlockDriverState *bs) -{ - BdrvChild *child; - IO_CODE(); - assert_bdrv_graph_readable(); - - assert(bs->io_plugged); - if (qatomic_fetch_dec(&bs->io_plugged) == 1) { - BlockDriver *drv = bs->drv; - if (drv && drv->bdrv_co_io_unplug) { - drv->bdrv_co_io_unplug(bs); - } - } - - QLIST_FOREACH(child, &bs->children, next) { - bdrv_co_io_unplug(child->bs); - } -} - /* Helper that undoes bdrv_register_buf() when it fails partway through */ static void GRAPH_RDLOCK bdrv_register_buf_rollback(BlockDriverState *bs, void *host, size_t size,