From patchwork Thu May 6 09:06:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 1474875 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=virtuozzo.com header.i=@virtuozzo.com header.a=rsa-sha256 header.s=selector2 header.b=Sb88OkXc; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 4FbSXH0pS0z9sVv for ; Thu, 6 May 2021 19:12:31 +1000 (AEST) Received: from localhost ([::1]:35586 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lea3Z-0007qy-3m for incoming@patchwork.ozlabs.org; Thu, 06 May 2021 05:12:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60220) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1leZyA-0002Fj-Tp; Thu, 06 May 2021 05:06:56 -0400 Received: from mail-eopbgr60134.outbound.protection.outlook.com ([40.107.6.134]:38452 helo=EUR04-DB3-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 1leZy5-0002qw-Uh; Thu, 06 May 2021 05:06:54 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FJop2oWOg5MRv90bOY5gGQOMxHrdMeELLT5U7hcD6LjLePryfyuY4DhUilLITP0Gdf3kHMh1teXjzK0whaRs7qQ79XCglm2A4Qw7jgc80YBGY6jvkJ2cf0mNreAGYmL2+f4uFobb1U8oRs5a4oHL5jO1QoAqIze0jBrDNk9gKASkDB3yIfN7MmrLqJ9SFy2pJr8pjZ209PXmPlTrKAQ90eJVGk+rOwkJzVPALgmDSgWheUhAYkvHqNu4Uqcq3vnLNnJFHsYBMDKGderGj9aQlIaQwITAjYrGFwWK6ZN8T1t3fwLybjfOGE2cShcXRvxblf9gBHGgNrgy9/XWwZECmg== 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=ipnajDPxQi5JFjkMmqwu9zp0XRy/bvuDSis1eMOZO34=; b=FqygTFghmENaQaIPgWC85bV6EkVbepmquPsRRnNrlZ1kLPcNIxtI+0XZixN0hjHiFpRUaR0eAxp9yaM44OZDzud+odM4O9OSqz9PdnY4OTcGx5vUWYxT06S8skK2veJtY8U9F8a9PjM5JXrL3erYdKTAz+P52SqJKnXGidfDNTynqUq9l3KLu+EL8HlHlTo/OZG8/rS8OVFKTAMWR2uU+UFP1Kanjc0Yjuiwpg1vI4+f7AuZw/J++GvSlP3AZLxaE88i5wzj/SD8zeeevlcrUICTV6rgZqKdZxvzsp+n5Dgf8Kij/dE46N08EUTRvv4iXKCCXT9l7BSyonygNT3PTg== 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=ipnajDPxQi5JFjkMmqwu9zp0XRy/bvuDSis1eMOZO34=; b=Sb88OkXczkZXVCopQGL++v5Q13Nk4tWzqYNFTuKR4RKDOxWqa/Urlr/j8kbouAdwaccOdJMAKHRv78WtDMcODNTo6CXfm5ExC4GR/aVJCc84w8BljWZ3QzPKs4uxB1vHd7qi++LfGZgCE/qChFDD7lBtNi3S4fAcmFQCJuO9Luw= 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 AS8PR08MB6807.eurprd08.prod.outlook.com (2603:10a6:20b:395::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.26; Thu, 6 May 2021 09:06:40 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::b403:c1a9:6bb7:133]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::b403:c1a9:6bb7:133%7]) with mapi id 15.20.4108.026; Thu, 6 May 2021 09:06:40 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, fam@euphon.net, stefanha@redhat.com, mreitz@redhat.com, kwolf@redhat.com, vsementsov@virtuozzo.com, eesposit@redhat.com, pbonzini@redhat.com Subject: [PATCH v3 1/8] block/write-threshold: don't use write notifiers Date: Thu, 6 May 2021 12:06:14 +0300 Message-Id: <20210506090621.11848-2-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210506090621.11848-1-vsementsov@virtuozzo.com> References: <20210506090621.11848-1-vsementsov@virtuozzo.com> X-Originating-IP: [185.215.60.236] X-ClientProxiedBy: HE1P195CA0011.EURP195.PROD.OUTLOOK.COM (2603:10a6:3:fd::21) 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.236) by HE1P195CA0011.EURP195.PROD.OUTLOOK.COM (2603:10a6:3:fd::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Thu, 6 May 2021 09:06:39 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5112c54c-fb08-40e7-542c-08d9106e428f X-MS-TrafficTypeDiagnostic: AS8PR08MB6807: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2000; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NFQnTG78YiYQ1PPFQRnm5ObR+I2CJfRzAaxrt+6AOVKABouYiE8aVviyei1M8+eydI3+3Gm2nJzwVJ8NeHxCg2zZAXy1qLlmOFiRJOgAxGPz05r6bPNUWFPIB6/VkSj6d2USz+cTXBvS6IOFg0YgYYZsb3jb0cAJ5NZfNlKmZhRJyNqRD0crjdtCvreSjBrCDSPM1w4dNw3b/oRiiF0V4y3YCZjPQg0MT5IrLTE/lf/GaEIXTHLFZ1kUiDU508ry2S8813QbbJbuzHXuFLos2RWAa+qkwNRpjHck4/ePStxtsa2gwxxp9USVgnbUqAxyC7T40VMabyFLKqlfUubTjRva4nSF9epA8oR6liLmSx6rzNGrtJ6NOX4xSovWxlM0/Ya0XcdgONdmIZBYz+L8pXrnrjdDrTOHCm4tl2zm6sIQjg/cg0rhseY7oZTKDRFypa+WPlbmWuGtB9yiL2KWykGJtgvvRXuRF+KN0ebHMIgTJ3rjWsSKT+YfWCJtSS62w4XkBuc+odIdaPxFuk77XsQMajgAndwfB9tW/NilpumdauDZmKjTn68gzug6aaGIk5Pedrg2yCyNPFv4fW08TzLBLjGRoQK8SiPhZMD60nBrgAMsdSKOUj/9nf/TOdmlaRSRjNUB2zHiUOKbE31ZWri3AOqkGQ4PxjE+llE7kIaTNnZ/ptwPU7FPWX7u+VHz 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; SFS:(4636009)(136003)(346002)(366004)(376002)(39830400003)(396003)(6486002)(38100700002)(6506007)(956004)(2616005)(66946007)(83380400001)(66476007)(38350700002)(4326008)(26005)(66556008)(86362001)(36756003)(1076003)(6666004)(478600001)(6916009)(5660300002)(2906002)(316002)(6512007)(8936002)(8676002)(186003)(16526019)(52116002)(69590400013); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: UqLcZRmwE6QvxGoNidGp6euBfMBG26kE0Xq2rYQstBDGJF0NJcr76Jw0fYFPRm5eZiqvYod+XG+LqkZmHajh5jTqAq/LNt467sTT2Tg+mceBnNckKhjVtrkxNxJrOKDet2EliwK/1p0EBG163Aj0d5aj5QnhQL3byE6VrpVdARwdI6jKVXg1mDf/0ia6yJ382sNpnjoEk35vB88eFTgkPPWxdTsAfl48PpJNUkKccWBkRPdLkI7t08w3ePPexMqIWIjSMlpIgMf9gCdl7ETPcwSB5NFmZt6cpp/xuTwLeMJcVs9WK745tk/sX89hHHkt/39FH7tK7X3E8sqK1T/dw/721trNYQC5BW/bY7x/Rw5+Fzt/RZAA6PEGwWMBB6Sh1nHbJWPfQTtlxZ5FAb3onwkAM69PajUBNEEVLsRPU2p9QC2ZrDw2qfsDebx++hX3cl7ws25VQ/sEm+Y4YDzTEd48V8ySss7IwzhrfcBPnOpDI+NnAtIV2yfrmBnd5MqN3bgC0GlTqPqxxxFExnnDdTfpVAFJNQmu5s2E2hg2fXeUCcMN5RMIWtcYnTUAn6NJ1Ii27ePXFvFRlfAokTNKVNaCCZQaMcOCeUmrCseW5zbHeOf/Xc77UYjb07BVZeDmUt1L6t/oHBSwdxGrGpPlg0fLP700V1jHc41UzKemf9d0Bp3/FgwaTYP7A+bLbAU+UXZjQ8IMmPz8dNz9mla2Rux6ZmcjwN0XXMHmJ12ulQD5gNpb7X4UXGVP9mwOgg1yn3KKF37vrQoe5PTKZzXK8qq0O7isbvi7bkk9CXq45+uBfAmO/QhnZzuaWLdkznma/ESQ1IVTg9YegdJJ9YqbZ4wOLPWBNPfgWcSY4vkPzyMASvD4ephm7SjZ/xfxUWoNiuXCxJ/vf6X0E4rfvb5DoX6py8LfAitO17EJV/xnsSV5OhqwdDTGrK48IsMat2dqmaHP41wNrSRTkkxU7sSdyxs8Mt/c5w/KUD2uRTOvBgg2xJD6YNcs4siPMEg6iHCVLvsbxGiwkFUja3srGadAloGUnIaqf8o7da4s6KSShJ0XON3aUNJdzILmD5kXDQOk5mL5PQttkk7+iWDmPbTtnVzUsvVpdwmqzuu1aw7ZeAWq5BQ/j6GP3w6CFIqy/KgVrcMqLFvt6ATuY8emYHkmP8TRQJtnBbZiMdjklcgOyYKpFB94/iuFYqIuIkxUntb/BpL912SkdGg9HHmZWnj2yEBzNOECh2JoU7CMojDGXZurOHR814r3GZT/wAPDF6WD2dygM7iIDt1HtgHPlpJp2Mz3bX7wk23/JpQgsA6gMiYDDEXOySGA53oq+7AY5+/y X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5112c54c-fb08-40e7-542c-08d9106e428f X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 May 2021 09:06:40.0225 (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: NBTVat4QgWKCaF0jedwgbRdiUriSuvepKPCi0p+GNak7NyQY6ZxmLWwP5AXfXs25rAQli+YdDGy83p5HYnFuqUGXoFzlCALhTa2H8skrYZw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB6807 Received-SPF: pass client-ip=40.107.6.134; envelope-from=vsementsov@virtuozzo.com; helo=EUR04-DB3-obe.outbound.protection.outlook.com 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 autolearn=ham autolearn_force=no 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: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" write-notifiers are used only for write-threshold. New code for such purpose should create filters. Let's better special-case write-threshold and drop write notifiers at all. (Actually, write-threshold is special-cased anyway, as the only user of write-notifiers) So, create a new direct interface for bdrv_co_write_req_prepare() and drop all write-notifier related logic from write-threshold.c. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Max Reitz Reviewed-by: Eric Blake --- include/block/block_int.h | 1 - include/block/write-threshold.h | 9 +++++ block/io.c | 5 ++- block/write-threshold.c | 70 +++++++-------------------------- 4 files changed, 27 insertions(+), 58 deletions(-) diff --git a/include/block/block_int.h b/include/block/block_int.h index c823f5b1b3..51f51286a5 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -959,7 +959,6 @@ struct BlockDriverState { /* threshold limit for writes, in bytes. "High water mark". */ uint64_t write_threshold_offset; - NotifierWithReturn write_threshold_notifier; /* Writing to the list requires the BQL _and_ the dirty_bitmap_mutex. * Reading from the list can be done with either the BQL or the diff --git a/include/block/write-threshold.h b/include/block/write-threshold.h index c646f267a4..555afd0de6 100644 --- a/include/block/write-threshold.h +++ b/include/block/write-threshold.h @@ -59,4 +59,13 @@ bool bdrv_write_threshold_is_set(const BlockDriverState *bs); uint64_t bdrv_write_threshold_exceeded(const BlockDriverState *bs, const BdrvTrackedRequest *req); +/* + * bdrv_write_threshold_check_write + * + * Check whether the specified request exceeds the write threshold. + * If it is, send corresponding event and disable write threshold checking. + */ +void bdrv_write_threshold_check_write(BlockDriverState *bs, int64_t offset, + int64_t bytes); + #endif diff --git a/block/io.c b/block/io.c index 35b6c56efc..3520de51bb 100644 --- a/block/io.c +++ b/block/io.c @@ -30,6 +30,7 @@ #include "block/blockjob_int.h" #include "block/block_int.h" #include "block/coroutines.h" +#include "block/write-threshold.h" #include "qemu/cutils.h" #include "qapi/error.h" #include "qemu/error-report.h" @@ -2008,8 +2009,8 @@ bdrv_co_write_req_prepare(BdrvChild *child, int64_t offset, int64_t bytes, } else { assert(child->perm & BLK_PERM_WRITE); } - return notifier_with_return_list_notify(&bs->before_write_notifiers, - req); + bdrv_write_threshold_check_write(bs, offset, bytes); + return 0; case BDRV_TRACKED_TRUNCATE: assert(child->perm & BLK_PERM_RESIZE); return 0; diff --git a/block/write-threshold.c b/block/write-threshold.c index 85b78dc2a9..71df3c434f 100644 --- a/block/write-threshold.c +++ b/block/write-threshold.c @@ -29,14 +29,6 @@ bool bdrv_write_threshold_is_set(const BlockDriverState *bs) return bs->write_threshold_offset > 0; } -static void write_threshold_disable(BlockDriverState *bs) -{ - if (bdrv_write_threshold_is_set(bs)) { - notifier_with_return_remove(&bs->write_threshold_notifier); - bs->write_threshold_offset = 0; - } -} - uint64_t bdrv_write_threshold_exceeded(const BlockDriverState *bs, const BdrvTrackedRequest *req) { @@ -51,55 +43,9 @@ uint64_t bdrv_write_threshold_exceeded(const BlockDriverState *bs, return 0; } -static int coroutine_fn before_write_notify(NotifierWithReturn *notifier, - void *opaque) -{ - BdrvTrackedRequest *req = opaque; - BlockDriverState *bs = req->bs; - uint64_t amount = 0; - - amount = bdrv_write_threshold_exceeded(bs, req); - if (amount > 0) { - qapi_event_send_block_write_threshold( - bs->node_name, - amount, - bs->write_threshold_offset); - - /* autodisable to avoid flooding the monitor */ - write_threshold_disable(bs); - } - - return 0; /* should always let other notifiers run */ -} - -static void write_threshold_register_notifier(BlockDriverState *bs) -{ - bs->write_threshold_notifier.notify = before_write_notify; - bdrv_add_before_write_notifier(bs, &bs->write_threshold_notifier); -} - -static void write_threshold_update(BlockDriverState *bs, - int64_t threshold_bytes) -{ - bs->write_threshold_offset = threshold_bytes; -} - void bdrv_write_threshold_set(BlockDriverState *bs, uint64_t threshold_bytes) { - if (bdrv_write_threshold_is_set(bs)) { - if (threshold_bytes > 0) { - write_threshold_update(bs, threshold_bytes); - } else { - write_threshold_disable(bs); - } - } else { - if (threshold_bytes > 0) { - /* avoid multiple registration */ - write_threshold_register_notifier(bs); - write_threshold_update(bs, threshold_bytes); - } - /* discard bogus disable request */ - } + bs->write_threshold_offset = threshold_bytes; } void qmp_block_set_write_threshold(const char *node_name, @@ -122,3 +68,17 @@ void qmp_block_set_write_threshold(const char *node_name, aio_context_release(aio_context); } + +void bdrv_write_threshold_check_write(BlockDriverState *bs, int64_t offset, + int64_t bytes) +{ + int64_t end = offset + bytes; + uint64_t wtr = bs->write_threshold_offset; + + if (wtr > 0 && end > wtr) { + qapi_event_send_block_write_threshold(bs->node_name, end - wtr, wtr); + + /* autodisable to avoid flooding the monitor */ + bdrv_write_threshold_set(bs, 0); + } +} From patchwork Thu May 6 09:06:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 1474869 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=virtuozzo.com header.i=@virtuozzo.com header.a=rsa-sha256 header.s=selector2 header.b=u+n/L3a3; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 4FbSRH16jhz9sVv for ; Thu, 6 May 2021 19:08:11 +1000 (AEST) Received: from localhost ([::1]:51766 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1leZzN-0002hZ-56 for incoming@patchwork.ozlabs.org; Thu, 06 May 2021 05:08:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60198) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1leZy9-0002D8-82; Thu, 06 May 2021 05:06:53 -0400 Received: from mail-eopbgr60093.outbound.protection.outlook.com ([40.107.6.93]:50670 helo=EUR04-DB3-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 1leZy2-0002tO-24; Thu, 06 May 2021 05:06:52 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ytjejn/fahYCp/YEHQ7TymPgG8exz1ErTS4J+Ck+MzGmyX2ZYCCZuG0LNssOgQaD13WwF3qoblJKi9UvGrzWBH2HTttXsoPUl2sGzw7ckftnF8fcMh549j0SoDFv/vPkJkamAUEAh1ut2QCgSP/n/UcJMEIGwXLMaCss3MLmBIX56LF2G2zG56mdNVgXGs8pV/Hc6uY6bynUgE0p/DzfRuh9OZdfoPO8+inOG130gBCCnkYMiYpklk+u9NQz28P9WeClk/4/J99P+h2I60cXz8yanZhNKpXUrLUdz0AwuN3HF0fCB21OViQXjDGVvnuwZpPuyFwoGBb1HvsWXcXYAg== 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=jJFN0kbNK1HYsScle4BJxnbgfK5v1ltAKvID4Xb5e1I=; b=oM6zQLoKUIaJ0xXMJ4Dsa9q78deTYUOiUhyGHaal8+NwZtgXTQMbT4YuqlOI7bqeAcQa4APxHpWs4gqRmhLP9krFbT5PKCRfNk8c4lWqUfcSkCySqcBbVYsWOHvF/zm3WL2Ze4T0rcpYWplxLbmrXF7XNU6abgwuzP/UAm0wQsDP8K4sSakHyH5wKOjljIaAKjYFylXwAHGRAU9+6OJHmw70sRfkoAhCJKoAO9wRB8iet6rCWsarrkYo6sN575RH9DXOhrrQf3fwtuEzCK8TagCO5fHIAJORTELguH81C0HEATaTrKX7A+2IXJYMdrGaqQQo+onzYtIlRACi+AVOGA== 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=jJFN0kbNK1HYsScle4BJxnbgfK5v1ltAKvID4Xb5e1I=; b=u+n/L3a3YIEvvjIEM6mS6xTkTIozUlVMZRAO5fpFz/2AOmOp2Gvod1pk3dEwZTu8X9b9UQCWBRUmPgx8PacbdPHXwlJ9Npruecmr+AaK3wUD6DKUKSucPeUK+2N79/9mooi0ryJReGdCksVmNFPmSkN5kDmx9V5OIVXvao4xjaE= 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 AM6PR08MB4166.eurprd08.prod.outlook.com (2603:10a6:20b:a6::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.26; Thu, 6 May 2021 09:06:41 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::b403:c1a9:6bb7:133]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::b403:c1a9:6bb7:133%7]) with mapi id 15.20.4108.026; Thu, 6 May 2021 09:06:41 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, fam@euphon.net, stefanha@redhat.com, mreitz@redhat.com, kwolf@redhat.com, vsementsov@virtuozzo.com, eesposit@redhat.com, pbonzini@redhat.com Subject: [PATCH v3 2/8] block: drop write notifiers Date: Thu, 6 May 2021 12:06:15 +0300 Message-Id: <20210506090621.11848-3-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210506090621.11848-1-vsementsov@virtuozzo.com> References: <20210506090621.11848-1-vsementsov@virtuozzo.com> X-Originating-IP: [185.215.60.236] X-ClientProxiedBy: HE1P195CA0011.EURP195.PROD.OUTLOOK.COM (2603:10a6:3:fd::21) 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.236) by HE1P195CA0011.EURP195.PROD.OUTLOOK.COM (2603:10a6:3:fd::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Thu, 6 May 2021 09:06:40 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2ed1aca4-88db-408a-780b-08d9106e4340 X-MS-TrafficTypeDiagnostic: AM6PR08MB4166: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:168; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: uDT7KrqwuS6+WuvNfcM6zC/NZFPfagC2XTTLXvcAdDuRlJ8Tdh+i1Vd+ZXEppUUFGgrcCdqgv+cDnBReOYEAfRbafllWlQq4MKM5xI8DRMmnh7Lme/U4xOjkDjKWUT8AouTDWG12rivQz8u13CRl6ATeiXXonVh6wjHSPLNVlCoMt2Fi94sQe86ox0JUJkWxRpaBFoTASY1RTJNCXndpnlnNe+eBxLF9/zGJ7QewnwVT4Vvf4qBPBYofDi8SpGsLDzrVTO7bM2oE7X28TW4rJts6mU2Q5atUQEYsSuE+yvc9RZ6rW83CsmOgKrAlJk2pr7YKTBO4938lbTeM39nXsnLfVCe6vlaJti5vrmPcoayGo6Igsq8g20gChbbNix/HMd5RYoVh7rqEwVUQKSuGyUXyW+xNX7IKD5vtcJAHXSMQ6x8gJ7aCwueGS0IApD0fp94J2nkDxXcP8EWvls3C4OqAbhH+CPkUK7iYuLvDjkbAxkJ77bQBYIVkqDyCncQpIl47XSmQzFYfHDyJI2FZBQh0y+025p1E0ranoUeHvRSSs0MtYEjISUBlpyBwWLZrkJtCnfCSPDOcevgffKLHB/AOBivnP4auYWL0+FZ4PDc9Wea1cLcVy7ezpNhzmJa0FvhhUXCHHonoT7jNSH/2GM7pxM5cbdxEIoZYGZzN8L1FtpWJ/zGRt39O8dnMBiSg 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; SFS:(4636009)(396003)(39840400004)(346002)(366004)(376002)(136003)(86362001)(66556008)(6512007)(8936002)(66476007)(66946007)(316002)(6666004)(8676002)(36756003)(6486002)(1076003)(52116002)(4326008)(478600001)(2906002)(956004)(186003)(83380400001)(6916009)(6506007)(38350700002)(2616005)(38100700002)(26005)(16526019)(5660300002)(69590400013); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: PHsTBX0AzKprTtbvlCJ5gXgZ76yVtSTMYcZY5V1s9YAb1n2xSIbwZhvbvUb8UpWTp6gquAIk2MCEZAgZ9LFlXfWiDc3JLw7kxntpX8qESRodQEEAzoQMQ6lEoESIpjoyAWChFeBrPUHCSiS5X8mcCQdYJeYgMfgOHxRqNQNOOIyqmgumf8lsDIPFJzJnLM2YmT/49Lrp2nn/jvB4wRJbmEbVyUQywpxwIvJqKZSS9rEk6vQnkIFUVY39fBFgQ6D5q3LMty2EIE9bY273VxDQBwuidNp+1A62DPjLcbtvBfIVFc1q+/12Oc0RnymxcE6JU0WG2ppIgQYOr0TP7cQ/p1z6nubmGclcbg3b6xGecsMGze1YVvfoAmLkr7q/PrH7CkUqiOYOBUdT3PJ0GSuyOb5vkLW2EWbhibRz/LjKFHSOFwdndH5SXvr3dmMev8TCAGt4XyNUolB23CegXzFIvNJmnDkOV81WRYvgOJrmSaucf/TkYhg2c1KN1uSejwmSnQ9wzPW9r+96wtj3pABlPCH02I+fD8qf1mwprz1QFSqZMA5CGMYLxcz5uvzZVzd6KtACTx2fUsaL4wsTyfkbhrF7avDAVsqylD2FKY2GPfN9fAG218QGGTuosR2lpvjH7y53xnyE7cg84R6n6dYKHl+bdEAsukVyS29XQ2+vv+TEC2IBwf5W6gNrY7YnGh8o5uEWf5LyidBpW9F5J++A0KZpcP6kHGscU2uH2HciAUKGZSpVfGKZQv2p3bZyXv2gE38WVIDNMS0TEQznpNUSyhLh5s5vIeMX1jp5RKrD5xwg1DwO8f41yjkY+f4S+ljjn1kwmos5qFLKUmQR6y5VrxDizDKN+VqtVQpMHlE6Ss4EY+/HsfciTGtUQhbWpQHTvsR4E8QpiQ9QUt14ckVzEdv8j+ukVGC74yxY6ryWYa/vikhPVfhFY56XGRll3K4HNOoqfiLkpRO2bJzG/fdoGikS2s1Ru568XoY9ctNt8NLMYShPCEJY++IXkitdJnESY6ZPfWkG061ZMjn3HLN4pUyw5W/De/LqogdWB1+y0WNWdOjiBPlazKabqf3lnZXzrU3/r/RqAzYq5O7O9hNKjwgUwbVrXJEaR2TmPK13/FG/OOP6kjmVzDs9RmLe0sKbc2DH4SJ+lSj8cEK+Gz7IVhBB6Vs2a1ICgcD+0AdIdq/4qg8mv1U+S1AeYe2nhk7pPfm5uhB0Mi7kzM/tYP8kFQPm5F8NGOZMC21QHXkhfBkXND6Eq+igVLOBcYGghRBx6Lua2+oUTa70nD1bY17dgJkyvlx/Cpqf4ih0Rywk35X+VqMEDNT14tTMmlqG+/dr X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2ed1aca4-88db-408a-780b-08d9106e4340 X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 May 2021 09:06:41.1586 (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: iFxh+qscKEY6Nqjjw86ED1NSHwpBimry+cLgWN1sV9ZGS8mpvXP5++fkbVrZ2Xh/ZK+sghUurBUkTlHg8haMdhe8BLxAyUMfFGlEuQlkvC4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB4166 Received-SPF: pass client-ip=40.107.6.93; envelope-from=vsementsov@virtuozzo.com; helo=EUR04-DB3-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no 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: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" They are unused now. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Max Reitz --- include/block/block_int.h | 12 ------------ block.c | 1 - block/io.c | 6 ------ 3 files changed, 19 deletions(-) diff --git a/include/block/block_int.h b/include/block/block_int.h index 51f51286a5..eab352f363 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -954,9 +954,6 @@ struct BlockDriverState { */ int64_t total_sectors; - /* Callback before write request is processed */ - NotifierWithReturnList before_write_notifiers; - /* threshold limit for writes, in bytes. "High water mark". */ uint64_t write_threshold_offset; @@ -1083,15 +1080,6 @@ void bdrv_parse_filename_strip_prefix(const char *filename, const char *prefix, bool bdrv_backing_overridden(BlockDriverState *bs); -/** - * bdrv_add_before_write_notifier: - * - * Register a callback that is invoked before write requests are processed but - * after any throttling or waiting for overlapping requests. - */ -void bdrv_add_before_write_notifier(BlockDriverState *bs, - NotifierWithReturn *notifier); - /** * bdrv_add_aio_context_notifier: * diff --git a/block.c b/block.c index 9ad725d205..75a82af641 100644 --- a/block.c +++ b/block.c @@ -400,7 +400,6 @@ BlockDriverState *bdrv_new(void) for (i = 0; i < BLOCK_OP_TYPE_MAX; i++) { QLIST_INIT(&bs->op_blockers[i]); } - notifier_with_return_list_init(&bs->before_write_notifiers); qemu_co_mutex_init(&bs->reqs_lock); qemu_mutex_init(&bs->dirty_bitmap_mutex); bs->refcnt = 1; diff --git a/block/io.c b/block/io.c index 3520de51bb..1e826ba9e8 100644 --- a/block/io.c +++ b/block/io.c @@ -3165,12 +3165,6 @@ bool bdrv_qiov_is_aligned(BlockDriverState *bs, QEMUIOVector *qiov) return true; } -void bdrv_add_before_write_notifier(BlockDriverState *bs, - NotifierWithReturn *notifier) -{ - notifier_with_return_list_add(&bs->before_write_notifiers, notifier); -} - void bdrv_io_plug(BlockDriverState *bs) { BdrvChild *child; From patchwork Thu May 6 09:06:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 1474873 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=virtuozzo.com header.i=@virtuozzo.com header.a=rsa-sha256 header.s=selector2 header.b=m/CmO9Bm; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 4FbSVv4RmRz9sVv for ; Thu, 6 May 2021 19:11:18 +1000 (AEST) Received: from localhost ([::1]:32908 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lea2N-0006dT-8H for incoming@patchwork.ozlabs.org; Thu, 06 May 2021 05:11:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60264) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1leZyF-0002JU-A7; Thu, 06 May 2021 05:06:59 -0400 Received: from mail-eopbgr60093.outbound.protection.outlook.com ([40.107.6.93]:50670 helo=EUR04-DB3-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 1leZyA-0002tO-0W; Thu, 06 May 2021 05:06:58 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=H7euIPuIg8TNArmgLbQmfXqw76tB4GNf5sOE/gEOnzTgmDPP9bKmCoHCnnaJqi8RS2GahFY/J9XCWQN1HVmx4bCrgoGGL+tT92tHDdjpcceDMbcO4blwffVs9LxmfERaUyoMcQSS40HCDZwJMgbK2RhocPvSTfxZ8fUoAgD9642N6iICs6jBDlaAOTbZsmu17ZkZZBEsyH1M/uykbBXXCZ04iXwioYjwFrQlJgDYTpZNBDFTYHZsjyZ6AohQ7kDnlymUAPsQ/ztJhKTit2ymu1+SivDrUixx9O6WeNasOpmasjp3WIOsJ/euwYIYrHQ5nInRZMCWGZXMX4twHy13Qw== 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=9FvT0LdMwFqZ+YvLnNkb76dJG95GnOtmrxKV6bx2BlU=; b=gXTu70KgfafHUBXyIZJjJ9wf4ulPZbXtWRhPz8Ycb5JyGXfKm8viTUJWwyfYun6iA2pR5JxNPD47S0bTxY1NhbjVsBpf1n5RHsg59sEmYlZzReGlxclzO2Vo/NSfn9NqdIl+VHyBTtYooPPvqfZAGATVqwHZQDE3tz/UF2YX2clhCyLoi1RHAF7ybf/3bpIJGDsqu6UZykaJMARfCMy8owErHJDYURpQTBOZbEU/4tkJnOXsfV3BL0QAqBtWgN4soDkYZy+I4rahWBaMx5oHSHgcTJgGdgqEq8+7DrGNf0dOBmFm64FGaDEUGckx7gmKuzWXEvGo9qBOX0i3Go78ow== 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=9FvT0LdMwFqZ+YvLnNkb76dJG95GnOtmrxKV6bx2BlU=; b=m/CmO9BmEiB65YrHGZmTmKPYKIvFLlnk3RdbDbnU+e4soy0xgq6yIkSrYz/o6nczFWFjMIWcuUOm3cFy0B7Jfj3sggU30W9ttHRgmBPUTCar3sQfx3cjHkHcWcwMzuzASQAOeIp+atf5/nM9SV9why17Mf91/j2H06VtLtpCCnY= 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 AM6PR08MB4166.eurprd08.prod.outlook.com (2603:10a6:20b:a6::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.26; Thu, 6 May 2021 09:06:42 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::b403:c1a9:6bb7:133]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::b403:c1a9:6bb7:133%7]) with mapi id 15.20.4108.026; Thu, 6 May 2021 09:06:42 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, fam@euphon.net, stefanha@redhat.com, mreitz@redhat.com, kwolf@redhat.com, vsementsov@virtuozzo.com, eesposit@redhat.com, pbonzini@redhat.com Subject: [PATCH v3 3/8] test-write-threshold: rewrite test_threshold_(not_)trigger tests Date: Thu, 6 May 2021 12:06:16 +0300 Message-Id: <20210506090621.11848-4-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210506090621.11848-1-vsementsov@virtuozzo.com> References: <20210506090621.11848-1-vsementsov@virtuozzo.com> X-Originating-IP: [185.215.60.236] X-ClientProxiedBy: HE1P195CA0011.EURP195.PROD.OUTLOOK.COM (2603:10a6:3:fd::21) 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.236) by HE1P195CA0011.EURP195.PROD.OUTLOOK.COM (2603:10a6:3:fd::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Thu, 6 May 2021 09:06:41 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5f9d02bf-5bda-49d0-a8a9-08d9106e43ed X-MS-TrafficTypeDiagnostic: AM6PR08MB4166: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:569; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: oSjSLXZjp7L60lTeUmwl83pkF0JvEZPhWhPdFJrb8qwSGNGK997H6rtYRkqete6H01VMPSdly82tWKRcYh4wzUCAITOI2emcqdUd2NFb8vhn/bAnhT8MasOa3Iyt64mxa8gc6HcLk9rrQmyH6QUVs1LRu9GLJ+5DpynGneRXvCyDOcnZPsaqSYeKKE23tV8j7gMMcxMi1wyYk3BPDRT+1Pk47F2SXRbFQi798ExUdkeuKxxldAaljjqQfYHI1Nb0BQy9b4PJZkvgcZyvoddVaezspGprGqOHmcjN33Dcj38EYn8U2HrTQUljGIdYvxhiL+cEgF60C8IcDpdYwVFkISA/jeRXg99JsjHxwn6FY5ZZz0wNsCrTTtcewCFxKVEvXSeyXQ3KrIZXmSrb6R4wLDRwtwGxmWfPd3FZx7BWE5WlQjwc0Uf0D7kULuQazO3JHzEuS+8XlESL5bGDrO7qKmoesa0HQXa1wlS08SSTHR+kyGEx9/yjJMI9bgMQQshmi5arD09A7pqZCsj7Zmf1R5N7L2QqGc02qTVCnak+Ohu+Y73S/7wfRT12ylDZCT5HImNsxRSMQE41rP5guvmQH9qxJ1CHlO+luo0cQ2Rz+2jHvElv5HfPMifWK5XJMTwJ1bgU4X+ABxQtgO7K/fOZacR0q0mxzV7zJ/aNW+mmec8lc6pgzrZ8F4Hy1X87Uzja 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; SFS:(4636009)(396003)(39840400004)(346002)(366004)(376002)(136003)(86362001)(66556008)(6512007)(8936002)(66476007)(66946007)(316002)(6666004)(8676002)(36756003)(6486002)(1076003)(52116002)(4326008)(478600001)(2906002)(956004)(186003)(83380400001)(6916009)(6506007)(38350700002)(2616005)(38100700002)(26005)(16526019)(5660300002)(69590400013); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: A5Lo6eXNtfMD70TtbHUGH05uEy/Lzyg2HtCfrYKyeD1YDAAfLpeB804gSMDQxUys27hlKagtH0K/71pwgbrOyxSPPMvBj3RM0N/9cOa5X78V7lrK7e5TyZLTP2wZyqNznTf0zWEOUV9U07hSFKakoyQd9vd/Im3itShX2cAA1RR5vBdmAs8qkIs5wg0nAVk2ZO4TFCBXHf61mdRf+/zZSsZLg/U9s67VqmSt9ylhrsJjRtR9f5GsLyEkG5z/VGxWj3f6+hMiyl6UZL5CDXd5vEZyYWxxibVh4wOzeBsZQcOosa+EhcEbMygcm9bhIwDxhnbschFmBzxrZG7SNPuOkHBA/exh6bTtVE8lrzm2MawcFQxYwlqmnCqAwQKRd457KoEI1z4vloPZM8YBA/782/WZRJw5eQcT9162EgsXYBywg6/BSEVZv0YcKzOKRWTPvkQaj4vI80bFUjr/RNCVDKajZXHxfVQ2S58cAbxEo2qEx6mHQ/Qi1NpuNCgu2C+1Ewu0ZErz6Z2jnX3BgxDaDMlY+UrBk4R0TCv6h/4EsjznSUatn21h9ktHB9lypsot+at40QxeEq2puArvDai8vShCu9lbiLLkC7FcHkx3xvrprl6gGE0ebBbmatDNo1ph5NZJoYKPd2Hy/8aRKn2arTTHJJ1usEwqebwBm4tEhGgN1boMi1T+hWcxTfONEVhbsb55r/tMnMfm2jrAhrd1Vsz9KSUcCg02BZf59OlQAHOwaZ/TY8c73uyG/wm8sHclRD7AXAQI20BTQwE0QKFS/C0NmcGIrEGGy3XtIogZFovw801ejfQkNhNVJX8h76+1ukJsikiDwYpxpADUNNjHba9Zwfl8FED6tRGQtwvQnu9zpgEhFPF3fJFA+mbVw5M/AYFbrHAheM5SFeAHDiTJYGRM0Sedt7Er+DfWZVNrBarWkdzJEaSC8FsRf2KYaJSQD+UNpp0O5wahL59+5lE4NhqQBNWMpcAbM16HB10LTn93QULPQekw/AoebX3fHn58ipRTO6fyrmFcoGKlD/6kL1i2wjeulBKtIxx0c7++CLPdFcmp8rHmBbo2tQJfYnoZirWGdohMYIalzunBAPqLkeOyoEJgjkYVlSj32MJD4jHQK/iHZDriWvQQIi023j5aei2oZTVVWBGtrrn6dTQfwANRK1fxx86pSd2g8DaEYO00tWU2Jcz8FKugqCQSfIumnRSri2igcYIORgFksnuofbH1IpZA/a1dGW86hbHlBRQJZBt94/ENLEOb50B6ZdfzcZclU/Iaz0w2EFlUrYPXxD6hwWUprgro6JfI706sbOSgbRQtfZC2AODrA5GGAHvB X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5f9d02bf-5bda-49d0-a8a9-08d9106e43ed X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 May 2021 09:06:42.3414 (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: l75Bg/dNax/uCTAB8sOjlapicsFby9AFFREYaGT0Eoczm13NiOTalN+07aNg2W45MlnG4SVc7JRhaDZ5q9CRzkmxRTd3imXKJNm7DegOcOo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB4166 Received-SPF: pass client-ip=40.107.6.93; envelope-from=vsementsov@virtuozzo.com; helo=EUR04-DB3-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no 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: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" These tests use bdrv_write_threshold_exceeded() API, which is used only for test (since pre-previous commit). Better is testing real API, which is used in block.c as well. So, let's call bdrv_write_threshold_check_write(), and check is bs->write_threshold_offset cleared or not (it's cleared iff threshold triggered). Also we get rid of BdrvTrackedRequest use here. Note, that paranoiac bdrv_check_request() calls were added in 8b1170012b1 to protect BdrvTrackedRequest. Drop them now. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Max Reitz --- tests/unit/test-write-threshold.c | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/tests/unit/test-write-threshold.c b/tests/unit/test-write-threshold.c index fc1c45a2eb..fd40a815b8 100644 --- a/tests/unit/test-write-threshold.c +++ b/tests/unit/test-write-threshold.c @@ -55,41 +55,27 @@ static void test_threshold_multi_set_get(void) static void test_threshold_not_trigger(void) { - uint64_t amount = 0; uint64_t threshold = 4 * 1024 * 1024; BlockDriverState bs; - BdrvTrackedRequest req; memset(&bs, 0, sizeof(bs)); - memset(&req, 0, sizeof(req)); - req.offset = 1024; - req.bytes = 1024; - - bdrv_check_request(req.offset, req.bytes, &error_abort); bdrv_write_threshold_set(&bs, threshold); - amount = bdrv_write_threshold_exceeded(&bs, &req); - g_assert_cmpuint(amount, ==, 0); + bdrv_write_threshold_check_write(&bs, 1024, 1024); + g_assert_cmpuint(bdrv_write_threshold_get(&bs), ==, threshold); } static void test_threshold_trigger(void) { - uint64_t amount = 0; uint64_t threshold = 4 * 1024 * 1024; BlockDriverState bs; - BdrvTrackedRequest req; memset(&bs, 0, sizeof(bs)); - memset(&req, 0, sizeof(req)); - req.offset = (4 * 1024 * 1024) - 1024; - req.bytes = 2 * 1024; - - bdrv_check_request(req.offset, req.bytes, &error_abort); bdrv_write_threshold_set(&bs, threshold); - amount = bdrv_write_threshold_exceeded(&bs, &req); - g_assert_cmpuint(amount, >=, 1024); + bdrv_write_threshold_check_write(&bs, threshold - 1024, 2 * 1024); + g_assert_cmpuint(bdrv_write_threshold_get(&bs), ==, 0); } typedef struct TestStruct { From patchwork Thu May 6 09:06:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 1474876 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=virtuozzo.com header.i=@virtuozzo.com header.a=rsa-sha256 header.s=selector2 header.b=RdyDflDy; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 4FbSbB57Smz9sW4 for ; Thu, 6 May 2021 19:15:02 +1000 (AEST) Received: from localhost ([::1]:42128 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lea60-0002HO-MP for incoming@patchwork.ozlabs.org; Thu, 06 May 2021 05:15:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60300) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1leZyI-0002RA-5A; Thu, 06 May 2021 05:07:02 -0400 Received: from mail-eopbgr60093.outbound.protection.outlook.com ([40.107.6.93]:50670 helo=EUR04-DB3-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 1leZyF-0002tO-Uu; Thu, 06 May 2021 05:07:01 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SNudTH6RVnoEx+Mu+anf+gYewiyiRmTdtYb6rENqp7VVIFSIJWl/k2Liqu/4jkuKyLLduXr9H1e676mpngr31LIirRX6J4b8YfWKwYUWv++VlTRLyoGq6cdDa5JKYnIBAJjdTzYz86NjnnnXjhoVclolfH4yca25QR5P3mzxeanpU0LQ+n/ERKKDiAU0XP7X0LMAQACoDuAuPiSlq8Dfl4gWELScSBYdlScOE+UZPH77KvMJq/STw5EmEjxbGP/iQilbeaXzgooLprrT9T313Vzc+qPv0/uDCOKDjtPaNDuOOs+LM9HzRLBGmsa6wV1hciT6bUPE7ZWBiCtqzQn6fg== 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=wiCXCrN7gt37Xiv+B5Eb134+ojHTs61X0eeJFlW/qSs=; b=PMO5KemAHR2mXLJK1BAVJgsou/5yW+UjeNuxSeGyovwEvnbEIyKEp4m9UJ0fG/btEVdXDh7wAaFGlN590NJKn+rEWYBYR7nm2vtKWElBM1Tg9DbUWhZoT5RBnVGUnryeUwfMT8hjTYZLD31TkDYuCueHX+3+Xip9LWt+/wgl+iXVFqTjm/9RA48ejKInu6uCXnqfsuqwFvjhnd0H3mJ4YXN3d9T8KYxutrbe/6vBhcUKo4MIR6nkU2aZuvAwDxCRZS0mBH9jNv6X4xLeIrL2YdxlKmMmBXTivXxk6b7EHcRtT+VdUgl8nArmTrfgIoacdLrJYTYijMlci+8odgqLCA== 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=wiCXCrN7gt37Xiv+B5Eb134+ojHTs61X0eeJFlW/qSs=; b=RdyDflDyjssTSt2EkVyCKwssK1lXCEtuDj+cGPtrVyUHyDGhO1wiGXWYNIBU6eapC1EDZmxXNThzfvJTDZSsG0h0p0PpsOtW3E2uX3jo3VZno5/3Yj2Nll5+fayrMtMwwyl8OnxsY0iuhJpBsv48S3LjKeu0la/jUErSQ2D1n7A= 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 AM6PR08MB4166.eurprd08.prod.outlook.com (2603:10a6:20b:a6::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.26; Thu, 6 May 2021 09:06:43 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::b403:c1a9:6bb7:133]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::b403:c1a9:6bb7:133%7]) with mapi id 15.20.4108.026; Thu, 6 May 2021 09:06:43 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, fam@euphon.net, stefanha@redhat.com, mreitz@redhat.com, kwolf@redhat.com, vsementsov@virtuozzo.com, eesposit@redhat.com, pbonzini@redhat.com Subject: [PATCH v3 4/8] block/write-threshold: drop extra APIs Date: Thu, 6 May 2021 12:06:17 +0300 Message-Id: <20210506090621.11848-5-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210506090621.11848-1-vsementsov@virtuozzo.com> References: <20210506090621.11848-1-vsementsov@virtuozzo.com> X-Originating-IP: [185.215.60.236] X-ClientProxiedBy: HE1P195CA0011.EURP195.PROD.OUTLOOK.COM (2603:10a6:3:fd::21) 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.236) by HE1P195CA0011.EURP195.PROD.OUTLOOK.COM (2603:10a6:3:fd::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Thu, 6 May 2021 09:06:42 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9892681d-03f1-48c8-8f03-08d9106e449f X-MS-TrafficTypeDiagnostic: AM6PR08MB4166: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: e9dBjS2u/QvVuYNHSX58qmYg6ys5XyjptbQ9bvWdp37vOQa2fnCjsB77kkM9nTYm+8TY6otMYwW9YtsG9DgQw7R0VaYIWiqj2SQooVrIVvjHYBCDfoYRuhpms0425PeyU0MkAJoW6xxdxxHrJd7yYfYxnrKaqky0jh+M887ES7Tng/UcQTtqSoVdwPgv9As8TayErbSwSFQzMr271R+v7csVZ92d/ktQNtoV/yAQcAmFnWaj531tJ5ZTrN2DIf5kI/LNJhWkZNGeLPNbBllWiN1LjRwmxrry4CdussL3NwHNkfYghmyFWMflSdY33iV0CA1Xi5xNX7o3b41WiP+/t5Ff6+ocCGh4OblCEIs1RaeAnqB6AoHZEzbnxuDMJYIdJE1rMKSIqvstkMixhlITeu8vUiiiHhsDkF7l/0wLo7V1HqM8ki/HgVHCBH5dUKiMeowts+mxrsAiep2DaZafGFo6vQxd7+mE6n+Puh9Ltm+NVPyO5sqqf04XsHbDh3LqpSoWZB3qwVB2rd7aDBDvMA1lBERhUPnJusMvgMfCVfO99kwGpe8lj/4e23cA7IYhS+7q2dnNLwHnDZ7In9RwkLXehk+3xLPHfx+ZnYkbXsi/dJAEjh5jrnWnjCjiDC6EM4ZZGW7hzKhoGJVtEIwCecSTdbTSR8p4stlqCyBNXa1CcIAE2ssCUS6ReVbcy8Ui 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; SFS:(4636009)(396003)(39840400004)(346002)(366004)(376002)(136003)(86362001)(66556008)(6512007)(8936002)(66476007)(66946007)(316002)(6666004)(8676002)(36756003)(6486002)(1076003)(52116002)(4326008)(478600001)(2906002)(956004)(186003)(83380400001)(6916009)(6506007)(38350700002)(2616005)(38100700002)(26005)(16526019)(5660300002)(69590400013); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: ex2bJz2Ap/nWXlTyUdAGP241PbjdQhjakGM507fCUyK7tSoawTn7506PjHW6pnSW8+FKkzIbRpzpDrY851NZQqN3KYsVEcwiLeDdX0rOmTAVHe17RC2FNXJ72VqORowWBti9pYvnBH6HoegoCQACQMOGzjS/Qk4729mAlGmo1/VjOk2ZmLgun63WfMAFbgeo0N7qm55nLFoAioU3KY341BLLqxE5euX3yEZIlTEDyjGbShVIaZSTLyCoVNuLCme1c2AXlAK9f5E4U1Tl5L38QAEE2hIXkLa/iNSabl1Iw7CSvoklync61eoTFCPLaAgcVOyUTVOgu9DyYApgP/ZfosgTcMZGx61N9P5D/jMP3Ywu3Srs0W2rXxrLzHZ1GRG3ysKzm18Wz91/ZuksPmDl4tdg4f7k4GG5265RM4yvMksCYIANpp4NWGQupI4VugbzrtXCXuA3ruVBTMenpLyXtpx4Wo3wBhzurbuHEZK279Uo/xWM1srQoiocv7QcBR1rQoFg8ZiEg7diwPjWNBJfkDd9eeOEimLBDqfi8Wa1Jct8ehzzXICc1yRlajUXq5Zh548f0rgEiRvIHS5B2EdxLmMa/7+EMEDVfeTyEVQsrt53hxdYtRb3jS+n/Iw0jh4RDdl+ZD+oDFYR9QTH9lZEeef9fGm3Wxf1J4eRSatQzGWaiOP38zcUvEpxz3cU373MGXDacwocNTRCp+UKwZh3gYMnocBCG6W2xATMqfecHEkDncDaVL6px0hFNkYaUtq0CipPvNVSh9kTfvan2fzN1+sunHB24FxXZ39NWKCbAkpIv/l9i5imuENP5xhHxxAxrlIXzIVo6zs3I1eBoNiqgtPtURwnLrY9E8UDSnWf6gXtKh/Xf/x+Kgtfonvdec50qkXcfaQ61ULDEhw8NB/MyRtxtMFKW/2MNF54s8Hi39QshZxto5KL/biPNAip/awLT2NzHexC2VPN7geRMe88E7/HR3qj4mocWAlIExmqKmM93bOLT8RxnPRdU3jqyLt12d8DpBFskVhAKltLm1HWDaLRH0Q4iSrv+Ba7ATn0zEuydeXHv3mX7ZNaSBiR6nQEgjHAQ+HHu3s5Bpcn3Hg7NJYpzKHduju6/oBz7xPVGnd23fGjqtCKSD4B9FChAYx6WDByUo0r38l9W4oO+n+ySHN+/Shwx8guga+vLUwk/UzVHvg2cV6wyeBSYUITkTArvIv7Y7eQwCaDq45+/owZozYWk88OqQMryx5QfTEbRmWxK4Y3UY7ijLRqbQCx5EWDMnJ7gSRj9c/sylzFVjYsNhMWWYm3gxyHg5ZbX40ngtYu2HY9Xso7beWlBfM6lSxs X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9892681d-03f1-48c8-8f03-08d9106e449f X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 May 2021 09:06:43.4435 (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: OqjuhUS03Z3mgypLGyhclsY6pVJrPKGhLZuGZu+UoGyc/JKsVkzBKwIuoeCacSbyqjdYfLfw3e41I8UBTohIKbk25tTachEpNGlWtA3bWNU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB4166 Received-SPF: pass client-ip=40.107.6.93; envelope-from=vsementsov@virtuozzo.com; helo=EUR04-DB3-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no 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: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" bdrv_write_threshold_exceeded() is unused at all. bdrv_write_threshold_is_set() is used only to double check the value of bs->write_threshold_offset in tests. No real sense in it (both tests do check real value with help of bdrv_write_threshold_get()) Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Max Reitz Reviewed-by: Eric Blake --- include/block/write-threshold.h | 24 ------------------------ block/write-threshold.c | 19 ------------------- tests/unit/test-write-threshold.c | 4 ---- 3 files changed, 47 deletions(-) diff --git a/include/block/write-threshold.h b/include/block/write-threshold.h index 555afd0de6..c60b9954cd 100644 --- a/include/block/write-threshold.h +++ b/include/block/write-threshold.h @@ -35,30 +35,6 @@ void bdrv_write_threshold_set(BlockDriverState *bs, uint64_t threshold_bytes); */ uint64_t bdrv_write_threshold_get(const BlockDriverState *bs); -/* - * bdrv_write_threshold_is_set - * - * Tell if a write threshold is set for a given BDS. - */ -bool bdrv_write_threshold_is_set(const BlockDriverState *bs); - -/* - * bdrv_write_threshold_exceeded - * - * Return the extent of a write request that exceeded the threshold, - * or zero if the request is below the threshold. - * Return zero also if the threshold was not set. - * - * NOTE: here we assume the following holds for each request this code - * deals with: - * - * assert((req->offset + req->bytes) <= UINT64_MAX) - * - * Please not there is *not* an actual C assert(). - */ -uint64_t bdrv_write_threshold_exceeded(const BlockDriverState *bs, - const BdrvTrackedRequest *req); - /* * bdrv_write_threshold_check_write * diff --git a/block/write-threshold.c b/block/write-threshold.c index 71df3c434f..65a6acd142 100644 --- a/block/write-threshold.c +++ b/block/write-threshold.c @@ -24,25 +24,6 @@ uint64_t bdrv_write_threshold_get(const BlockDriverState *bs) return bs->write_threshold_offset; } -bool bdrv_write_threshold_is_set(const BlockDriverState *bs) -{ - return bs->write_threshold_offset > 0; -} - -uint64_t bdrv_write_threshold_exceeded(const BlockDriverState *bs, - const BdrvTrackedRequest *req) -{ - if (bdrv_write_threshold_is_set(bs)) { - if (req->offset > bs->write_threshold_offset) { - return (req->offset - bs->write_threshold_offset) + req->bytes; - } - if ((req->offset + req->bytes) > bs->write_threshold_offset) { - return (req->offset + req->bytes) - bs->write_threshold_offset; - } - } - return 0; -} - void bdrv_write_threshold_set(BlockDriverState *bs, uint64_t threshold_bytes) { bs->write_threshold_offset = threshold_bytes; diff --git a/tests/unit/test-write-threshold.c b/tests/unit/test-write-threshold.c index fd40a815b8..bb5c1a5217 100644 --- a/tests/unit/test-write-threshold.c +++ b/tests/unit/test-write-threshold.c @@ -18,8 +18,6 @@ static void test_threshold_not_set_on_init(void) BlockDriverState bs; memset(&bs, 0, sizeof(bs)); - g_assert(!bdrv_write_threshold_is_set(&bs)); - res = bdrv_write_threshold_get(&bs); g_assert_cmpint(res, ==, 0); } @@ -33,8 +31,6 @@ static void test_threshold_set_get(void) bdrv_write_threshold_set(&bs, threshold); - g_assert(bdrv_write_threshold_is_set(&bs)); - res = bdrv_write_threshold_get(&bs); g_assert_cmpint(res, ==, threshold); } From patchwork Thu May 6 09:06:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 1474868 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=virtuozzo.com header.i=@virtuozzo.com header.a=rsa-sha256 header.s=selector2 header.b=Dg4QK43k; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 4FbSR73s27z9sVv for ; Thu, 6 May 2021 19:08:03 +1000 (AEST) Received: from localhost ([::1]:51006 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1leZzF-0002IO-0I for incoming@patchwork.ozlabs.org; Thu, 06 May 2021 05:08:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60214) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1leZyA-0002F1-I7; Thu, 06 May 2021 05:06:54 -0400 Received: from mail-vi1eur05on2112.outbound.protection.outlook.com ([40.107.21.112]:60128 helo=EUR05-VI1-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 1leZy3-0002uf-SH; Thu, 06 May 2021 05:06:54 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=U/SSAQqeR0RvHi877kdGTCgZ+ic3prbGn3T/VdKBh5/wPN0+vtEaDxB7v3YGTS+1QldxJOaVZQlV1PCDvUXeG9IMmgg0QPHr+IO79dW70Q75Zvbfde0QeiClwxLPmFA0gEF+LM5FS70dCtmvnsWlZFuJzQbji7hmF6oMQYp4hgUfdjbroeFHIKX7Zqgetv1vbfNfD7DmpC6Yztd4vPEltGxvLhHRfhyLDwd2hs3Pq77KsniFkPxhL8iUdBQC0aCIje3vM+Vv71MfifkrpSUb+pIFGdTZzflKenhdghEIQn+JWmES60v5PI6STU2EcJmSOfP+Lj5Tazof/ftRBuTw5Q== 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=CePFD8c9TOv/xlOEc10/J81vYLbfgSth5XopHc7cplk=; b=LrTg1w76e5ApQ75FPcdesPJZs5CwUqMGyQzRJjHuPEUFdrqum6vSg/fmshba32G908M39259rrBHbrvY6UuNlfqDGAsn9+5zv6o2SHax5AA3J78wu3I6V6UlgcYfUMKCDuZTNPuhJuipMGYzhfS00/eCOZw+W8VTFb+mLP/k8LfshrjL+1nrvT8s/T9ix2gqa4KPbb3GgwbHmaOVwDOrlP4ea6vUcuC98IdL5EsECfbFTUiTgrnDJEh1yK/fPOHBhfiIDPp03qKqUxK9NneTgcDxkzeLruTiniRYwKLhxE7SxYS5y72Wb8WfqblQmhqevX6ajDMRxI4pSrBzHAG34w== 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=CePFD8c9TOv/xlOEc10/J81vYLbfgSth5XopHc7cplk=; b=Dg4QK43kWui1rRY/a32okOLUilXIvTfbRu8FHdoDn549psDwMLW5fXqrhbJ7R7yc8JWByYyLJlxdGWo9YQQBpa11Y0wTE8i9KZoJ8fOO0dYqOJnZC9jPCg629CJ0ESoPTh7AKe91SyFbtIQLzFzafXOUbMrBaTDVnI6c+9wckw0= 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 AM5PR0801MB1715.eurprd08.prod.outlook.com (2603:10a6:203:3c::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25; Thu, 6 May 2021 09:06:44 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::b403:c1a9:6bb7:133]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::b403:c1a9:6bb7:133%7]) with mapi id 15.20.4108.026; Thu, 6 May 2021 09:06:44 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, fam@euphon.net, stefanha@redhat.com, mreitz@redhat.com, kwolf@redhat.com, vsementsov@virtuozzo.com, eesposit@redhat.com, pbonzini@redhat.com Subject: [PATCH v3 5/8] block/write-threshold: don't use aio context lock Date: Thu, 6 May 2021 12:06:18 +0300 Message-Id: <20210506090621.11848-6-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210506090621.11848-1-vsementsov@virtuozzo.com> References: <20210506090621.11848-1-vsementsov@virtuozzo.com> X-Originating-IP: [185.215.60.236] X-ClientProxiedBy: HE1P195CA0011.EURP195.PROD.OUTLOOK.COM (2603:10a6:3:fd::21) 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.236) by HE1P195CA0011.EURP195.PROD.OUTLOOK.COM (2603:10a6:3:fd::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Thu, 6 May 2021 09:06:43 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 19897e57-9f79-4512-74e2-08d9106e4545 X-MS-TrafficTypeDiagnostic: AM5PR0801MB1715: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:901; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GSgMZ6s2r2u19AbFlp+5DvY6RUH0b5fmj+Nxro/k1sssCMUc/XA0sScu4hdbxBmeMYiFaV0G90Gc7bleZAZBY9XZwj9IRc8aOg9x8ohy1eRHWVYCp9AsnBQBMsC3odhvOGQR0mtKAqAnx4whz8SNdnusCvOSdYRlbeBYLChqeZ6Dr2rAnOcupb4RT3IT4dXzS0FlKs+xdFZia7KcSQeODDWpJEAudH3xzG8nCTDjdAwd0pYHVBt0+nRlaapNCZVCwSV8GQCD1zv3pl9OQanlGB5dvOJH5KUjLlrhpCiiGtCv7vzxEz9cPRR5sgXxHbt1SQzeG+tLXZLGyWkC4f8aTsFD32a02T0NSS0iY3E2MVPqY/uNhmxYZaPoKS7/HswxyR/xQ5M5Wt26hJSKEM8DSNVGxVAiI4EsC6VtAjsXKzJBE8m47UyWEbDTRYtSs5mYcA1EDpxQUj7jU9Du5QVih6YBgk+HSE3Vn1nhfdeL+Ed86qWj5sJLkT0eP5xdTVfQHlNpbLEklWjP/53fhhJ8yvEIzbOkS0Yi1boLrF4haAGCQGalkJNXv3adFvOHI+NtKjRdCAB3JJpWrN2vu17BahVGMv/ic+p/z6fM+GlXPtC2jA0zIkUjtubSInehTpncuipaILNZFkkpdfcFtBeU+pAII8XIjSa85IQJKxAk9lk1ggHqp8ZFoB4iM7h33Qqg 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; SFS:(4636009)(396003)(346002)(39840400004)(136003)(366004)(376002)(36756003)(8676002)(6916009)(52116002)(6506007)(6486002)(6512007)(1076003)(2906002)(66476007)(66556008)(66946007)(5660300002)(4326008)(38350700002)(186003)(478600001)(86362001)(16526019)(38100700002)(6666004)(26005)(8936002)(2616005)(956004)(83380400001)(316002)(69590400013); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: wope9m3q6p7d4G07LyHpTUnaHsToMrsBV0SbdfjdWRd439eQbPAPBsHKZt8bJGSW3ciwPKkAqMgKpQsLeISYBua+LMO5yaRXeZjVi2OVCRLoueX4S/gfLSIas2i8xvnoVcCyJPuAxYY8bK7fnSzCODp/wIbwcrlshB1bne9dh6Lx8ufOBjKaawYknuzzMzx7Cx6RAK4+X5j+maQqsK5Yd+UnqbN4qTHOz7Qr5XNQdocUzJQVedx0KGKP7B6jW0OW0dSxHBmtp3xmjwuFQ6u1I51MPHiZI22DG/EuUtuBUw0+s7fVjyPMgYzhiW1gZqhiazndW3u5ft3kJ8TPXL7h7PwDrkRhD1CIT8Q/N64ETqfp2Gsfwop7faP0TxSBJosm6Hjduc7gf+OQC7KyUfntP5U3JjtXLfKrzNfFEGGRjdMxgKuQWK7XvNnN/Hf4O5Q1S/H7s7atpz5BW7nIYuFJUuVEdj618+DdtgMAxOQ3G7iqMg9CvVCU+8IbsDGTkiciOv9w8y9iMM5GwoYLoFC4Yxhm2QO5rkiJjL+1IdRuzncQePI1RJUKTcbC+nodL1WHjO9w/FhlC8vcBmOefAIujKEccSgz4kcpbYmGXmds+XNq23Vp9R/3WeIwXjMYIl7w/yCBE8N1Lz3VE9JN+SExT6ORwnozF7/v7/1OnAfsn50y9z0e2RayZ1u1VKX6a1i+vBL4W2hOsxgKMRI3GNZf0QXwImGzjl1A0mBEXdeOma8aQ+RsbP6XW8FkoPLeqx9WLzF3DLL2mbCGCE4SCRfWR49+LF7i5ZBG5d1BSeLmrQZU9GkSc2XhB7EhyqBuNAT64i5p4jo5DN5ocGnyfgjvOlthgrnB/Ji5NN6xclhOlhS5IWK2l6BdPxPCsJjHYa9RAo58jy5vwFk6y5igxkwYvZG76DNQGaKmFPpvbnSYQrVSWEs6UvvI28GfNGc3OQDyombeYfQNBlWFGiXAqSvLhmv6ZFNWisrYE5mt+/9x7qn5Hz2bJnB/kgjbNCdO/xK9v/D+tu2Jwtbe5CtnpZCRYGJNKs5rY7x+Jx1LUZHJHKdYj6HcysXgduLORFF3UspFzaiKedWL1JZ4xqbilC2H3pivhq4wVXIjQ5OOrtgPtdhsQf2Gh1Nun40A9FyxXQA9eXqXAZN3PiJeIvkaBIUgber5V2+n+XOH8U1D7oWhftwRuUVj5YKiFOAns4aOZg4McB2jNMEvSfYp3lhusEe7d78rehnqn/n8ayMP4Kru/zDa4PxqEezYGECAt3d3dwRRi8E/+DZFeDsZraZQeOljGqzmC1RGwX4R7ZF29FJ/zPAH7/enojLrgpjwkZaWgPbb X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 19897e57-9f79-4512-74e2-08d9106e4545 X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 May 2021 09:06:44.5815 (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: M2/I8xKMbneeQlUERAb0v/U33BbKybZ3TDzt/cLQKV1ME9hQ0SoOd4w1jb3VRrhXEDphIgWOML2B90A6KSoEMC8QB3QxtG+vW5VlRKhEaMA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0801MB1715 Received-SPF: pass client-ip=40.107.21.112; envelope-from=vsementsov@virtuozzo.com; helo=EUR05-VI1-obe.outbound.protection.outlook.com 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 autolearn=ham autolearn_force=no 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: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Instead of relying on aio context lock, let's make use of atomic operations. The tricky place is bdrv_write_threshold_check_write(): we want atomically unset bs->write_threshold_offset iff offset + bytes > bs->write_threshold_offset We don't have such atomic operation, so let's go in a loop: 1. fetch wtr atomically 2. if condition satisfied, try cmpxchg (if not satisfied, we are done, don't send event) 3. if cmpxchg succeeded, we are done (send event), else go to [1] Signed-off-by: Vladimir Sementsov-Ogievskiy --- include/block/block_int.h | 6 +++++- include/block/write-threshold.h | 6 ++++++ block/write-threshold.c | 34 +++++++++++++++++---------------- 3 files changed, 29 insertions(+), 17 deletions(-) diff --git a/include/block/block_int.h b/include/block/block_int.h index eab352f363..e3f3d79f5b 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -954,7 +954,11 @@ struct BlockDriverState { */ int64_t total_sectors; - /* threshold limit for writes, in bytes. "High water mark". */ + /* + * Threshold limit for writes, in bytes. "High water mark". + * Don't access directly, use bdrw_write_threshold* interface. + * Protected by atomic access, no lock is needed. + */ uint64_t write_threshold_offset; /* Writing to the list requires the BQL _and_ the dirty_bitmap_mutex. diff --git a/include/block/write-threshold.h b/include/block/write-threshold.h index c60b9954cd..28c35a1c05 100644 --- a/include/block/write-threshold.h +++ b/include/block/write-threshold.h @@ -24,6 +24,8 @@ * To be used with thin-provisioned block devices. * * Use threshold_bytes == 0 to disable. + * + * Function is thread-safe, no lock is needed. */ void bdrv_write_threshold_set(BlockDriverState *bs, uint64_t threshold_bytes); @@ -32,6 +34,8 @@ void bdrv_write_threshold_set(BlockDriverState *bs, uint64_t threshold_bytes); * * Get the configured write threshold, in bytes. * Zero means no threshold configured. + * + * Function is thread-safe, no lock is needed. */ uint64_t bdrv_write_threshold_get(const BlockDriverState *bs); @@ -40,6 +44,8 @@ uint64_t bdrv_write_threshold_get(const BlockDriverState *bs); * * Check whether the specified request exceeds the write threshold. * If it is, send corresponding event and disable write threshold checking. + * + * Function is thread-safe, no lock is needed. */ void bdrv_write_threshold_check_write(BlockDriverState *bs, int64_t offset, int64_t bytes); diff --git a/block/write-threshold.c b/block/write-threshold.c index 65a6acd142..8b46bb9a75 100644 --- a/block/write-threshold.c +++ b/block/write-threshold.c @@ -2,6 +2,7 @@ * QEMU System Emulator block write threshold notification * * Copyright Red Hat, Inc. 2014 + * Copyright (c) 2021 Virtuozzo International GmbH. * * Authors: * Francesco Romani @@ -14,6 +15,7 @@ #include "block/block_int.h" #include "qemu/coroutine.h" #include "block/write-threshold.h" +#include "qemu/atomic.h" #include "qemu/notify.h" #include "qapi/error.h" #include "qapi/qapi-commands-block-core.h" @@ -21,45 +23,45 @@ uint64_t bdrv_write_threshold_get(const BlockDriverState *bs) { - return bs->write_threshold_offset; + return qatomic_read(&bs->write_threshold_offset); } void bdrv_write_threshold_set(BlockDriverState *bs, uint64_t threshold_bytes) { - bs->write_threshold_offset = threshold_bytes; + qatomic_set(&bs->write_threshold_offset, threshold_bytes); } void qmp_block_set_write_threshold(const char *node_name, uint64_t threshold_bytes, Error **errp) { - BlockDriverState *bs; - AioContext *aio_context; - - bs = bdrv_find_node(node_name); + BlockDriverState *bs = bdrv_find_node(node_name); if (!bs) { error_setg(errp, "Device '%s' not found", node_name); return; } - aio_context = bdrv_get_aio_context(bs); - aio_context_acquire(aio_context); - bdrv_write_threshold_set(bs, threshold_bytes); - - aio_context_release(aio_context); } void bdrv_write_threshold_check_write(BlockDriverState *bs, int64_t offset, int64_t bytes) { int64_t end = offset + bytes; - uint64_t wtr = bs->write_threshold_offset; + uint64_t wtr; - if (wtr > 0 && end > wtr) { - qapi_event_send_block_write_threshold(bs->node_name, end - wtr, wtr); +retry: + wtr = bdrv_write_threshold_get(bs); + if (wtr == 0 || wtr >= end) { + return; + } - /* autodisable to avoid flooding the monitor */ - bdrv_write_threshold_set(bs, 0); + /* autodisable to avoid flooding the monitor */ + if (qatomic_cmpxchg(&bs->write_threshold_offset, wtr, 0) != wtr) { + /* bs->write_threshold_offset changed in parallel */ + goto retry; } + + /* We have cleared bs->write_threshold_offset, so let's send event */ + qapi_event_send_block_write_threshold(bs->node_name, end - wtr, wtr); } From patchwork Thu May 6 09:06:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 1474877 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=virtuozzo.com header.i=@virtuozzo.com header.a=rsa-sha256 header.s=selector2 header.b=W8WZOswJ; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 4FbScy0rDDz9sVv for ; Thu, 6 May 2021 19:16:34 +1000 (AEST) Received: from localhost ([::1]:43904 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lea7U-00030x-3T for incoming@patchwork.ozlabs.org; Thu, 06 May 2021 05:16:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60316) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1leZyK-0002X8-LB; Thu, 06 May 2021 05:07:05 -0400 Received: from mail-eopbgr60093.outbound.protection.outlook.com ([40.107.6.93]:50670 helo=EUR04-DB3-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 1leZyI-0002tO-PG; Thu, 06 May 2021 05:07:04 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=duCv+mJfmvmPpR3x8qUyZ/rUbIAiep97EyGUidUUAzH2G9hdQcH5BPmVQOI+1D1FjzB0Uh7e0O+ITv5DyGT03ZHUKjHr/weXz0nHPibtKYxm5cm+m7wR9ej7SEAtw5NJ8A/6cp5s9vV5vNJPiO3HbstmJh5VgRlh/Nf5y6fxZqzSnfNknpcNUq1BpkAh/0AuVcK6/KjAVxwdrWY4aSMz9cE9XlkD//BFEFBxqritsMtcAstdKjeLN94x0QJOWl9eGCEg3dJjv12EN0UGB9/SU4CZi5THA9Rh3ZF1/iNxjpzGOTmbpWK2iqjCHWNmYiCz7EKdiMSuaPym60Wenbwh6Q== 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=ZMUyUN2/eQUPFpuUX66SjXb7kxCCrp3O/d4hQr0QRU4=; b=oRi7LV9bWVdKtDRheAxisVrY9F+lQWYqF6xIKsyM7C9rlkHUavWl5LzEMjVXQVC/y0D5MEoceDSrvLlVphpt4H6ghNewWkkPH2e6M/fguuF/t0XoVncNyqC+1a0vF8O7T7roRAjvs7DDcIM43ad6csBVgNq4NMR2EffQJEazr+eTb7t/VfYsFylxwRB7wiA6ubbFm/sY2yS28/KqE3DiZSyG38WrTQcUoj16QqNsQtNn+lZg76DpBhzn6xFy7aZgj5+A/a1eNoemWjwXyqifv+HKtpo/PoOSIMFct9y5t7HOG6UuGQclTflN6uyJEIxcR9UmAhspOPiDTTy+Ndb5Dg== 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=ZMUyUN2/eQUPFpuUX66SjXb7kxCCrp3O/d4hQr0QRU4=; b=W8WZOswJTy7nKGWe8s7w5RP/klixx3bwAidjfgWkYqt2RURHPPXxLcfryyXFd7GUkcTEXR45Zy0KlKzD/fLlXsvl4VH7y6WTGWCElxAPp7r+x1O71EOSSrDWZP9rJQrBpUmzuY1JXb6ncYwm5DSWnzwzvXtAVkiHgMfP4SiiC6A= 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 AM6PR08MB4166.eurprd08.prod.outlook.com (2603:10a6:20b:a6::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.26; Thu, 6 May 2021 09:06:45 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::b403:c1a9:6bb7:133]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::b403:c1a9:6bb7:133%7]) with mapi id 15.20.4108.026; Thu, 6 May 2021 09:06:45 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, fam@euphon.net, stefanha@redhat.com, mreitz@redhat.com, kwolf@redhat.com, vsementsov@virtuozzo.com, eesposit@redhat.com, pbonzini@redhat.com Subject: [PATCH v3 6/8] test-write-threshold: drop extra tests Date: Thu, 6 May 2021 12:06:19 +0300 Message-Id: <20210506090621.11848-7-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210506090621.11848-1-vsementsov@virtuozzo.com> References: <20210506090621.11848-1-vsementsov@virtuozzo.com> X-Originating-IP: [185.215.60.236] X-ClientProxiedBy: HE1P195CA0011.EURP195.PROD.OUTLOOK.COM (2603:10a6:3:fd::21) 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.236) by HE1P195CA0011.EURP195.PROD.OUTLOOK.COM (2603:10a6:3:fd::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Thu, 6 May 2021 09:06:44 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 187e6bfa-b642-46be-3aae-08d9106e45f5 X-MS-TrafficTypeDiagnostic: AM6PR08MB4166: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:561; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: IxFe95mOt0l9GzS7GX7tXwcu9NDNC37gQsgWqAM/NW23FH8dTdbqmwA1h4/NrVOtnmWfi/MGhRWO9elROFJ/kCXuppPO58DTqV85qxrCXjCk1dbxSQ/v1/4wVySBDGpP4F1iQMA6MdYlW5EMstEbaChfnortga89x6lO4Kg2iVL5cCbQoHPclTlR4Wn/jVhe6PqtxRrdw1PXABEznxxRZ6iuGC1ebogp8fVZxchTtkEja2yy9W52fuU5Kyex0LSMWkh0Oop4RKCHOHF7owcwRvzb0FrYpD74YdrUYngo7+e8YSSPx3t5sSQA1z9dPqzPKtYkl6XD0QomDWE/KKzcjS4Nn0pQi6n69chM7PQZraT4R/Au1lXwAsm1YzVKS+MNZUF0sD0fi+0PGjNpa7h6wNPyEf1flRcPi1a6Ma5Ll36m0iCpuarOdC7Jr5r+gTAUcnkLwp/5DpUIXpIvbbfQBj5CDRHt92pYd9kxJHhqBkusZ6pp73RS5JEa9LUUyW1xLq2yoEkb7dgqJQ1oDKBhbGUQnhNlKVzAHcQgMbKcH4qXCwGsGmijSPZa1xkiiepFkTPA4RuTahZ+ZOqGxOYOWuA1VXaaaeckoTy9LvME6+YgNKBrN5OGdTbUK7vhtv9BMYvePhWD/G4nNFETpD1MEFyDFFfay+aLbMw2hgSSycvaW348H+1tRERLOTiwcZcP 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; SFS:(4636009)(396003)(39840400004)(346002)(366004)(376002)(136003)(86362001)(66556008)(6512007)(8936002)(66476007)(66946007)(316002)(6666004)(8676002)(36756003)(6486002)(1076003)(52116002)(4326008)(478600001)(2906002)(956004)(186003)(83380400001)(6916009)(6506007)(38350700002)(2616005)(38100700002)(26005)(16526019)(5660300002)(69590400013); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: hbYMkJe/VMJLOd8T3C6Wz0V9eMqzg5twCIi8MDbydgTYZfEj2X4/qj2K4fq5gY4XC8UCW2AJZbH3GhXtt2imYqECW/6iGtI52HiC68tpJsLMd36BDL8G8gTrVTdBM3yXKmM88FiM5ooplCNtFOSXoFCe8lmIfTu6eWtMyHq7knjlrFw2FvLAsEZCBm0CmU//fF/0Pnw5UhEku7oX60jfnT+Ie/CZt24kf1zqbK9Ekj+vrTSkIBym1OUYybBTOjr/OKW3NC6S5yF8NnOPSXQLtUEYsiho3ucDFW295gq2hWp5rjFNEYB4wTGbPFBbt9iJzZGxQ+Y76gryFIszZevNarGLG5xcm/uxVbsYxk6PKsdtk02K3FpR5kutxOKyi9Mxmk6Mdm4lY7XRzJrOSfm1TQTB8QHLVIJLjPKfFyJ0kHhyFROWR3ON/jbu26y9kxlaWxB2HM2eYFQ6+pE5ApXLsvAUS6DypyMIRIs7S+XB9MUQmDTfIuMzOqnvBoNMlav13XHYj8qmScNJ/nXpGEmClUwTBU29F/r/CNVfjlPb6W58TGA2MfIjoTB0oePkeDhO4NniPv0q5ACWe67FBvu7vVjGRgMsB8yMCnoYivDb1jY3+weKGa/6XZIzpy2T7GYs+vusSgJfrXoSe+Bih3N4ClM4i2WlHuabykGr5ggMqt9Z/1/DCPjZntGgcy1ZAfS3ZFuX5HpeDTlko1wokV8znwOZKBInSEm8FmWV9kfEdP/asxeQRLi1vH5X3NkVHURu6gwviKjhY7eyuOG5pmo+3SOaYA/h1PxXGeCV4O+lsF3WGwWOL12ez8COu9JKkiLYBjHkMwXomQP9ELPjYL22zEwoqHAh71mfPMq+Pw2VyFMP4DzI0Mrzm007ZhfixSaOLh6uleziZsS2bmVVupz2CdchI1rl3g9Vt+gDIJQYtGYzsJjLItgtN8UfGoN4UCb13/KycwRswqjxE+tWRC6RVtRmPQ6yZVxaNf5e5nL4f8n/hP7qkuYJ14iU5kcBOQwrvSZ9OI+7vclw/BzfCRzbaUaRTyv22axHgDZO3K40D2lgFVaYvsmo42l9sGOkFY2ZLic58pcYNDJAXRy+SHFd91CprKU9WhT2klo/Y26heYqkBYJHlCVM3oG1PFwNJDm1WF0ZUhW1FLXpSqsocY34S+DnLI69qLMy/VoZLMrHm/3a6UtnPsjwuMU+Z+0hxL+3XHm1cYqJtgNJoqU1H8stQcl1wDAnFoCGxzyWlju9wgS63uNg1HVXuEXVv3R7e8EEY9Xt2O68IQVLroSHlUDY++olBtM8uIc5O1ggL9lcECxZw9TIZSCMSOhvegl9541s X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 187e6bfa-b642-46be-3aae-08d9106e45f5 X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 May 2021 09:06:45.7036 (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: bbCLDlcE5LgDrs1HaEvADEi92ffE0CmRDiYiA8TToKcc4ZzbCBQq1uyGyuGX0btAbxYKKl6touA1k5wbpBJeux0XgsjWlnNctE+d3Qmn1X8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB4166 Received-SPF: pass client-ip=40.107.6.93; envelope-from=vsementsov@virtuozzo.com; helo=EUR04-DB3-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no 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: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Testing set/get of one 64bit variable doesn't seem necessary. We have a lot of such variables. Also remaining tests do test set/get anyway. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Max Reitz --- tests/unit/test-write-threshold.c | 43 ------------------------------- 1 file changed, 43 deletions(-) diff --git a/tests/unit/test-write-threshold.c b/tests/unit/test-write-threshold.c index bb5c1a5217..9e9986aefc 100644 --- a/tests/unit/test-write-threshold.c +++ b/tests/unit/test-write-threshold.c @@ -12,43 +12,6 @@ #include "block/write-threshold.h" -static void test_threshold_not_set_on_init(void) -{ - uint64_t res; - BlockDriverState bs; - memset(&bs, 0, sizeof(bs)); - - res = bdrv_write_threshold_get(&bs); - g_assert_cmpint(res, ==, 0); -} - -static void test_threshold_set_get(void) -{ - uint64_t threshold = 4 * 1024 * 1024; - uint64_t res; - BlockDriverState bs; - memset(&bs, 0, sizeof(bs)); - - bdrv_write_threshold_set(&bs, threshold); - - res = bdrv_write_threshold_get(&bs); - g_assert_cmpint(res, ==, threshold); -} - -static void test_threshold_multi_set_get(void) -{ - uint64_t threshold1 = 4 * 1024 * 1024; - uint64_t threshold2 = 15 * 1024 * 1024; - uint64_t res; - BlockDriverState bs; - memset(&bs, 0, sizeof(bs)); - - bdrv_write_threshold_set(&bs, threshold1); - bdrv_write_threshold_set(&bs, threshold2); - res = bdrv_write_threshold_get(&bs); - g_assert_cmpint(res, ==, threshold2); -} - static void test_threshold_not_trigger(void) { uint64_t threshold = 4 * 1024 * 1024; @@ -84,12 +47,6 @@ int main(int argc, char **argv) { size_t i; TestStruct tests[] = { - { "/write-threshold/not-set-on-init", - test_threshold_not_set_on_init }, - { "/write-threshold/set-get", - test_threshold_set_get }, - { "/write-threshold/multi-set-get", - test_threshold_multi_set_get }, { "/write-threshold/not-trigger", test_threshold_not_trigger }, { "/write-threshold/trigger", From patchwork Thu May 6 09:06:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 1474870 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=virtuozzo.com header.i=@virtuozzo.com header.a=rsa-sha256 header.s=selector2 header.b=QxgzdaIH; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 4FbSRS6vdQz9sVv for ; Thu, 6 May 2021 19:08:20 +1000 (AEST) Received: from localhost ([::1]:52750 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1leZzW-00038x-Qc for incoming@patchwork.ozlabs.org; Thu, 06 May 2021 05:08:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60342) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1leZyO-0002Ym-Bg; Thu, 06 May 2021 05:07:10 -0400 Received: from mail-eopbgr60093.outbound.protection.outlook.com ([40.107.6.93]:50670 helo=EUR04-DB3-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 1leZyL-0002tO-7k; Thu, 06 May 2021 05:07:08 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XIOnwzfbnZdbGubk6hktPb2UqtNWymx4L4aV7+cddqDlU4+XWHguRmMGubiWuHyUeCnMHmIsF2Wh1ZLvspko3y6YnmbeJbliKPicmGgcsKqImBmgYn0128TzkBI1AXOhDpwU9ouzDp25wiBJLrJUV6f0MAe4s6wUxpx6Nn1QMQo9oOnCdMUKFbTh5gSkMBA9QdEMtfUeXfcdoIVeVnXM20ABn0+PMxxwsZV3c2Z6XbXBu9cUShwH0pj3KEGr5eP1Ebw5+pvJ0raHIMuFoje7LzwVswa1RqjNsMARpGBD16OeIViR4UgfsmEIUQYuS+L83eXzLrh2ReZZB+KqRVugog== 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=dQpTMrlJpXfNGPXl/8hXhgnKwhByqoTByrokQat5ef0=; b=Y4wga2byI6UY1jKn/8vaINPgAGvwK6Yq/fVIw2b3qvdzi4v2gmhA8A1FcbygquaEGJdZsTOUtlpNP4ORFp0HVQ0RMxBAwai0Jgwv7Zdt0GIfkZrtQ3NBO+QizP7/S7x66Pvsq4Jy5wnV4oNjLsO+iNmIEja8Ref0eeRirjUZkjK5rrgWtThmkEuOTEhfh6Mi233jNe/wPGB2GLAJ4i1moBVIMiw9pd9JVNUXgujY8C7w24DJsT6+8B6wOHXGkyhmH9syJwprQpcnXKuwcCXUpv4/2+rkpfXwM3jdWjUO4sjLx2SOgFrFNJmP4+cb1xlYNb6BRHwgxIOZmcKX+X5PZA== 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=dQpTMrlJpXfNGPXl/8hXhgnKwhByqoTByrokQat5ef0=; b=QxgzdaIHw9+f+UXCJmS6N8gxnBVM6Vd9laqfWyCWFB7LhOZkyAtL3/WAIPbssX1ko0lkCb8b74auImxLAT40uIRwM16dOiKfDpM8wyTkQwmGn4RBBXWMIMmNjRRm/5BycQHW45+hEFZ8Bwya4hIze7ep85J9WxRZbPriUAAmyHA= 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 AM6PR08MB4166.eurprd08.prod.outlook.com (2603:10a6:20b:a6::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.26; Thu, 6 May 2021 09:06:47 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::b403:c1a9:6bb7:133]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::b403:c1a9:6bb7:133%7]) with mapi id 15.20.4108.026; Thu, 6 May 2021 09:06:47 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, fam@euphon.net, stefanha@redhat.com, mreitz@redhat.com, kwolf@redhat.com, vsementsov@virtuozzo.com, eesposit@redhat.com, pbonzini@redhat.com Subject: [PATCH v3 7/8] test-write-threshold: drop extra TestStruct structure Date: Thu, 6 May 2021 12:06:20 +0300 Message-Id: <20210506090621.11848-8-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210506090621.11848-1-vsementsov@virtuozzo.com> References: <20210506090621.11848-1-vsementsov@virtuozzo.com> X-Originating-IP: [185.215.60.236] X-ClientProxiedBy: HE1P195CA0011.EURP195.PROD.OUTLOOK.COM (2603:10a6:3:fd::21) 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.236) by HE1P195CA0011.EURP195.PROD.OUTLOOK.COM (2603:10a6:3:fd::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Thu, 6 May 2021 09:06:45 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 933fd35a-56f8-431c-ecdb-08d9106e469e X-MS-TrafficTypeDiagnostic: AM6PR08MB4166: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2089; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: k64WIZAHaTQve9OEgZMPOv+cvkTcJtpka2VeHvSS3dFUVVF8dsCU//qu6y3fXqWSl3W1h8K+5OJwB1qHb0AjYnR1LR7iUFOTccC0hD0DT84j40Yr6sXH2w+qSaGxT0cHgGKTXxgIGNNfrjHs0TKQu6A/on3jfIH3Oi3Eh+VTzs2BwNEF9OyxoPI37ws5mpsURhTtloCYwheCDpeb7TO7aYqvN/ecGJho+DHvjbI834PkbCFaJrlHF9PUv1L2RAUxTOCwrRFReOzWVevP18TapkvzucUniRnZqXNZjMQu7PX4m6e/ZPi0U1HVEhgMVFPu2ydeK90PKBWYUgxsWHqBR3JKY1be6QFTpxSkqSKEwril/zzTr50fLVFEUavMIQWTiXoL8oqfWj0os7tpkZiB4c1jObKtE10b00C2bBNC1HHYhsRznwkd+dWMcmhFtOgHxBzK6f1ORtGJfWlrYj+7MjC6+ZCabC/X9MybxxDQmJonawh7YJjdilx7BV5lsK4v9wZxbzYqmlvSAdvp46ocDrBKEPe5w2qSXJPmJNHqRJbDOa6wxsgukuhSAJSHlHwL8f7h1vc32nf5TZJWQ664+Q2uSMNq7T/UfnpyAhjTZT//28T+jWUHzCOZGPGeLg/7mvKx/2vX3POhMRBRQ9w7XXhrvMx/gmNB3ZlvXvN+LY7w9gMemPt1i/CLGbl6wxNV 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; SFS:(4636009)(396003)(39840400004)(346002)(366004)(376002)(136003)(86362001)(66556008)(6512007)(8936002)(66476007)(66946007)(316002)(6666004)(8676002)(36756003)(6486002)(1076003)(52116002)(4326008)(478600001)(2906002)(956004)(186003)(83380400001)(6916009)(6506007)(38350700002)(2616005)(38100700002)(26005)(16526019)(5660300002)(69590400013); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: L7lD3ndxvMaSNtHvurYkVa3hVztqTZU08DB6dhCOPuxz8zNK9dBEIKd45hVASp6zp/f3K1+QJaSkYpVkB1MTaJgQsaztYY40I57FtUBqAs0MQ1h1NVCG+5/7l4NXyC5tZ32cm17gq0btDKV29lJUWFNtkow6tlerJAkJOpcnMLQ2OBbgTPKtawq+KYl5IVbxdAFo7XQkZbV8c0Z9aqrAVHhw1scGE22ctIj9jIPwsiRKioCZxwExjuNcfe1DhsVURSEoHVeb8hQh+dL9u5PWGgEAFJobLzGN4I5aZLxMQ3SoglRRoTCcEcVeFiasiEynUmufKslF19xIUSDYFOQeNfUuw9xVKpG01csCgpEU4XZvqXZCi2vABwA86hnt6OGNuRp0vqY5cuZK0qzk3Pr7HH/DFNAU1Whi10P6rXokDXag9R/sh0cjuvpO1f53rQxAXP1x4f/KL7W9fiJYhGxDtcts9oyVilzPjxdYhom+FwDjiovFX8L7e/3/e8m7Omm5xYeHE9g60eokEfoSW+OzDcXNK4S/9+kfeoixa9nr84S8ceOmUWFUJLO0a/+J+nkAzMgsintiDqNdtsWlfA1aFCE5eNojnjzlCzxY00Hnyu6+sN50XBIRwnKFT1EG3hEa5H7V/RZH66qaB016nZDTcRGhokNu/tbJI9smwP+AtXPnNdy8IsIEGhwSjPtD8ZF+5Ane40Ax/XTdmUCEusu0vZckIyAF3izCJal//KnWVFfSjQPE9BAXvhnSvZ1i6qkCJTpFbjeTznLPuIj3BnDA+jbLAhFheZFMSD28sJeo7FM1JjqvrwTcpEsSNxlozsZIq+pz0QYFDwSKrQUlJEKC88lHcjoE4SbTLIkYPg+9nBVpsbe1uPOOqX77aqLR18GWKPheYHEhuW52ZTnZfthRam0qrihQAajGTvtPRo5g7QqliZqF8zNdbVwvnjkFZLJntokh9WAk8zPYkV51Cg4SO4qS+WMuUPl+9ZMCrCl1NRqT3bJJUGg8miIrlLxEwabpDVwnKQvdv+/yCUK9vEBH7aKkBpbquqsuBeM00SI1kz0Fd4t7ofBN9ixzZbkdHlA5cVB41w11o/lpQXDe43dyRfT1cPhJyMD1aFl9T4Z0M1UIkqE2iknEtcAKZnUImtljI4AXI4TlCHC0fQSfeJWWdUQ2FYuYeYYMx0WmF9hVC8gnVy5iJzIZ662zZlgLcfPcrCSB7Vu3bH1g7gZIZkBBI5YN/Jd8GjLpeR2Dhei2WQS2qSLFZ7qkwX1HlCdbRi88QFOWJfqii1HeUYMShJzaREQcSGoeJSkxXg8kkdZbButqGomS11MB93XtIXdxgGTx X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 933fd35a-56f8-431c-ecdb-08d9106e469e X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 May 2021 09:06:46.8466 (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: BvRy5xjWPoeSN3Bt8A0taViDmUqpICdkbDbU0iuF7ZNXH+ivdcc1np1hhIxS96GKklGfs0EseOZ1tbF9fDoIf4x/NlMON4tBvAyn+cMeiLg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB4166 Received-SPF: pass client-ip=40.107.6.93; envelope-from=vsementsov@virtuozzo.com; helo=EUR04-DB3-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no 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: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" We don't need this extra logic: it doesn't make code simpler. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Max Reitz --- tests/unit/test-write-threshold.c | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/tests/unit/test-write-threshold.c b/tests/unit/test-write-threshold.c index 9e9986aefc..49b1ef7a20 100644 --- a/tests/unit/test-write-threshold.c +++ b/tests/unit/test-write-threshold.c @@ -37,26 +37,12 @@ static void test_threshold_trigger(void) g_assert_cmpuint(bdrv_write_threshold_get(&bs), ==, 0); } -typedef struct TestStruct { - const char *name; - void (*func)(void); -} TestStruct; - int main(int argc, char **argv) { - size_t i; - TestStruct tests[] = { - { "/write-threshold/not-trigger", - test_threshold_not_trigger }, - { "/write-threshold/trigger", - test_threshold_trigger }, - { NULL, NULL } - }; - g_test_init(&argc, &argv, NULL); - for (i = 0; tests[i].name != NULL; i++) { - g_test_add_func(tests[i].name, tests[i].func); - } + g_test_add_func("/write-threshold/not-trigger", test_threshold_not_trigger); + g_test_add_func("/write-threshold/trigger", test_threshold_trigger); + return g_test_run(); } From patchwork Thu May 6 09:06:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 1474874 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=virtuozzo.com header.i=@virtuozzo.com header.a=rsa-sha256 header.s=selector2 header.b=IrOZpP57; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 4FbSWd0kFSz9sW4 for ; Thu, 6 May 2021 19:11:56 +1000 (AEST) Received: from localhost ([::1]:34498 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lea30-0007OM-Pw for incoming@patchwork.ozlabs.org; Thu, 06 May 2021 05:11:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60296) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1leZyH-0002PJ-D4; Thu, 06 May 2021 05:07:01 -0400 Received: from mail-vi1eur05on2112.outbound.protection.outlook.com ([40.107.21.112]:60128 helo=EUR05-VI1-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 1leZyB-0002uf-AE; Thu, 06 May 2021 05:07:01 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZEf2U44Dy+ur4XG1hsAGsZtrj7A6znPP3QG/NNRscPMdorRY5x1bdv29IU0dGaeYAmCYCZ85aT+yd/i7X+2dZIdGcqPqC1L6apoW4zHS+D4pKYiJWRqdJjB7a/zX71Phx8CvZMllK0m8bcpym+qGA6+TU6SqoEHl0Y78vkeRUs79nUY+b93IxBP/Y90s7QvDAKCr3dGghGa9w55gdRgJsj3X9WI+RgJ7yVMwOAC4ZO0OTzVByrCqDySSMgOlehLsaar7byIizLYjFmQBTHOzzpqKxg7f1Q6m/++uKZ2Nv4kturbLAEp4qxsHwio5zKwAK8jOX168jF186ZvT8Zov9Q== 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=biuXqDpX15+zqyxYFY9GfS58FYanYAu+Vu0XVtkx/oA=; b=UrT6iLqB7+QDWeMX+ZU6EEPvsVyGVluSt3eyeWPaPBzMx9uiHl753z2wQ9vuS9p4EbYPiW0IbBHwCBHuGNpBFwOTY6LMwQLvojAZAkDvtcDW/6Gt3Ou2orwqHOj1lyX1AclwJmZth0aSD42L/0ptfMjf2u4aGEBT9dZURi3PXcotv0j+888UohwdVSWlNzYmqIeUyfgdb6dTyYylvxMH3yeO23b4HRp4gndCoFK5rL3kxKYBoIteytKg5EzsPkWqKTEqPk6cUUd+ViFyzaYZSwfkGQDm35hKz36C9jeClqXhOsbOtt/ay7aE8EleywfY0OVoiIQ4iHGZoSPhCi887A== 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=biuXqDpX15+zqyxYFY9GfS58FYanYAu+Vu0XVtkx/oA=; b=IrOZpP57jg1xBwn/5X32cw7juytuf7J8TeExkLwYnlkyB4sWSTV9Aq7a66C0zIPOaF0cyluQnFyXZR6ObrAlfJHJc7Kb9vR3lCDfSeKT8tXMUaOLzMRORZGz7SYpalm2/knm7m9Hd5I3n+jKI6TAs6mkcN540ZoSA+jtDdUX6bc= 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 AM5PR0801MB1715.eurprd08.prod.outlook.com (2603:10a6:203:3c::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25; Thu, 6 May 2021 09:06:48 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::b403:c1a9:6bb7:133]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::b403:c1a9:6bb7:133%7]) with mapi id 15.20.4108.026; Thu, 6 May 2021 09:06:48 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, fam@euphon.net, stefanha@redhat.com, mreitz@redhat.com, kwolf@redhat.com, vsementsov@virtuozzo.com, eesposit@redhat.com, pbonzini@redhat.com Subject: [PATCH v3 8/8] write-threshold: deal with includes Date: Thu, 6 May 2021 12:06:21 +0300 Message-Id: <20210506090621.11848-9-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210506090621.11848-1-vsementsov@virtuozzo.com> References: <20210506090621.11848-1-vsementsov@virtuozzo.com> X-Originating-IP: [185.215.60.236] X-ClientProxiedBy: HE1P195CA0011.EURP195.PROD.OUTLOOK.COM (2603:10a6:3:fd::21) 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.236) by HE1P195CA0011.EURP195.PROD.OUTLOOK.COM (2603:10a6:3:fd::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Thu, 6 May 2021 09:06:47 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 42214a01-4e35-4599-b2ae-08d9106e474e X-MS-TrafficTypeDiagnostic: AM5PR0801MB1715: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:989; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NYc4hQAT7b2sT23Ru8+TU6ZOleqdJbDEBe6DIP+jylMDvZjPD6HHRHpUIuJAzoXCPfcEPGIuEYMc8DgBFcJ0Cb0fQoNEy8GgYxD/lwjDqZGmwOdOp4B5xkW9HzTw1VyQghLZXn6KyRX8I9Wt4Eohmtiom5+efPmduA/8Zu/9hXRfnKY593tLjFb2nM2SusgzPQ51P4LUOseOFsRXHzDaiVDOW1O5mG9gkNJDujRgt2hs+m9+Hx796xy4khEUP4Xg5dTVaJgpQGyOUE2K7JKkCcq8F2d95F46t0Hhn1SgJ9fly+h8YtGx5FNkfDyYGnSRO+054C+LuQ90DVJvMZQGboYpWBTGi5UsZT3vY92+GFwWDvnFZGwbDjO/TX5Qv0Di3fBhLrIwsial9g1QBrWXO1Iqmp9+Q2vaMhsXfqnjmjt9lpvtul2t9iDH6LsG8cf9q5fMjXVL1En+FQXRUWOoVylLqw660z+YaXgLSeVrMZLagp8bAXeBmwL6INegk9OJzeh9wSHySl7uoR+JZY4zU2p89G+malTmiG/ryA4wbJTGUhbOMKYk167D+lpgRu1TTfq2V9p+Qm+urX/KRIEYJ2m5kmfyy6EmuTpmAPnKvHhWL5kC9vywQnyoOgvWssCq+RD8JUbjXAkZGHp+Pry+1CJPEeHx+2X0Tcv2zCrHzHitnz1mYRj5T6Qx1bqzh56g 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; SFS:(4636009)(396003)(346002)(39840400004)(136003)(366004)(376002)(36756003)(8676002)(6916009)(52116002)(6506007)(6486002)(6512007)(1076003)(2906002)(66476007)(66556008)(66946007)(5660300002)(4326008)(38350700002)(186003)(478600001)(86362001)(16526019)(38100700002)(6666004)(26005)(8936002)(2616005)(956004)(83380400001)(316002)(69590400013); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: gNkbCs2oeeiFuf5XsQeVofd1bJ96pFgHw+I2pWndoMF6GXPdf9MyuB2Hi0L62/aVl5EoGUHEJyCvKu7UyrvJAiKunjut22slMR7hgKNQ3wTbqH6tXdfXUJDUgUr7lJ8MgdPFZVMhkJtVK8p5RRuw60aIv7bjCHPYI/e2wlEBxVK4TNoRcUhJIydhWdt/9pNiA3iNKeXBrTvXXpTfHEPp5o2oSMb+eecH49BbY6M3CkDtz7GiAIXwKqzOPR9bkCMy9ctaOd5CB8u+4fCdA7r7ij3Go7SWX00Rvxkuji8uUYZGAc26+Cp447WfKXf8uBJQZ6pPjHcFVajoRFhEswHmswnX9OvCoT/DqkXAoEBw0E/4d23IOQMlpjZfEjfHDNCsGkIrR9ZSt8yZOx4+cDXG++oGm+dQPmtY5zVbYlJcOYzscJjphbC2kgYjrRDKe9/LLP1wlq3yE0n1Muf2mIk5sRisFstgxEdFbmWYjAO6gJ7H88DgbiGMJStxXvKeqkQCPnONQ7krtgOiW+lb1K4TKKXVnqcAVqzEGET9b2/EssnJYqY7R8Gpk1h+xV+4RahyEVtxR9k+1Vdf8UOxL78GXjwPEcpWDAQ8E8sNQqz3RweDmUobxYixqLB7u/ijVlUBTmAk5JU0BUoUhE6JQvn+JBjU/jAkVbqvonzYhS+5PyHomKDgcDfGxHNuMBxXi2xZhRMobcvM+/nJw8UMOh3NBU8aqMMLUUhGXTEFZKtih2y/lUXIk8jr5XIIPOxr2Cl0nb2HuL1pxfkN41XCdNh1sXzrwOBz9YkxiPHJIV319SP0vIKQQB1F5u3Dnwb7YCXRfE1cEr759iPG7GBJxXWj85/Tmrla8x+Olag80xu2STC3xgByujylbi/iRqVkAAB1gTUIVW8nMbiMTPq+VcrSTMqzdet5cMM8zhihXTFfA1r+RXQA4Dwi3oVc/k7QkW0l2EGT51r6sl8OSGMbPfUZ2vMHAP12QG/2ltu8lNfszAyhmF9ACF6DM+mtjMf5HeVrH5a4KwZRupatyCBCO0lfwkpCDP0p2lxVD/2w6LFVoK7/m3TWonGXPY+eqtJsb8+mmUX4E2avpvgSoOX/TejEUIByOx+HhXn3kJuIWeyG/kcYP0sZ5l9ISqycXaxKqR1Q08J7bO+JQr85RzVCluy32hwNFBYYiTascuU0Y/vsOzvRa9FV33sdEzSvbKYf2GrEalSbTJ9XGu1JjLEmANHovj/NSUIwc7Ufsivwg7LiKCJ5IV8lZyS6TPhv8czToLzB3d7QLLTRKZgoo32vhto6oRxBKMJOj/51nI/iCTKVh4e8CyGLuvSzYBio5+BZNh/q X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 42214a01-4e35-4599-b2ae-08d9106e474e X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 May 2021 09:06:47.9717 (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: Zw1TlgNk13EQzNa5O3qGEWv7JYL0NAudGm0gHnukbza+BvA4tccBt8BnSYLtz7iTdDGp6SOiNK1P2/b35UlLOQmUSg5ID4jePvnnSCijFkU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0801MB1715 Received-SPF: pass client-ip=40.107.21.112; envelope-from=vsementsov@virtuozzo.com; helo=EUR05-VI1-obe.outbound.protection.outlook.com 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 autolearn=ham autolearn_force=no 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: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" "qemu/typedefs.h" is enough for include/block/write-threshold.h header with forward declaration of BlockDriverState. Also drop extra includes from block/write-threshold.c and tests/unit/test-write-threshold.c Signed-off-by: Vladimir Sementsov-Ogievskiy --- include/block/write-threshold.h | 2 +- block/write-threshold.c | 2 -- tests/unit/test-write-threshold.c | 1 - 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/include/block/write-threshold.h b/include/block/write-threshold.h index 28c35a1c05..e3acbc249d 100644 --- a/include/block/write-threshold.h +++ b/include/block/write-threshold.h @@ -13,7 +13,7 @@ #ifndef BLOCK_WRITE_THRESHOLD_H #define BLOCK_WRITE_THRESHOLD_H -#include "block/block_int.h" +#include "qemu/typedefs.h" /* * bdrv_write_threshold_set: diff --git a/block/write-threshold.c b/block/write-threshold.c index 8b46bb9a75..7578c0599a 100644 --- a/block/write-threshold.c +++ b/block/write-threshold.c @@ -13,10 +13,8 @@ #include "qemu/osdep.h" #include "block/block_int.h" -#include "qemu/coroutine.h" #include "block/write-threshold.h" #include "qemu/atomic.h" -#include "qemu/notify.h" #include "qapi/error.h" #include "qapi/qapi-commands-block-core.h" #include "qapi/qapi-events-block-core.h" diff --git a/tests/unit/test-write-threshold.c b/tests/unit/test-write-threshold.c index 49b1ef7a20..0158e4637a 100644 --- a/tests/unit/test-write-threshold.c +++ b/tests/unit/test-write-threshold.c @@ -7,7 +7,6 @@ */ #include "qemu/osdep.h" -#include "qapi/error.h" #include "block/block_int.h" #include "block/write-threshold.h"