From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F172C433DF for ; Mon, 25 May 2020 10:10:53 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 2B41B2078B for ; Mon, 25 May 2020 10:10:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="YKGkzXZF" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2B41B2078B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=virtuozzo.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:43410 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jdA4K-0003uE-9r for qemu-devel@archiver.kernel.org; Mon, 25 May 2020 06:10:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49602) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jdA2q-0001nP-70; Mon, 25 May 2020 06:09:20 -0400 Received: from mail-am6eur05on2108.outbound.protection.outlook.com ([40.107.22.108]:58945 helo=EUR05-AM6-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jdA2p-0003zD-2G; Mon, 25 May 2020 06:09:19 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=l7dp+WiphCt0p/b6E8EiHkfHs/4zoFjfMZlMF65lrDK2VdBe2vr7yQg3iuQpvtJlyN62YWE0bpPLpsJlrnqNGp37AGsb9yuanSYddgYzPj8H8/8BQ0les67wxpeS74N+Gi6PH+SxDF9Gl0z1YRS36lIxpvS4+mXXal3738Yuztu1DFGT0V+/2EHLzr7dph8Ew0Y7q5tI0EDe/vVqHcH5pJjtyW84w6SO40MeDosjgoU/dac7bdVKSe+AOef7siKvt5vCIA/mMQ4xPJG+FQpTiWzCvuWnLQQ2SUdwAqpIe5tAHyDoQ3TuMjSV0F24/a8mwoRtVa+bOeetdSGYFHp3rg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GJo3Tdxyi8ASO50sVAm1KefW3miTRmTfyvdfJfHwxWM=; b=bOP9J2XtxRPB8VxBR+/Jkues1iVQJuCxVVYbB6qd1dhFe/B7G+M19nStRXBtZ5/JsbQrZCoycNuhYpNeaSrZwET4G62nr6wUlz2y9BtoMpd/MMgYeRZAIi0NIP32acz2yVO97EHhvlARoMwsgyLCj2+6Z3JGnzXsjWDuChtJBylWN+leJtK1efCjD6T+1FpH8Wio1a7BpAt77jJ/7mBfVscttrs71gVM6CMwCaFE3fRg0jcoqVum58BoHBzja+DzODwwyJPmudfSmvgIi1H98ajqjHzh/7jaEuzZwT8wrKwkNprsHJLAa3T0oziYEaA1z8UZBNYRjctU+fziTfp/eQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GJo3Tdxyi8ASO50sVAm1KefW3miTRmTfyvdfJfHwxWM=; b=YKGkzXZFQ9DOU213g8CPlTdbvvfVbgG+DdA9Q0dkdeGIabfzPF1GGcLv6Yj4oWMdOMAwZb9HAnwE9XX2uSPoG+DuVo47kRE78J5qavLzYHKU6USF7/H1wBwAQTqVIvKNMvoqnbYSVslgKjVR0alXUm5cdX22NcTHajfL2uQC2TA= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=none action=none header.from=virtuozzo.com; Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM7PR08MB5464.eurprd08.prod.outlook.com (2603:10a6:20b:10a::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.27; Mon, 25 May 2020 10:09:12 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::a408:2f0f:bc6c:d312]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::a408:2f0f:bc6c:d312%3]) with mapi id 15.20.3021.029; Mon, 25 May 2020 10:09:12 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Subject: [PATCH v4 2/5] block: declare some coroutine functions in block/coroutines.h Date: Mon, 25 May 2020 13:07:58 +0300 Message-Id: <20200525100801.13859-3-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200525100801.13859-1-vsementsov@virtuozzo.com> References: <20200525100801.13859-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: AM3PR04CA0143.eurprd04.prod.outlook.com (2603:10a6:207::27) To AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (185.215.60.147) by AM3PR04CA0143.eurprd04.prod.outlook.com (2603:10a6:207::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.23 via Frontend Transport; Mon, 25 May 2020 10:09:11 +0000 X-Mailer: git-send-email 2.21.0 X-Originating-IP: [185.215.60.147] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 523f5596-048c-4ac8-dbed-08d80093ac28 X-MS-TrafficTypeDiagnostic: AM7PR08MB5464: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-Forefront-PRVS: 0414DF926F X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: iXm83N0DSLrBQVkbaV/FfQHY9RwikT4lSa8Msa+PmP09Z191Y9IiS3jXCrpvf8mh/OoImQmjX71uPA3DqyTm/24xPERXQGiS3lF3bGBmk2VNdW/waZkjsIbYFNGYPpodWVOu3106dUEq4WCkp9DwpGtOfvwH+D0/SDT775bI9CDDlGZJeSImIBiKj6FOcE20X2rajrRr0AmN/QnqtcpB5dcUg6BAE6rdKhkqGjCHXI8loR65kCIwMU/qu8wGz3sTDEtNWi6ktuUIZ3cHoA0gMBgCoWav8JY8hWfPEzGUil3sB0UyLUHQIokYLVJxJ9U6cV8mH0RygscRZ9nimlYxD7+G3DinUDpBzjn/D9I5VSW8SCvzWDYTj5orUFasjFoH X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR08MB5494.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(346002)(396003)(39840400004)(376002)(366004)(136003)(6666004)(6486002)(1076003)(316002)(52116002)(26005)(69590400007)(6916009)(6512007)(478600001)(107886003)(8676002)(6506007)(2616005)(8936002)(86362001)(16526019)(186003)(36756003)(2906002)(66556008)(66946007)(4326008)(5660300002)(66476007)(956004); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: cqXBAQrjR6egkPmaBCTFdLk9wXTCz49w/kd/vMHP3DyAyslUNgN9Kl+pXMy0laiSs1RNu6YM0ZJYjbRzJ0nyo8xBybe4QVJsflqwPw45M6Vbv0IU/3fvAwRe6Vb4oibuYsEvHoGvnmQvZkCmfrOH5OUAjrn17+0gtAuwDgYAVn3HSlZQ3a01ejsseE3wM17pQMArJRE8VWfbVKBzhj6dkX8Y46X0OXA49pQOR3ZNHxCJ0i/GvTqFxaqchDw5rwCwzNxLYGtY7L+BEUG1RgqGZCBZZcOD19ttEclvXTwLAUZTKM5w4Rnu7ZuSXBVqjJYIRFWDodZCAnHhQrRXkWQIxpsINS6vE1P0QQilnsjMjd0WKQ0YIqB891hBIDYLHBgzkDE++gR7wvsSaEL2BZ6hrDS93pCE2DV1+fJI7qlevlR+ih3lNMozHVazdNBEVHHuJb5RjGfs6go4cPrTYvDcJperQF03WsuCRuIInlrq9eA= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 523f5596-048c-4ac8-dbed-08d80093ac28 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 May 2020 10:09:12.3119 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: vytboaSxcKvUSfw/5eEFdTOMvVO8zlxhTj1BNemWJg+/LloeIgQL5V3gR6qYMNm7rIOvGYM4f8lHSNuGkSREUMbjAmehSDgUS8xMk/3dwqI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR08MB5464 Received-SPF: pass client-ip=40.107.22.108; envelope-from=vsementsov@virtuozzo.com; helo=EUR05-AM6-obe.outbound.protection.outlook.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/25 06:09:15 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, fam@euphon.net, vsementsov@virtuozzo.com, ehabkost@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com, stefanha@redhat.com, crosa@redhat.com, den@openvz.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" We are going to keep coroutine-wrappers code (structure-packing parameters, BDRV_POLL wrapper functions) in a separate auto-generated files. So, we'll need a header with declaration of original _co_ functions, for those which are static now. As well, we'll need declarations for wrapper functions. Do these declarations now, as a preparation step. Signed-off-by: Vladimir Sementsov-Ogievskiy --- block/coroutines.h | 67 ++++++++++++++++++++++++++++++++++++++++++++++ block.c | 8 +++--- block/io.c | 34 +++++++++++------------ 3 files changed, 88 insertions(+), 21 deletions(-) create mode 100644 block/coroutines.h diff --git a/block/coroutines.h b/block/coroutines.h new file mode 100644 index 0000000000..74278cfef2 --- /dev/null +++ b/block/coroutines.h @@ -0,0 +1,67 @@ +/* + * Block layer I/O functions + * + * Copyright (c) 2003 Fabrice Bellard + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef BLOCK_COROUTINES_INT_H +#define BLOCK_COROUTINES_INT_H + +#include "block/block_int.h" + +int coroutine_fn bdrv_co_check(BlockDriverState *bs, + BdrvCheckResult *res, BdrvCheckMode fix); +void coroutine_fn bdrv_co_invalidate_cache(BlockDriverState *bs, Error **errp); + +int coroutine_fn +bdrv_co_prwv(BdrvChild *child, int64_t offset, QEMUIOVector *qiov, + bool is_write, BdrvRequestFlags flags); +int +bdrv_prwv(BdrvChild *child, int64_t offset, QEMUIOVector *qiov, + bool is_write, BdrvRequestFlags flags); + +int coroutine_fn +bdrv_co_common_block_status_above(BlockDriverState *bs, + BlockDriverState *base, + bool want_zero, + int64_t offset, + int64_t bytes, + int64_t *pnum, + int64_t *map, + BlockDriverState **file); +int +bdrv_common_block_status_above(BlockDriverState *bs, + BlockDriverState *base, + bool want_zero, + int64_t offset, + int64_t bytes, + int64_t *pnum, + int64_t *map, + BlockDriverState **file); + +int coroutine_fn +bdrv_co_rw_vmstate(BlockDriverState *bs, QEMUIOVector *qiov, int64_t pos, + bool is_read); +int +bdrv_rw_vmstate(BlockDriverState *bs, QEMUIOVector *qiov, int64_t pos, + bool is_read); + +#endif /* BLOCK_COROUTINES_INT_H */ diff --git a/block.c b/block.c index 8416376c9b..7f06e82880 100644 --- a/block.c +++ b/block.c @@ -48,6 +48,7 @@ #include "qemu/timer.h" #include "qemu/cutils.h" #include "qemu/id.h" +#include "block/coroutines.h" #ifdef CONFIG_BSD #include @@ -4625,8 +4626,8 @@ static void bdrv_delete(BlockDriverState *bs) * free of errors) or -errno when an internal error occurred. The results of the * check are stored in res. */ -static int coroutine_fn bdrv_co_check(BlockDriverState *bs, - BdrvCheckResult *res, BdrvCheckMode fix) +int coroutine_fn bdrv_co_check(BlockDriverState *bs, + BdrvCheckResult *res, BdrvCheckMode fix) { if (bs->drv == NULL) { return -ENOMEDIUM; @@ -5643,8 +5644,7 @@ void bdrv_init_with_whitelist(void) bdrv_init(); } -static void coroutine_fn bdrv_co_invalidate_cache(BlockDriverState *bs, - Error **errp) +void coroutine_fn bdrv_co_invalidate_cache(BlockDriverState *bs, Error **errp) { BdrvChild *child, *parent; uint64_t perm, shared_perm; diff --git a/block/io.c b/block/io.c index bd00a70b47..f5b6ce3bf6 100644 --- a/block/io.c +++ b/block/io.c @@ -29,6 +29,7 @@ #include "block/blockjob.h" #include "block/blockjob_int.h" #include "block/block_int.h" +#include "block/coroutines.h" #include "qemu/cutils.h" #include "qapi/error.h" #include "qemu/error-report.h" @@ -900,9 +901,9 @@ typedef struct RwCo { BdrvRequestFlags flags; } RwCo; -static int coroutine_fn bdrv_co_prwv(BdrvChild *child, int64_t offset, - QEMUIOVector *qiov, bool is_write, - BdrvRequestFlags flags) +int coroutine_fn bdrv_co_prwv(BdrvChild *child, int64_t offset, + QEMUIOVector *qiov, bool is_write, + BdrvRequestFlags flags) { if (is_write) { return bdrv_co_pwritev(child, offset, qiov->size, qiov, flags); @@ -923,9 +924,9 @@ static void coroutine_fn bdrv_rw_co_entry(void *opaque) /* * Process a vectored synchronous request using coroutines */ -static int bdrv_prwv(BdrvChild *child, int64_t offset, - QEMUIOVector *qiov, bool is_write, - BdrvRequestFlags flags) +int bdrv_prwv(BdrvChild *child, int64_t offset, + QEMUIOVector *qiov, bool is_write, + BdrvRequestFlags flags) { Coroutine *co; RwCo rwco = { @@ -2446,7 +2447,7 @@ early_out: return ret; } -static int coroutine_fn +int coroutine_fn bdrv_co_common_block_status_above(BlockDriverState *bs, BlockDriverState *base, bool want_zero, @@ -2506,12 +2507,12 @@ static void coroutine_fn bdrv_block_status_above_co_entry(void *opaque) * * See bdrv_co_block_status_above() for details. */ -static int bdrv_common_block_status_above(BlockDriverState *bs, - BlockDriverState *base, - bool want_zero, int64_t offset, - int64_t bytes, int64_t *pnum, - int64_t *map, - BlockDriverState **file) +int bdrv_common_block_status_above(BlockDriverState *bs, + BlockDriverState *base, + bool want_zero, int64_t offset, + int64_t bytes, int64_t *pnum, + int64_t *map, + BlockDriverState **file) { Coroutine *co; BdrvCoBlockStatusData data = { @@ -2638,7 +2639,7 @@ typedef struct BdrvVmstateCo { int ret; } BdrvVmstateCo; -static int coroutine_fn +int coroutine_fn bdrv_co_rw_vmstate(BlockDriverState *bs, QEMUIOVector *qiov, int64_t pos, bool is_read) { @@ -2670,9 +2671,8 @@ static void coroutine_fn bdrv_co_rw_vmstate_entry(void *opaque) aio_wait_kick(); } -static inline int -bdrv_rw_vmstate(BlockDriverState *bs, QEMUIOVector *qiov, int64_t pos, - bool is_read) +int bdrv_rw_vmstate(BlockDriverState *bs, QEMUIOVector *qiov, int64_t pos, + bool is_read) { if (qemu_in_coroutine()) { return bdrv_co_rw_vmstate(bs, qiov, pos, is_read); -- 2.21.0