From patchwork Tue Aug 21 09:46:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Nefedov X-Patchwork-Id: 10571295 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6572E139B for ; Tue, 21 Aug 2018 09:50:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 53C0829CDF for ; Tue, 21 Aug 2018 09:50:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 481A429CE8; Tue, 21 Aug 2018 09:50:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C444B29CDF for ; Tue, 21 Aug 2018 09:50:52 +0000 (UTC) Received: from localhost ([::1]:51995 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fs3JM-0006u7-0P for patchwork-qemu-devel@patchwork.kernel.org; Tue, 21 Aug 2018 05:50:52 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48648) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fs3FR-0003qs-2c for qemu-devel@nongnu.org; Tue, 21 Aug 2018 05:46:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fs3FO-0007up-KS for qemu-devel@nongnu.org; Tue, 21 Aug 2018 05:46:48 -0400 Received: from mail-eopbgr40122.outbound.protection.outlook.com ([40.107.4.122]:7520 helo=EUR03-DB5-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fs3FM-0007oN-LK; Tue, 21 Aug 2018 05:46:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1+oL0BKEpv7OLF4/VmVEQPpQoiUiRM8mPV9ZTbBeV6A=; b=c3AfqtZhAw5Mac7ipFDvB8BTEOIDJuPpDcXbI6IqZYbLbbCfK+tgYVGmqGelpG5xd0emn9bbqyNZh5a6hRVmWY/cFTyEd12l0/0zkz0bvNSTy+G4H6MylwTDkjB/9gGf7hpFJay2Hqyw4cFv5iKH+P8wX8ACSYQHg27iQKZO1/w= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=anton.nefedov@virtuozzo.com; Received: from xantnef-ws.sw.ru (185.231.240.5) by AM0PR08MB3347.eurprd08.prod.outlook.com (2603:10a6:208:5f::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1059.22; Tue, 21 Aug 2018 09:46:40 +0000 From: Anton Nefedov To: qemu-devel@nongnu.org Date: Tue, 21 Aug 2018 12:46:12 +0300 Message-Id: <1534844779-118784-2-git-send-email-anton.nefedov@virtuozzo.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1534844779-118784-1-git-send-email-anton.nefedov@virtuozzo.com> References: <1534844779-118784-1-git-send-email-anton.nefedov@virtuozzo.com> MIME-Version: 1.0 X-Originating-IP: [185.231.240.5] X-ClientProxiedBy: HE1PR08CA0076.eurprd08.prod.outlook.com (2603:10a6:7:2a::47) To AM0PR08MB3347.eurprd08.prod.outlook.com (2603:10a6:208:5f::20) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e847e81e-9958-4282-95b4-08d6074affc1 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:AM0PR08MB3347; X-Microsoft-Exchange-Diagnostics: 1; AM0PR08MB3347; 3:K5xJzusjobWLujj81hxFNxey2enSJvUTuA+euca5wK6Gxtuw+qK++p9tpjND8yMPrIIXasHq45wVyIlO9v8iEBLF32UErk6IirJUYsD75s0ZlLrjHMkj67Ew6qc1TM/OfEFujcLAx/N6S7Q1mm7xEM1ud5ZHdUil/PAQj30H71yhLJ9DLV60OX7miPz8Ckx3NEgfINQQTpO7qS5nKa+6YQ3XhvTMR5GZME85xpR2LtCLoMG6wg0eN4NRHB2CXFZ7; 25:hoWfi3pm9/6TH0xWzrlEHdK60HK0i9a95e0aXaRDyvOnmcrr/95cgOtgwrk2whGBBiq4qg4QBs/DnSG4ZDzV3MGGhNP6E46WQEGi2g6dfikkThh4yQHJP17qmGYthGjv0bO7hf7XjvnGh3a9OQJZQFnzxKfYjaD8cxI5uchJcPxp4aXKwt3M0vVpTxcTmCDgqMADrgo+Ir42AR8atArgKA6eueVVWO+j8wgFCkea6V8byJN0laDvC5g+R0Q6UKZY+lRt6jAeuJnd2XFPsfLTINGrTLDY46DMh8KqmWxa3b+z/LBU/neR/otBfB9GTyEdxvLyB4IfX7xg56PS+oYOjA==; 31:oVsdrL74jZuBYy6PYOkmKR5PElsK1eCypMBgc/PWKl9WVLHvREaxof5p/tzpZ2GDwBhbl8ru4whtS+hV2fDPyMfUEs3uwVyIH8RxBnNh+IlYhXvPUDiRzt41IQGYxOLlO2ba4Pml5Q49p7SVxKLMi/lP9WtXKtrtqFNbVmiyYaaxx368Vw3q0b4p7+jo6v/eoWuaY0i3kviREOonF3wOMTiJG2KSLfP7zXsj6Z1dvgo= X-MS-TrafficTypeDiagnostic: AM0PR08MB3347: X-Microsoft-Exchange-Diagnostics: 1; AM0PR08MB3347; 20:Rq2XC3K3UcVMAhrLBCQinC4D5gcxi0ugJptR1qim/XIgsw3sxjEdH/6gu01Qg4/gIGd6H+ZVlPjW4n8d1a5EHuzm8gWcDBGdTMxYPPIEdSVs06LV1TMMHJk5AbvIkeREraGeR8fPblt/PpXbXRHB4LFi1EQXF8BtGAdQQT6207juRIhd0yhbOyRx2oaj5UxxdlIEBrUvZ26JOoIp4z+RidqCuPQIKpCS5Q7tp7DXYhHlOFmkDnMaMWG5X9LMxO73IHLZFLvOI/18DKhD5HIs3cdXfgwFv+DS0fc+QbdSXB5eQe7c7ys8tCjV3+IGQ4XPzA7mjVlvXr3NT+NV+skDiP9+fe1lV4DV2Tf0/8y0QM2379jSLHESAqgskYWAVNb6btebDhY01VSNmyOMWqQ02I/RYcLeqnOEn6Rj79E16la3nNVT6GAZFYRjIJDuWbt/JVGaotgdugRHQTuxqG6oKsEK3nOB5PcUsmKImBT5QitSYsEn8oAPUyG/UG4onby7; 4:04AwMKXGxkzq+BbxnknfGRxGKBzBpUfDonbmvRCh3+kuHSKkIQBBIdPMoOYD5Pbvg5d6W4O51MEfWS4MuLW/TtLMvVWmcABbBAAPJGuQO1wT/YTd0Y60ANg1yToFWJpWDQk8Mq7tbiYKFXi851w2JR/q0hlMIe/d3JZe3X2aKUaJCf0amMx1N5dOQkuAPEmhced3yt08Cs8BNQVyWlXqOagsb+I48KTDkJ3zsZi/CHVf6xPHCISJYSozzBA5jpoYnA/2FYBRwgzoP3I0QwvFUQ== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(10201501046)(3231311)(944501410)(52105095)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123558120)(20161123560045)(20161123564045)(201708071742011)(7699016); SRVR:AM0PR08MB3347; BCL:0; PCL:0; RULEID:; SRVR:AM0PR08MB3347; X-Forefront-PRVS: 0771670921 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(39850400004)(136003)(396003)(376002)(366004)(346002)(199004)(189003)(36756003)(305945005)(53416004)(105586002)(51416003)(48376002)(50226002)(8936002)(6116002)(7736002)(956004)(3846002)(69596002)(50466002)(68736007)(186003)(106356001)(2616005)(16526019)(16586007)(47776003)(486006)(476003)(52116002)(446003)(66066001)(86362001)(14444005)(107886003)(76176011)(2351001)(4326008)(316002)(5660300001)(25786009)(53936002)(478600001)(2361001)(6506007)(386003)(2906002)(6916009)(6486002)(6512007)(81156014)(81166006)(97736004)(6666003)(11346002)(8676002)(26005)(7416002)(44832011); DIR:OUT; SFP:1102; SCL:1; SRVR:AM0PR08MB3347; H:xantnef-ws.sw.ru; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM0PR08MB3347; 23:KjXsEOm9r+h6d6Nx80SfDhQfkHfqJc0bmKlDvb1d7?= nwPq0mnD8FdoJUvh9a95HudE73KNGQrVaxD4q9MzuHojPuI83WVBfb84QdQ1IwykuLML8FIXy/oxdE/Q0v9O/8y2capWzzNtb7GN3GSAnxgbYpHroVSzeZMSJQ2XSnm4LqZDMttGiQ4l232PY3YgnnGHhQU7hwbqaNfHy1/QgIm6ohW0wEI2Ep+VTDljaN8/sFnT39TFgWFQdqbDRK/qsfoNU+jlNevJhd8TVykJsy1VGhaETCc1zskQe8zgfoeDRIuppxH7MpuOreKMSUX1wVng8VAwBjTMZRNDk9zQwhwdeSIvMLRUP/pP/D6Xk4WuvCdGefd9nrEI33wAc+g+r+jMwAE2Uh2RLfsGf2JImlRb+qfENy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SeumLxmQEu3pkndlJKCwcD7BZVhNDLYVCwZMfvTrGDDTwYkfsXGPYiLouv2vvNSGVN8d2/wqvSkLQs0qYmn1vQHczIwq5V SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM0PR08MB3347; 20:5KzVQns1qg61ckOpY2mve7DWotG+/eF1sze8a8JyDtVNxKZ2Tq2fU8vtOMScVsaHqx/oj6draYh2gBmYgzhUAVLFVMyHqg2wo4+dftxAdwus5AHrYAHKaeBSmRU1czsijRRLbvPgQw5kdKOK3aD3Xbs+LgZZ71D4jXOYr5w0NBc= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Aug 2018 09:46:40.8417 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e847e81e-9958-4282-95b4-08d6074affc1 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3347 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.4.122 Subject: [Qemu-devel] [PATCH v4 1/8] qapi: group BlockDeviceStats fields X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, Anton Nefedov , famz@redhat.com, den@virtuozzo.com, qemu-block@nongnu.org, armbru@redhat.com, mreitz@redhat.com, berto@igalia.com, pbonzini@redhat.com, jsnow@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Make the stat fields definition slightly more readable. Also reorder total_time_ns stats read-write-flush as done elsewhere. Cosmetic change only. Signed-off-by: Anton Nefedov --- qapi/block-core.json | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/qapi/block-core.json b/qapi/block-core.json index 4c7a37a..44d992f 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -784,12 +784,12 @@ # @flush_operations: The number of cache flush operations performed by the # device (since 0.15.0) # -# @flush_total_time_ns: Total time spend on cache flushes in nano-seconds -# (since 0.15.0). +# @rd_total_time_ns: Total time spent on reads in nanoseconds (since 0.15.0). # -# @wr_total_time_ns: Total time spend on writes in nano-seconds (since 0.15.0). +# @wr_total_time_ns: Total time spent on writes in nanoseconds (since 0.15.0). # -# @rd_total_time_ns: Total_time_spend on reads in nano-seconds (since 0.15.0). +# @flush_total_time_ns: Total time spent on cache flushes in nanoseconds +# (since 0.15.0). # # @wr_highest_offset: The offset after the greatest byte written to the # device. The intended use of this information is for @@ -842,14 +842,18 @@ # Since: 0.14.0 ## { 'struct': 'BlockDeviceStats', - 'data': {'rd_bytes': 'int', 'wr_bytes': 'int', 'rd_operations': 'int', - 'wr_operations': 'int', 'flush_operations': 'int', - 'flush_total_time_ns': 'int', 'wr_total_time_ns': 'int', - 'rd_total_time_ns': 'int', 'wr_highest_offset': 'int', - 'rd_merged': 'int', 'wr_merged': 'int', '*idle_time_ns': 'int', + 'data': {'rd_bytes': 'int', 'wr_bytes': 'int', + 'rd_operations': 'int', 'wr_operations': 'int', + 'flush_operations': 'int', + 'rd_total_time_ns': 'int', 'wr_total_time_ns': 'int', + 'flush_total_time_ns': 'int', + 'wr_highest_offset': 'int', + 'rd_merged': 'int', 'wr_merged': 'int', + '*idle_time_ns': 'int', 'failed_rd_operations': 'int', 'failed_wr_operations': 'int', - 'failed_flush_operations': 'int', 'invalid_rd_operations': 'int', - 'invalid_wr_operations': 'int', 'invalid_flush_operations': 'int', + 'failed_flush_operations': 'int', + 'invalid_rd_operations': 'int', 'invalid_wr_operations': 'int', + 'invalid_flush_operations': 'int', 'account_invalid': 'bool', 'account_failed': 'bool', 'timed_stats': ['BlockDeviceTimedStats'], '*x_rd_latency_histogram': 'BlockLatencyHistogramInfo', From patchwork Tue Aug 21 09:46:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Nefedov X-Patchwork-Id: 10571293 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 70501139B for ; Tue, 21 Aug 2018 09:50:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5C4B228A02 for ; Tue, 21 Aug 2018 09:50:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4ED5129CDF; Tue, 21 Aug 2018 09:50:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9278329CD7 for ; Tue, 21 Aug 2018 09:50:50 +0000 (UTC) Received: from localhost ([::1]:51994 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fs3JJ-0006sO-Gh for patchwork-qemu-devel@patchwork.kernel.org; Tue, 21 Aug 2018 05:50:49 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48647) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fs3FR-0003qr-2e for qemu-devel@nongnu.org; Tue, 21 Aug 2018 05:46:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fs3FP-0007vF-24 for qemu-devel@nongnu.org; Tue, 21 Aug 2018 05:46:48 -0400 Received: from mail-eopbgr40122.outbound.protection.outlook.com ([40.107.4.122]:7520 helo=EUR03-DB5-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fs3FO-0007oN-PM; Tue, 21 Aug 2018 05:46:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=sCq2aFzlxgOzENqfBbPjGjb30pC+vJ8Ra3rkJ3Q9W/c=; b=W6Z6mlhgOsqBMV/NOY0aj1o2/b9Vc3iNtap4Du0nCGhj1XY6ISjqgQ6GxfWY/rmaRg5dofpveW8UghaNZ732dD39Mf4b7y4rGP9Zc1Dx7A0dNxRiwZ9GQRJTZlF50UF+I0J8HnFvVMrmTKZOLiDcn3p71vpqhUOJ51fxot7BNgU= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=anton.nefedov@virtuozzo.com; Received: from xantnef-ws.sw.ru (185.231.240.5) by AM0PR08MB3347.eurprd08.prod.outlook.com (2603:10a6:208:5f::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1059.22; Tue, 21 Aug 2018 09:46:42 +0000 From: Anton Nefedov To: qemu-devel@nongnu.org Date: Tue, 21 Aug 2018 12:46:13 +0300 Message-Id: <1534844779-118784-3-git-send-email-anton.nefedov@virtuozzo.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1534844779-118784-1-git-send-email-anton.nefedov@virtuozzo.com> References: <1534844779-118784-1-git-send-email-anton.nefedov@virtuozzo.com> MIME-Version: 1.0 X-Originating-IP: [185.231.240.5] X-ClientProxiedBy: HE1PR08CA0076.eurprd08.prod.outlook.com (2603:10a6:7:2a::47) To AM0PR08MB3347.eurprd08.prod.outlook.com (2603:10a6:208:5f::20) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bca5607a-335c-4733-7695-08d6074b00e4 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:AM0PR08MB3347; X-Microsoft-Exchange-Diagnostics: 1; AM0PR08MB3347; 3:d7C4GsLMZImJNqc5Gu9dHkhsRK2td8it++wBaPo4G57N9xAyKMmE6TZd+BR11DtVNZ8JCbAzZLBSh92BQJ9kBxaDwZB48ZZ9Io9rverYYH97v3ppq6eVJRxgocN0gf2hsp0OH73MbxymiOvxP5+w4BMvcaTqivtODsny+5+b66kflF4/nLNXgg0+dW4f9kJM+ix/FqI+vrIQxmMwTSkaKACg8K39pSQfbOruV3xBCbQ4n7AUYIHDgrrGcPA83T+3; 25:qtP32jTglW3adIDs80f10++rifNvA0rxoHY7eeHyrcaLtfg2az6WNZ7Rt4yZJOo9jzHoMPJLKRxIeDSvRUYcf4u4pSgoRAc+eVWk+SlIoVuOadhp3FIP9poSUULzOAq2FiblM9lE3lgfKXP5AGne3ekFB5y4eEk3STvyL3pDUjZYtQP1Abw1SFbUjhUNdoa87du4TSDtuW4SH5mEUQxBg8z1UQMWgEJ/Ii/8mPc8rBG78tsLKKfsB1GT5tKDwa6Mhn/1v/vw1HpeTj48XPY/YEswo8wqUpCltlYEjrt49hlKQkfXDm2k3ZN1B8K5IkdEZqWfHRyCjiy144cfXIvgog==; 31:eKYm7aAGu0MEp1R0pJ+eIKHCctCeN9Kd2F5ngsJ0+poXUfKdVeG//i1cbm/EwXcSQwLs8NCj6YbjWN1wiA1tR2rQ8ZsuRIjm+mWelMEiF5tE/CD0JwuUNeguyUchMOC5Vyc7CVM/VoEDqIcAnuJKcLc3/RMV+t9CSDUNAWRICl0y8gEcgJhsHqBoR2gw0q/LAPk79OKRNyvCn4W29TKMnyUZEecUWlG30fKVZvWAUCY= X-MS-TrafficTypeDiagnostic: AM0PR08MB3347: X-Microsoft-Exchange-Diagnostics: 1; AM0PR08MB3347; 20:8DMDpX478a5wnEkyKGXhWWTCapkRXtOSMQpd+ULUeZ2A98u4qxLiTLoDLzQ0s+xDhxf/nnulp+91umHUZBngVx5tFeyHf/FWjYwBzB79nMxW6QIYJQdo0DssiSCTHUx840siw4x+7phM1WgXiQTieunmq8UYUe5UYbTvqDodwfld7Lc9tmfuCeCXPD+oJXSR5L8ibmYZLyGtRB+0GbeU1UjrtSX6pNkia+A2aY4LrhjEaoH48n6KzgnYkjBOnPMh3OD+hFAtKEEIjBPIIvE6Xp7yyzlQ/PmwJ02Mi4Zdq3cSd8HTisA7jh7m1+QgOrZ0Kdc5f40GWIEOyXEw1owL8tapvXcFBwqq0CfZVZAdnwvhpucd8TDXJryv24VimgqdGhwUsvkfYqNFY/JswBVLteXjbAuLGToR8RHQiDwsNS0PdGR8CnY/zVXLeOY0Op/gw9kE9fdORLjIdPUcT27DXolFyrm/WZMLyQtf0P7KCcnt9kNqqaeohxPySdoDtuKt; 4:G6O7B9Du87y0wUBYzDzarA2XLaiIj9DF7ttjMxI6x0aSJetAfmm0G+6k5oNQPSOoYvdkanBMLXcexcW9HVhamXuyAoeL8LjzdPhbxhs9pQoU5cfWmOYNcdDJMLHnhxNlafDSPYCxBm6vgcBViWeIr6knZT7uJ6cmGBMZiF3dnlbtfivfa26vofuadO1TdFeh0LHYTVG+iOeP1n7EhQn2Sx/Je7QNk+7ztB+Xy07WRPwsf36/x1hRX6njT31usGbN9bbgb1zGNXN+nFpURTMWhg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(10201501046)(3231311)(944501410)(52105095)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123558120)(20161123560045)(20161123564045)(201708071742011)(7699016); SRVR:AM0PR08MB3347; BCL:0; PCL:0; RULEID:; SRVR:AM0PR08MB3347; X-Forefront-PRVS: 0771670921 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(39850400004)(136003)(396003)(376002)(366004)(346002)(199004)(189003)(36756003)(305945005)(53416004)(105586002)(51416003)(48376002)(50226002)(8936002)(6116002)(7736002)(956004)(3846002)(69596002)(50466002)(68736007)(186003)(106356001)(2616005)(16526019)(16586007)(47776003)(486006)(476003)(52116002)(446003)(66066001)(86362001)(14444005)(107886003)(76176011)(2351001)(4326008)(316002)(5660300001)(25786009)(53936002)(478600001)(2361001)(6506007)(386003)(2906002)(6916009)(6486002)(6512007)(81156014)(81166006)(97736004)(6666003)(11346002)(8676002)(26005)(7416002)(44832011); DIR:OUT; SFP:1102; SCL:1; SRVR:AM0PR08MB3347; H:xantnef-ws.sw.ru; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM0PR08MB3347; 23:1gvOPJXjcHa/yLvmzfNVET+FNFH5sFVV9VIlFvZms?= xLeayEGCOpCe+6HznhkIT+oriCU4WmM4iGrYB5tTtOPxpa1q5VDjNLtIO+jEjQfQDXgVDLkvI+/m76mZz0TBjNqx2vnWmf35Oa7dkeyPxb/5QkQjLYUYdEXXsUvdMUyePkbxnZrFfQPW8h0illiw7qWUDTbKdDpqCi2Yjy5FTZ2oWsMqVzftq1Qwnufql3TuRGz4z169K8Oo33by98wDlQEVi6rOA2YKeD3+EZfiADRlbR8IU9HE05cMEfSOG+DMsNsjeJw2vCUZC34JnqWYMrVdCdibJ90kOPxpCX5VIQ8AXMwp3xzMBDOZCOSadzlbFCX0Nd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ngFQULStRMobhgUDeX80EXiKpLKl0spO67xZh4v/llrHFT9I5Nu9htjskUvmqYwlVFwBh3B40wwvHLDs/ibF77/hP3g4L1vQvDyowIpm3reuiAzmNsIoDSYf9tG6J+B6 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM0PR08MB3347; 20:nZua+CisQnIrzkd9Gncv8WhR2QdRa7K8Nm4wuAEe8gAN19tDWocI+HOLVJjAlz3tFUer/Nl8TACOr3yt2TWBsiXucDP+ZiWUqOb4vLAnig9pqvzTMmIe1VK1mlOvuePpxUtq7msMm9+utbcwzL07f64vNV7syVZ8xOthema/aOs= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Aug 2018 09:46:42.7480 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bca5607a-335c-4733-7695-08d6074b00e4 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3347 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.4.122 Subject: [Qemu-devel] [PATCH v4 2/8] qapi: add unmap to BlockDeviceStats X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, Anton Nefedov , famz@redhat.com, den@virtuozzo.com, qemu-block@nongnu.org, armbru@redhat.com, mreitz@redhat.com, berto@igalia.com, pbonzini@redhat.com, jsnow@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Anton Nefedov Reviewed-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Alberto Garcia Reviewed-by: Eric Blake --- qapi/block-core.json | 29 +++++++++++++++++++++++------ include/block/accounting.h | 1 + block/qapi.c | 6 ++++++ 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/qapi/block-core.json b/qapi/block-core.json index 44d992f..19d4743 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -777,6 +777,8 @@ # # @wr_bytes: The number of bytes written by the device. # +# @unmap_bytes: The number of bytes unmapped by the device (Since 3.1) +# # @rd_operations: The number of read operations performed by the device. # # @wr_operations: The number of write operations performed by the device. @@ -784,6 +786,9 @@ # @flush_operations: The number of cache flush operations performed by the # device (since 0.15.0) # +# @unmap_operations: The number of unmap operations performed by the device +# (Since 3.1) +# # @rd_total_time_ns: Total time spent on reads in nanoseconds (since 0.15.0). # # @wr_total_time_ns: Total time spent on writes in nanoseconds (since 0.15.0). @@ -791,6 +796,9 @@ # @flush_total_time_ns: Total time spent on cache flushes in nanoseconds # (since 0.15.0). # +# @unmap_total_time_ns: Total time spent on unmap operations in nanoseconds +# (Since 3.1) +# # @wr_highest_offset: The offset after the greatest byte written to the # device. The intended use of this information is for # growable sparse files (like qcow2) that are used on top @@ -802,6 +810,9 @@ # @wr_merged: Number of write requests that have been merged into another # request (Since 2.3). # +# @unmap_merged: Number of unmap requests that have been merged into another +# request (Since 3.1) +# # @idle_time_ns: Time since the last I/O operation, in # nanoseconds. If the field is absent it means that # there haven't been any operations yet (Since 2.5). @@ -815,6 +826,9 @@ # @failed_flush_operations: The number of failed flush operations # performed by the device (Since 2.5) # +# @failed_unmap_operations: The number of failed unmap operations performed +# by the device (Since 3.1) +# # @invalid_rd_operations: The number of invalid read operations # performed by the device (Since 2.5) # @@ -824,6 +838,9 @@ # @invalid_flush_operations: The number of invalid flush operations # performed by the device (Since 2.5) # +# @invalid_unmap_operations: The number of invalid unmap operations performed +# by the device (Since 3.1) +# # @account_invalid: Whether invalid operations are included in the # last access statistics (Since 2.5) # @@ -842,18 +859,18 @@ # Since: 0.14.0 ## { 'struct': 'BlockDeviceStats', - 'data': {'rd_bytes': 'int', 'wr_bytes': 'int', + 'data': {'rd_bytes': 'int', 'wr_bytes': 'int', 'unmap_bytes' : 'int', 'rd_operations': 'int', 'wr_operations': 'int', - 'flush_operations': 'int', + 'flush_operations': 'int', 'unmap_operations': 'int', 'rd_total_time_ns': 'int', 'wr_total_time_ns': 'int', - 'flush_total_time_ns': 'int', + 'flush_total_time_ns': 'int', 'unmap_total_time_ns': 'int', 'wr_highest_offset': 'int', - 'rd_merged': 'int', 'wr_merged': 'int', + 'rd_merged': 'int', 'wr_merged': 'int', 'unmap_merged': 'int', '*idle_time_ns': 'int', 'failed_rd_operations': 'int', 'failed_wr_operations': 'int', - 'failed_flush_operations': 'int', + 'failed_flush_operations': 'int', 'failed_unmap_operations': 'int', 'invalid_rd_operations': 'int', 'invalid_wr_operations': 'int', - 'invalid_flush_operations': 'int', + 'invalid_flush_operations': 'int', 'invalid_unmap_operations': 'int', 'account_invalid': 'bool', 'account_failed': 'bool', 'timed_stats': ['BlockDeviceTimedStats'], '*x_rd_latency_histogram': 'BlockLatencyHistogramInfo', diff --git a/include/block/accounting.h b/include/block/accounting.h index d1f67b1..ba8b04d 100644 --- a/include/block/accounting.h +++ b/include/block/accounting.h @@ -36,6 +36,7 @@ enum BlockAcctType { BLOCK_ACCT_READ, BLOCK_ACCT_WRITE, BLOCK_ACCT_FLUSH, + BLOCK_ACCT_UNMAP, BLOCK_MAX_IOTYPE, }; diff --git a/block/qapi.c b/block/qapi.c index c66f949..df31f35 100644 --- a/block/qapi.c +++ b/block/qapi.c @@ -432,24 +432,30 @@ static void bdrv_query_blk_stats(BlockDeviceStats *ds, BlockBackend *blk) ds->rd_bytes = stats->nr_bytes[BLOCK_ACCT_READ]; ds->wr_bytes = stats->nr_bytes[BLOCK_ACCT_WRITE]; + ds->unmap_bytes = stats->nr_bytes[BLOCK_ACCT_UNMAP]; ds->rd_operations = stats->nr_ops[BLOCK_ACCT_READ]; ds->wr_operations = stats->nr_ops[BLOCK_ACCT_WRITE]; + ds->unmap_operations = stats->nr_ops[BLOCK_ACCT_UNMAP]; ds->failed_rd_operations = stats->failed_ops[BLOCK_ACCT_READ]; ds->failed_wr_operations = stats->failed_ops[BLOCK_ACCT_WRITE]; ds->failed_flush_operations = stats->failed_ops[BLOCK_ACCT_FLUSH]; + ds->failed_unmap_operations = stats->failed_ops[BLOCK_ACCT_UNMAP]; ds->invalid_rd_operations = stats->invalid_ops[BLOCK_ACCT_READ]; ds->invalid_wr_operations = stats->invalid_ops[BLOCK_ACCT_WRITE]; ds->invalid_flush_operations = stats->invalid_ops[BLOCK_ACCT_FLUSH]; + ds->invalid_unmap_operations = stats->invalid_ops[BLOCK_ACCT_UNMAP]; ds->rd_merged = stats->merged[BLOCK_ACCT_READ]; ds->wr_merged = stats->merged[BLOCK_ACCT_WRITE]; + ds->unmap_merged = stats->merged[BLOCK_ACCT_UNMAP]; ds->flush_operations = stats->nr_ops[BLOCK_ACCT_FLUSH]; ds->wr_total_time_ns = stats->total_time_ns[BLOCK_ACCT_WRITE]; ds->rd_total_time_ns = stats->total_time_ns[BLOCK_ACCT_READ]; ds->flush_total_time_ns = stats->total_time_ns[BLOCK_ACCT_FLUSH]; + ds->unmap_total_time_ns = stats->total_time_ns[BLOCK_ACCT_UNMAP]; ds->has_idle_time_ns = stats->last_access_time_ns > 0; if (ds->has_idle_time_ns) { From patchwork Tue Aug 21 09:46:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Nefedov X-Patchwork-Id: 10571289 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 93F41921 for ; Tue, 21 Aug 2018 09:48:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8413729BF5 for ; Tue, 21 Aug 2018 09:48:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 77F7D29CCC; Tue, 21 Aug 2018 09:48:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1010929BF5 for ; Tue, 21 Aug 2018 09:48:25 +0000 (UTC) Received: from localhost ([::1]:51976 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fs3Gy-0004w0-AH for patchwork-qemu-devel@patchwork.kernel.org; Tue, 21 Aug 2018 05:48:24 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48646) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fs3FR-0003qq-2f for qemu-devel@nongnu.org; Tue, 21 Aug 2018 05:46:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fs3FP-0007vl-Gq for qemu-devel@nongnu.org; Tue, 21 Aug 2018 05:46:48 -0400 Received: from mail-eopbgr40122.outbound.protection.outlook.com ([40.107.4.122]:7520 helo=EUR03-DB5-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fs3FP-0007oN-8H; Tue, 21 Aug 2018 05:46:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DIPyL382KKpw2GSzxwpfZKC04VZ/LUzN1D9CP+L9AOM=; b=DT9Zu/YVQpGRz/vzew0U0grkNu+oTuxW1RE73GIkYSWb/V9adbm6jIj83LUzO7ewH2IuFET0wgDRagrecKE80wwTwEhejvaFbYzLrFcHrT6aJ433m7pLnAGRG6rFSVOZ57G3vJQzFRmyI9iDxouzGtX1DhzIy6tgsZqeZZkf/us= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=anton.nefedov@virtuozzo.com; Received: from xantnef-ws.sw.ru (185.231.240.5) by AM0PR08MB3347.eurprd08.prod.outlook.com (2603:10a6:208:5f::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1059.22; Tue, 21 Aug 2018 09:46:44 +0000 From: Anton Nefedov To: qemu-devel@nongnu.org Date: Tue, 21 Aug 2018 12:46:14 +0300 Message-Id: <1534844779-118784-4-git-send-email-anton.nefedov@virtuozzo.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1534844779-118784-1-git-send-email-anton.nefedov@virtuozzo.com> References: <1534844779-118784-1-git-send-email-anton.nefedov@virtuozzo.com> MIME-Version: 1.0 X-Originating-IP: [185.231.240.5] X-ClientProxiedBy: HE1PR08CA0076.eurprd08.prod.outlook.com (2603:10a6:7:2a::47) To AM0PR08MB3347.eurprd08.prod.outlook.com (2603:10a6:208:5f::20) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5f2a524f-1a28-4cfe-577f-08d6074b0207 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:AM0PR08MB3347; X-Microsoft-Exchange-Diagnostics: 1; AM0PR08MB3347; 3:iKu5DoqNpWBdo7WxKl32NJNXvdeE+BamriiJZHXW5XDfQCReHXXKSQEk173V+mKQKnsedy9OEUwOTj84vOHh9BM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bd4cNpXPsaUIxRoRtFSJULnhRZLI6uJtW+6VyTu93JQDpXC53sgv3GUdC4/H/n7LPLITeeV0pMSuFsIOolvrwOmx/7G6GQn7+LY0IdRQ8MQ8PwNR7HmTPphtv6482PBfnfB2kglz8C5zZZwERHuYWcrlvcV4izuYxoqxp54ktEmheprca1tPiLyCyeLLZ4fKbttr77EFC3kxIrJc2pMTfKjNyngAutTc+7Ym6IFJ/6Z9LJStG9zyjD4rgxbACR9rLVDW9wX+Ld; 4:ASwRN+/dXLdgd/TVW3bDBwPrJJ/C/N0aoNup8yJhj5yGZlyTo5lIyYW3onb/m3lA1e2EQ8R1IQcr+nhH4TgV0dY7hAn+KsneSprXthj6kiX4je2rn93Ba7NXOTHhLo2c8nuk94KkpBDbXuLp2b8bMX/1+mDjh12kZfSIAif0XQGbbra+2GGOW7qA7dj2fE35EWCtujGXyapbm+/bfNgFSB3xANV1iEtP300yhK08dQ+yEh9RSrvSV8Ad6sSsOqbR47mmEAmn6HqCRGTRcY7zPg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(10201501046)(3231311)(944501410)(52105095)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123558120)(20161123560045)(20161123564045)(201708071742011)(7699016); SRVR:AM0PR08MB3347; BCL:0; PCL:0; RULEID:; SRVR:AM0PR08MB3347; X-Forefront-PRVS: 0771670921 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(39850400004)(136003)(396003)(376002)(366004)(346002)(199004)(189003)(36756003)(305945005)(53416004)(105586002)(51416003)(48376002)(50226002)(8936002)(6116002)(7736002)(956004)(3846002)(69596002)(50466002)(68736007)(186003)(106356001)(2616005)(16526019)(16586007)(47776003)(486006)(476003)(52116002)(446003)(66066001)(86362001)(107886003)(76176011)(2351001)(4326008)(316002)(5660300001)(25786009)(53936002)(478600001)(2361001)(6506007)(386003)(2906002)(6916009)(6486002)(6512007)(81156014)(81166006)(97736004)(6666003)(11346002)(8676002)(26005)(7416002)(44832011); DIR:OUT; SFP:1102; SCL:1; SRVR:AM0PR08MB3347; H:xantnef-ws.sw.ru; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM0PR08MB3347; 23:rbhAMgxF+8hbcgY8wXRz/bJxBvLlwSdwOZ/P4POKq?= JmjxKB3iiqV/mVfd/3j1bNTVPIHRUxqE+bfvclik9lhLrYMwx0L/DjIC4nPRp0hvSN27JvOMgIP4epwoBV5u7nzi6QScRSWB17Cdhhk9o92CQ6WSv4L416WKobCZoKdv/jVHLJlvhMHyQItUwDLP8dip6L5co5i1I8vnUq/MPWIJ9o00A2q3UbUI0t4kb8thpBz1xo+6hFdtkLh7lML83Uvq9vKSfIfjMB0VURY+a9la2SIvpVk9+4Ow6zTBwjPUbHsMiWMy9PZ9MXaO1nCtLKWNQl7fw4JoksTbVbug/biobukdsXxnZ1vok9VyX7Bw/OK7W0p7tBVNXIcRFWHEFFTpg9TSDL07LLM3hzsMFQsNbikUDlsQF/Pi+Ym/9X7Nu5K3fDe12Ir5mFB/oRgnh8MQS7RY8X4Ay7BxKrSmFpSPdMuJs6LvuIDE7w1K43Yf6x5lT9iyxgA9W/vjTA3RDHv+0YbEXQ7drYkfzLyDGZTDntDMSAZSI1GbrpKMcUYWmVmj5YBCi9TUfn3n2d5owEWaKGPQxLb4ZgdrjU88MglJordwEWQ3+tpdLa7TfYQq7JH4+o6HIroCsPOHht/wnVj+TWmT5HD9aVFsiPVc99e+RbPt1rH0vep3LogyFkmZxj8LeAlBdFmQKnjFlm6pxRwVu5aZvPTzHzX4JMfZxwkNAi8eaO21ThJx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3TsfyakU/OpxyFW4Hjmtw7ynb26jxVw7QK+r39orrjAqKA8WHpMriFIYL0HLSikTsv5RrLPKhRKkmuCRgw+76h1Vz5sCpG00ItP1vTXDqMNPyHixnB1Vgoto/kvmp/oYl5Gj1r4vUEipV5MMjpUEnwUkEFmz9aYWAUD4XX0ltZXUhn/olz/6agWxGzK2iqvfWV7vIsoN6veuKO3i77d8yVoY1/C3tDj2XZnVktwYCBb6FO6F64lITZh2b5qw2eNrj5Hr/xEIuchIl/F85OuM89Ef5vmZUgXF/U5T3vKmVot+YLG2IwEhvoOyWccVId7aDfOVq8JILAjgbZL9nWkYLyycv4COOlUnXNHMhjSsFrpm4ZS1rhK7bsupss48ino019vaSFdYYZHptbJ5Q==; 5:QEEaWTu+3TcueD5h4EngsjfFIbWqz7aFKsTGxY5kslKyyk/dj2zewPeCBvAqr98sWR/lBNsszPWSZQ7IzO/533q042by3HxQzFhyzaMj5QXL1pMoln0JuUAw6Kv/xHUoRcigbSIOpVTlEd8psHDrSPtd2wify1b9k/5/A6mpIKU=; 7:Ye45Lg7T12EIonH1aat4BZxnshap9xy7ksXLYCbKMz/k0Rt2UrNb+eJ15EcinJyC46MxgtnFq4Gm1h0kn7wlVxs5ELRjnDXMAam381FnlJVAOEn4RuK8P+1e/j9fEkNahfgfR0PVonxxFezvK4G+O04AF8+nOLJd4EU2d8zlI2451ArSvua6NU05eETDZq/WXpn6J/W0Cgt01qc37SecDS0IsM101v0kw0jbjU0GSQeneYJ38CMBnxdOGtn75z1U SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM0PR08MB3347; 20:lqe9wZ9pvioBcpQqkd10EO1y7JUAkZI3yONjQmDhWLjGGWzjJkNIBImWTUnVh5Gj/BFJEJGGy3ejUfBObBB1agV766iGegXE7BwlBFTiFbqqDNboxMhp6jLM9qCdrVVh+enif+sHP2I33dzjTfGy27Ad1AI2hykF5RUQNgFgqko= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Aug 2018 09:46:44.6543 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5f2a524f-1a28-4cfe-577f-08d6074b0207 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3347 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.4.122 Subject: [Qemu-devel] [PATCH v4 3/8] ide: account UNMAP (TRIM) operations X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, Anton Nefedov , famz@redhat.com, den@virtuozzo.com, qemu-block@nongnu.org, armbru@redhat.com, mreitz@redhat.com, berto@igalia.com, pbonzini@redhat.com, jsnow@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Anton Nefedov Reviewed-by: Alberto Garcia --- hw/ide/core.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/hw/ide/core.c b/hw/ide/core.c index 2c62efc..352429b 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -440,6 +440,14 @@ static void ide_issue_trim_cb(void *opaque, int ret) TrimAIOCB *iocb = opaque; IDEState *s = iocb->s; + if (iocb->i >= 0) { + if (ret >= 0) { + block_acct_done(blk_get_stats(s->blk), &s->acct); + } else { + block_acct_failed(blk_get_stats(s->blk), &s->acct); + } + } + if (ret >= 0) { while (iocb->j < iocb->qiov->niov) { int j = iocb->j; @@ -461,6 +469,9 @@ static void ide_issue_trim_cb(void *opaque, int ret) goto done; } + block_acct_start(blk_get_stats(s->blk), &s->acct, + count << BDRV_SECTOR_BITS, BLOCK_ACCT_UNMAP); + /* Got an entry! Submit and exit. */ iocb->aiocb = blk_aio_pdiscard(s->blk, sector << BDRV_SECTOR_BITS, @@ -845,6 +856,7 @@ static void ide_dma_cb(void *opaque, int ret) } if (ret == -EINVAL) { + block_acct_invalid(blk_get_stats(s->blk), BLOCK_ACCT_UNMAP); ide_dma_error(s); return; } From patchwork Tue Aug 21 09:46:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Nefedov X-Patchwork-Id: 10571301 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8421017E0 for ; Tue, 21 Aug 2018 09:54:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7349929D50 for ; Tue, 21 Aug 2018 09:54:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 66E7A29D5B; Tue, 21 Aug 2018 09:54:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id F2F4D29D56 for ; Tue, 21 Aug 2018 09:54:02 +0000 (UTC) Received: from localhost ([::1]:52009 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fs3MQ-0002G8-7q for patchwork-qemu-devel@patchwork.kernel.org; Tue, 21 Aug 2018 05:54:02 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48785) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fs3FW-0003t2-9a for qemu-devel@nongnu.org; Tue, 21 Aug 2018 05:46:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fs3FS-0007ya-0N for qemu-devel@nongnu.org; Tue, 21 Aug 2018 05:46:54 -0400 Received: from mail-eopbgr40139.outbound.protection.outlook.com ([40.107.4.139]:61210 helo=EUR03-DB5-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fs3FR-0007xB-KK; Tue, 21 Aug 2018 05:46:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=za7pgJpKccaHDb0Z5jtn1/vb5HiwwuKkPXx4Tot31DI=; b=ZRsTt8xtU4NrjLEYgQDBTNlUw/Dt6KyPPZ4owuCoBa1qQtMz93jk76VO6UbVVMithe6G4oEBAcPckcU3PyeZ0JdBmaUTFPuTC2U7CTKkbimBpCVacRYCP87cYSngab4w27DCBEZXHQw29EIi1ZgOe3RrkTezz7Na/BQ/fxBfEfg= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=anton.nefedov@virtuozzo.com; Received: from xantnef-ws.sw.ru (185.231.240.5) by AM0PR08MB3347.eurprd08.prod.outlook.com (2603:10a6:208:5f::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1059.22; Tue, 21 Aug 2018 09:46:46 +0000 From: Anton Nefedov To: qemu-devel@nongnu.org Date: Tue, 21 Aug 2018 12:46:15 +0300 Message-Id: <1534844779-118784-5-git-send-email-anton.nefedov@virtuozzo.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1534844779-118784-1-git-send-email-anton.nefedov@virtuozzo.com> References: <1534844779-118784-1-git-send-email-anton.nefedov@virtuozzo.com> MIME-Version: 1.0 X-Originating-IP: [185.231.240.5] X-ClientProxiedBy: HE1PR08CA0076.eurprd08.prod.outlook.com (2603:10a6:7:2a::47) To AM0PR08MB3347.eurprd08.prod.outlook.com (2603:10a6:208:5f::20) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a248cbe9-483d-4280-385c-08d6074b032a X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:AM0PR08MB3347; X-Microsoft-Exchange-Diagnostics: 1; AM0PR08MB3347; 3:Iyf/u+03sjmm9twh+9TZftLLq1PMQrJkhe4reJD+Axg5xqmW8wSQA2EPwWaUmMO7NV7k+MMclXGtFjjJkVfOxVd51LNgHkAvqxMRjmy75r9/jt2dgvgTmVcIHQptzRNtCqYdj00/TFxVYBnpB42f/XKrEu86FsLm41t9Xk+CjY28bfyCXBndwoC4dzQEYaQyKB7+MzdQQCqdtN3zkeoREZPa60089JVkH1bWBYTxVsoK5kkKMvvv8gNCFoqlzCxw; 25:ZPc0vB7Cxns5RDe30lXwj9Sgkcwd6kqhzxLPslSa/KUgfQ7IeBXOX7dXsfmT8KbUgf+fdUELmAkBudlQEf/jOx2snvAJzKwd/4nuhJ3zxbRWeote1Xm3S+AcaxnLXnwOrFqP8fjiofKL/BWaMZdWs+xszGwa6Qxe56mt4vNn1+52cEePLurpzv6nWBl02+2Tc3K7B1A7O2HJp7Gd3pulfnyA0zicy0oyjT5+lncoTnwPbvLdJeGXxkA0W/PXPuabNDrza+sKbuhJMDaERXPFz7QWk20j2b2f1uPwCnRF8RYP3NjNFY07H3+kGS/+MGkk3ZvH5BCLbEwvi8pwUy5Nrg==; 31:BPWBL85jRhMGZ0+dKuzDe4RG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ft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(10201501046)(3231311)(944501410)(52105095)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123558120)(20161123560045)(20161123564045)(201708071742011)(7699016); SRVR:AM0PR08MB3347; BCL:0; PCL:0; RULEID:; SRVR:AM0PR08MB3347; X-Forefront-PRVS: 0771670921 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(39850400004)(136003)(396003)(376002)(366004)(346002)(199004)(189003)(36756003)(305945005)(53416004)(105586002)(51416003)(48376002)(50226002)(8936002)(6116002)(7736002)(956004)(3846002)(69596002)(50466002)(68736007)(186003)(106356001)(2616005)(16526019)(16586007)(47776003)(486006)(476003)(52116002)(446003)(66066001)(86362001)(107886003)(76176011)(2351001)(4326008)(316002)(5660300001)(25786009)(53936002)(478600001)(2361001)(6506007)(386003)(2906002)(6916009)(6486002)(6512007)(81156014)(81166006)(97736004)(6666003)(11346002)(8676002)(26005)(7416002)(44832011); DIR:OUT; SFP:1102; SCL:1; SRVR:AM0PR08MB3347; H:xantnef-ws.sw.ru; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM0PR08MB3347; 23:NklrFhYWDACXKfyCT/AM/hwnIl1SN0DKSHS27Dv6w?= TmJbNTwFwGzmvmas7Qu8Nj0aoiaJRSF10+N3dG9E8p8XfS429gmevgwjTpbiyaGa2sJgK9zFLgGf7syKfuW1DAciS5R0cfqvJrczpl1+eBN6QbfHRNrV2f07Mv7MREeKirAC97Chfbzdx/1bYSiK6wfYAiaAD7uyWNU/B/+AZJIydofnWcFbKBcKtjd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CmeNirtGP8v0kmm3oe8=; 7:BFHXUq4oQKnqER9Bbgd05YTAXBUnbv1ux7j8BbBNHLLrV+9nQoECkVD4rN1e7ZAYIPISKBC42klSZFHLZDTqsVlUhOSlUc84T+9+zUCvdFd4wzCNDQTexoPxetVSlMnJ/Zfz8/x5UsdUHcVVdXKy2xAjROtA31JOJ8jpgkwqZXHwtJROdXPTfg7yTgGcYhIuAyXzPOwBeB7+6u72VMNubukLAPQk2QMLCAPAc9vWcokHWsd7sISgKqocTcClK7Pk SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM0PR08MB3347; 20:vORTpsjvFpLNCngTab+pRIqlJNzyK+ZkFR17/T0wZod5lzrjvPM9zHFzXfKSlBnKOkvglG0Wx5SXlbpA0FL1o9g2X8nMaxA7rpzH6zyfC1UaL5oNNup/9BBn73Eo87yQQVD1XFPyDU3QtfWpiu1oNKuU1/w784csY7xaQUPLORc= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Aug 2018 09:46:46.5606 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a248cbe9-483d-4280-385c-08d6074b032a X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3347 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.4.139 Subject: [Qemu-devel] [PATCH v4 4/8] scsi: store unmap offset and nb_sectors in request struct X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, Anton Nefedov , famz@redhat.com, den@virtuozzo.com, qemu-block@nongnu.org, armbru@redhat.com, mreitz@redhat.com, berto@igalia.com, pbonzini@redhat.com, jsnow@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP it allows to report it in the error handler Signed-off-by: Anton Nefedov Reviewed-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Alberto Garcia --- hw/scsi/scsi-disk.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c index 5ae7baa..d41eea1 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -1653,8 +1653,6 @@ static void scsi_unmap_complete_noio(UnmapCBData *data, int ret) { SCSIDiskReq *r = data->r; SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev); - uint64_t sector_num; - uint32_t nb_sectors; assert(r->req.aiocb == NULL); if (scsi_disk_req_check_error(r, ret, false)) { @@ -1662,16 +1660,16 @@ static void scsi_unmap_complete_noio(UnmapCBData *data, int ret) } if (data->count > 0) { - sector_num = ldq_be_p(&data->inbuf[0]); - nb_sectors = ldl_be_p(&data->inbuf[8]) & 0xffffffffULL; - if (!check_lba_range(s, sector_num, nb_sectors)) { + r->sector = ldq_be_p(&data->inbuf[0]); + r->sector_count = ldl_be_p(&data->inbuf[8]) & 0xffffffffULL; + if (!check_lba_range(s, r->sector, r->sector_count)) { scsi_check_condition(r, SENSE_CODE(LBA_OUT_OF_RANGE)); goto done; } r->req.aiocb = blk_aio_pdiscard(s->qdev.conf.blk, - sector_num * s->qdev.blocksize, - nb_sectors * s->qdev.blocksize, + r->sector * s->qdev.blocksize, + r->sector_count * s->qdev.blocksize, scsi_unmap_complete, data); data->count--; data->inbuf += 16; From patchwork Tue Aug 21 09:46:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Nefedov X-Patchwork-Id: 10571307 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E6599921 for ; Tue, 21 Aug 2018 09:55:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D337229CF5 for ; Tue, 21 Aug 2018 09:55:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C74A929D40; Tue, 21 Aug 2018 09:55:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5C3C829CF5 for ; Tue, 21 Aug 2018 09:55:24 +0000 (UTC) Received: from localhost ([::1]:52020 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fs3Nj-0003is-PH for patchwork-qemu-devel@patchwork.kernel.org; Tue, 21 Aug 2018 05:55:23 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48809) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fs3FY-0003vK-K9 for qemu-devel@nongnu.org; Tue, 21 Aug 2018 05:46:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fs3FU-00081y-7I for qemu-devel@nongnu.org; Tue, 21 Aug 2018 05:46:56 -0400 Received: from mail-eopbgr40109.outbound.protection.outlook.com ([40.107.4.109]:38080 helo=EUR03-DB5-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fs3FT-0007zQ-JK; Tue, 21 Aug 2018 05:46:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Oqe+veYbdZmKrWQKNt9HKoG7uKVm4+LBza0JZDHCSDw=; b=aRg63OQuvw+2P6lLPL5zGk3cJUaMh1n9nSDCKfcJ1F3JvjCT63bGSC+EtSjlR7BZWy7H0nXO7eIdnlJ6bXVFM5yvlSN6LCZsX7hUD/7gCfGKnO+67w+RZM7TkvG/IJmTRqg5xWnB/eAcTUn+SHV18y0VLPdBlqc+RCwzI/Zx/e0= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=anton.nefedov@virtuozzo.com; Received: from xantnef-ws.sw.ru (185.231.240.5) by AM0PR08MB3347.eurprd08.prod.outlook.com (2603:10a6:208:5f::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1059.22; Tue, 21 Aug 2018 09:46:48 +0000 From: Anton Nefedov To: qemu-devel@nongnu.org Date: Tue, 21 Aug 2018 12:46:16 +0300 Message-Id: <1534844779-118784-6-git-send-email-anton.nefedov@virtuozzo.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1534844779-118784-1-git-send-email-anton.nefedov@virtuozzo.com> References: <1534844779-118784-1-git-send-email-anton.nefedov@virtuozzo.com> MIME-Version: 1.0 X-Originating-IP: [185.231.240.5] X-ClientProxiedBy: HE1PR08CA0076.eurprd08.prod.outlook.com (2603:10a6:7:2a::47) To AM0PR08MB3347.eurprd08.prod.outlook.com (2603:10a6:208:5f::20) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 14558802-7d1d-471b-6774-08d6074b045b X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:AM0PR08MB3347; X-Microsoft-Exchange-Diagnostics: 1; AM0PR08MB3347; 3:NVzQPut0BwRng1HWW2RYVYENThrF2Qooic947PNIrY0an0UZlEZVZ68JNJ7YvC3ayEksmbYXHncnhDJsj4KuiTzixAjQSsY2XJMHjPAORKDFalZMtriu4dAAlapAcFVh0WsVm5p83L2HOhb3Mafo9Sfp3MyG0EZsl+HqPD2C5wAz2Q/9QJnqiDzeTtO9Kw+/B3cTwgB3NTpD6q1RaoWPb4W3CZz9+UxQPm2LyPp4oH5c4uqnYTGOG1Tg4UDyXcKM; 25:BwCpzuR9NfNpbWhrW5ro8MB8DWHID8GZ+C5vDUWNO465tSoigtw8Y/wJjDeScrVg+tctcAiRCzaDJ7QVBR5ubnZegQVgm1gmvTOHkH4ACxWPXMPSz7aYjNLQ0OSJMyJnKdDy9JUKsbrOBDs7K/JR4p42tknP+5MsRY58/sGUjuEzSXyuDusoNA96Rrmn4Yft/S2kroKq2Sf+Jh9pC42IQ+tTx/9s2LWpMu5HJHJHL7sOApY1loO2lN8r2xUv/uZ4a56ib+itThMNQaLT80IvCePrffl8Nf4+ZI6Xv6GsTmp2Ml8bmIe6Msf67adO9VE3Mw+F/niv8RsrEBuJUihCQw==; 31:unHi3pFqNT8EwkVxzijfiz9UT9Ye0m+qfSh3i+dJ3yWntnRNqXtO1OkiJUMGO7uTAZqKN8entkqrIndLOyHA/E2bjJtQLdx3rOj6/F+4DPIuaYVtBba8YZJ7T18xTz5b1usahhZ2iO8iQkQrDa4zVNZe6f6xLtFBSBvJRQCSSqg0zEnWppaTVpGmIma23JW8oBtun0rKyRNrDRNS98VFew47nP5mfWsHTIlbPjxSAuI= X-MS-TrafficTypeDiagnostic: AM0PR08MB3347: X-Microsoft-Exchange-Diagnostics: 1; AM0PR08MB3347; 20:YHDaDb8nlJemQAuSuqtf4DzzNNNIjBuIS49hPqddfgtRAwtbtjFP5mdVuRdN9+l5x7yPGGs/GhGmx3wNf9/LOdxssx8letmdr+2F2Q+TJwFb2bDQDDnoN+BPRcBrZhpwUFQ80S5H+aRk3mHmUQ+lgYqp9VS9pSwieMcF0b+C/R5N7HNxuXf5qNcDG3NHMtSwOywJc8LQcYKw68xisIjTmqXK0RTQdPJ3u5BQHtfSCn981UtCR4gN6ljsbvSm52Mw493KLIDtdVVnF0sEdK7AePY+XzjgMPv5dkGzDce1ejtX0aKwKThGhlwPARRLfoh32HIOdRwIeiSoV8vDs62oYuUGLvmtrrz8fuVrRQbJaY6yJX2FZCKqzUKab9Eq//vXFbXcPQN6hwuSbybAZWqRWF0bzRHED1MJpewF07F/Zdq8j8knmfcX6RMmo7Jjb3vQhIVAeD7/sidyn4FbFl1wVUGmgYiaZ86SjzOJKIVKcdXiu20ArEr7dmyBDa/3FCRd; 4:NeHgyqMnJODzhEQ/XR70PFj9cgDf3YSU2uwDWLjXAi0s2LgVz0nK4CUpN2NG+D0avSGCLTgSjyZ0bSvppF13/Bx7JwfQritNVRztL6M16SOdJWW53vNVSFFz/7J94Wk+/oHh0jWs3oLSJoHF2RRkM9TYuOWDUIbl6x4DDwyBwErJSLq/MtkIviPQm7n5T5Omug0n8oW69tXNk6E/oCZmKaBgzHcqVNKFL/ok65JQiwRj87eRuJGCGs0rDjVWVOUFqazYBBvKI6ycvUSPUdIICQ== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(10201501046)(3231311)(944501410)(52105095)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123558120)(20161123560045)(20161123564045)(201708071742011)(7699016); SRVR:AM0PR08MB3347; BCL:0; PCL:0; RULEID:; SRVR:AM0PR08MB3347; X-Forefront-PRVS: 0771670921 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(39850400004)(136003)(396003)(376002)(366004)(346002)(199004)(189003)(36756003)(305945005)(53416004)(105586002)(51416003)(48376002)(50226002)(8936002)(6116002)(7736002)(956004)(3846002)(69596002)(50466002)(68736007)(186003)(106356001)(2616005)(16526019)(16586007)(47776003)(486006)(476003)(52116002)(446003)(66066001)(86362001)(14444005)(107886003)(76176011)(2351001)(4326008)(316002)(5660300001)(25786009)(53936002)(478600001)(2361001)(6506007)(386003)(2906002)(6916009)(6486002)(6512007)(81156014)(81166006)(97736004)(6666003)(11346002)(8676002)(26005)(7416002)(44832011); DIR:OUT; SFP:1102; SCL:1; SRVR:AM0PR08MB3347; H:xantnef-ws.sw.ru; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM0PR08MB3347; 23:VzgLfSNovwcuFnqsLNQoJdyxYZ4IZQ5Ic3oCC4Pqu?= HcYE5RZh4bY7hZ4PrfYNpo764psNTyNMQ8jOHgMluXb9WIBGzPHhasUBsahZnaikgbFelS+XdESfgEksd/ZUgoAD70D0bjULFcCuaiCe1V03yzX5CC8RKmSmGWtvWFjewD2PpowlNMvS4ILbWoGrDqBl7qsu24yCiVO/tN6dGEW4pGSx0vsWY2frbnvzpfp3redNu+cgH5KGY0eWr3Oeu+gV5EBp/64R+ED5HVusCYrQrMYrq+YwRMEfp9gE67OaIZTkunbJOXFUVoqVYbZAlRZZgzIMtHzOOMMiQNxTVijqPDc5byVt+wyOpFH97GFXcpx4e/dwN4AIu7RuuWZNMAV+7PrJhN0Sll04zoFW+cqUbU+JYAtW1vl9rwKxpnylYWiLee9LdR4YqMF/W3TsS7A3Aozj/mo9lEltJwWsLiAlyergS2zL/aWqO0uG7ziL6ONuXe4pOE9CEFr6s3CtrhzGAcEKYNrE/Qk2hi5Sm7OMy9HszQb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utput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM0PR08MB3347; 20:Xj8Hcyu1TkHCqzOynL7NmvysP9Y9cSIVBI3NIGt4asHbjxez92DWd9d3B/1MqMXhrjXUEzQvq9Bo57ejlxLsMCRcYD6ftC68jmZE8HckdkOave4v4QrEMQlj6ZwWkASLvjJ7SquyuCgr+C6LtTlkAh4GMwDhq6TQ8FFUcVKONZU= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Aug 2018 09:46:48.5606 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 14558802-7d1d-471b-6774-08d6074b045b X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3347 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.4.109 Subject: [Qemu-devel] [PATCH v4 5/8] scsi: move unmap error checking to the complete callback X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, Anton Nefedov , famz@redhat.com, den@virtuozzo.com, qemu-block@nongnu.org, armbru@redhat.com, mreitz@redhat.com, berto@igalia.com, pbonzini@redhat.com, jsnow@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP This will help to account the operation in the following commit. The difference is that we don't call scsi_disk_req_check_error() before the 1st discard iteration anymore. That function also checks if the request is cancelled, however it shouldn't get canceled until it yields in blk_aio() functions anyway. Same approach is already used for emulate_write_same. Signed-off-by: Anton Nefedov Reviewed-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Alberto Garcia --- hw/scsi/scsi-disk.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c index d41eea1..9d10daf 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -1655,9 +1655,6 @@ static void scsi_unmap_complete_noio(UnmapCBData *data, int ret) SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev); assert(r->req.aiocb == NULL); - if (scsi_disk_req_check_error(r, ret, false)) { - goto done; - } if (data->count > 0) { r->sector = ldq_be_p(&data->inbuf[0]); @@ -1693,7 +1690,12 @@ static void scsi_unmap_complete(void *opaque, int ret) r->req.aiocb = NULL; aio_context_acquire(blk_get_aio_context(s->qdev.conf.blk)); - scsi_unmap_complete_noio(data, ret); + if (scsi_disk_req_check_error(r, ret, false)) { + scsi_req_unref(&r->req); + g_free(data); + } else { + scsi_unmap_complete_noio(data, ret); + } aio_context_release(blk_get_aio_context(s->qdev.conf.blk)); } From patchwork Tue Aug 21 09:46:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Nefedov X-Patchwork-Id: 10571291 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9D59E139B for ; Tue, 21 Aug 2018 09:48:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8B69829BF5 for ; Tue, 21 Aug 2018 09:48:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7F8E929CCC; Tue, 21 Aug 2018 09:48:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1958929BF5 for ; Tue, 21 Aug 2018 09:48:35 +0000 (UTC) Received: from localhost ([::1]:51977 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fs3H8-00051i-CY for patchwork-qemu-devel@patchwork.kernel.org; Tue, 21 Aug 2018 05:48:34 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48839) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fs3Fa-0003wv-6H for qemu-devel@nongnu.org; Tue, 21 Aug 2018 05:46:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fs3FV-00083J-RI for qemu-devel@nongnu.org; Tue, 21 Aug 2018 05:46:58 -0400 Received: from mail-eopbgr40110.outbound.protection.outlook.com ([40.107.4.110]:27088 helo=EUR03-DB5-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fs3FV-00082E-Ak; Tue, 21 Aug 2018 05:46:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vOU88Oka1D2yVSVUtxriWIINI7lzCqCbGl54mhPxUd0=; b=FsXDbTCh9U0thwA/G6tBZXtfZCbf5VjPdTakV/tiW5Ql0tIQD95xH+xAHlmrVntK0zykiojoJROSmzOZCeJKhpSnNb/2M+DY+8goj5pNZxaAlTGWxqjHOZJULBhLJbYgAQcgAYXtXIcmWGyZff6/V3uhuNfYUXlyZd8MZUvd0t0= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=anton.nefedov@virtuozzo.com; Received: from xantnef-ws.sw.ru (185.231.240.5) by AM0PR08MB3347.eurprd08.prod.outlook.com (2603:10a6:208:5f::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1059.22; Tue, 21 Aug 2018 09:46:50 +0000 From: Anton Nefedov To: qemu-devel@nongnu.org Date: Tue, 21 Aug 2018 12:46:17 +0300 Message-Id: <1534844779-118784-7-git-send-email-anton.nefedov@virtuozzo.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1534844779-118784-1-git-send-email-anton.nefedov@virtuozzo.com> References: <1534844779-118784-1-git-send-email-anton.nefedov@virtuozzo.com> MIME-Version: 1.0 X-Originating-IP: [185.231.240.5] X-ClientProxiedBy: HE1PR08CA0076.eurprd08.prod.outlook.com (2603:10a6:7:2a::47) To AM0PR08MB3347.eurprd08.prod.outlook.com (2603:10a6:208:5f::20) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: dc01c90e-d33a-4c3b-bee3-08d6074b0574 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:AM0PR08MB3347; X-Microsoft-Exchange-Diagnostics: 1; AM0PR08MB3347; 3:D8z5wYLUpxDQT3DS2BwaDP225IlViyUqmBnuuCUkVKRgnCuLOuDQ3H9vnSDXMwR1cVgMA2YO1e40iO6K01JvEEidixKkAeRfthcY5b6mIaqsWZsoWqsKXMzmEDnHilWuSSWG/fA4EGZHFT4nMJx2FG1z4JwBA5KSNAEeZBcYUHDj+R/Od68z++1+sYUlQpmODXweqnqmcW0PNrumgb4sC5wZSkCWb66oA739YY7KNdeZhtjYEH5AeMciKbPfbEqJ; 25:ZuKgEfxMwhhpkTXWDjXTN1ZcukW+qnQZzijQDR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3pWv8bL7ttDLJEUuAWWVU331XAPX9QyAzvyq0FrVagwyn; 4:D0hY3RP2wi/OrRJv7CeFH7i+7HU08lcLyrZgw86P+DTPsQTxtlUysiqnaDNcV+GvjKW/2SOVyG0DGAf9Oqsc7OJz/JRRWpuTNia+AN6ju+gIbq9cjV5sijIFYhw5wsaGuCBQzW8I9q4Lp8uEUysV49DUlYvh/evVHihjrG2SOrOiHj947PRixPvrKE4aDwEYhnMtaj9XRmRYWpI22kepXG8Zkch7fvjRv011nTvOO1EjqCHxaLZcHffCX9lo6yDZaxGSUaRWHv1WNY1zT7lh1g== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(10201501046)(3231311)(944501410)(52105095)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123558120)(20161123560045)(20161123564045)(201708071742011)(7699016); SRVR:AM0PR08MB3347; BCL:0; PCL:0; RULEID:; SRVR:AM0PR08MB3347; X-Forefront-PRVS: 0771670921 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(39850400004)(136003)(396003)(376002)(366004)(346002)(199004)(189003)(36756003)(305945005)(53416004)(105586002)(51416003)(48376002)(50226002)(8936002)(6116002)(7736002)(956004)(3846002)(69596002)(50466002)(68736007)(186003)(106356001)(2616005)(16526019)(16586007)(47776003)(486006)(476003)(52116002)(446003)(66066001)(86362001)(14444005)(107886003)(76176011)(2351001)(4326008)(316002)(5660300001)(25786009)(53936002)(478600001)(2361001)(6506007)(386003)(2906002)(6916009)(6486002)(6512007)(81156014)(81166006)(97736004)(6666003)(11346002)(8676002)(26005)(7416002)(44832011); DIR:OUT; SFP:1102; SCL:1; SRVR:AM0PR08MB3347; H:xantnef-ws.sw.ru; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM0PR08MB3347; 23:ypl9PjeJ4xGVmFiYnjmpSRdEqX+/ymVeXiD5S/jqT?= FAHuLhCkyJDkD2J1UNbRXdhcMycgdj446cux4X/vMHFVw0xO6XjvH07ThPz3mp6FFoCry6YF7K9byTZVOVvLmyM6DgeWz0klLq7KSnL0Va3pja6MgIXYlvJK4zgg3+onrDb1P+WP/otDiSV1myCKetuN3DgLvBSlDUASMSEBOmQT3VCeWlpNvK2xG2+pN9toy5FL1qoECIFpvB+xDD89y2Vp8LDA4y5l/7Kwa2KvU9vNMGiJHMrfBGkL7dt40Tfv3ZNCLlf9r6QFTEetHz5Gg5RUzxuWY4qDq7qgW3HgxTWTxQAhvzKdKJXsX676MLuPgVnu+fTv+lVP1yKF3LGgS8/P8FM2QTMqPk4CLxrGWnjimky9rVQF4f6WUlWtdO+bWHJE5hHef40HIRFs6xn3xdec5YgPiMrB3s+XU2QokaDEsB8PS3lXCrNl7WjTn6pdrJo5f2SyehV4WY5C3oFeTp02RvLBmO5dJGVojOtqhNkYI8hfzXloee0dPrryprACVhBZuhcfKVa0fCPKSA7ZsU0HVku4X5Ci5mcLzPJa0OeIbUf8mUiRZqmvJwG4QETRISoXSxDFj0peYG5VaTon5Y71Y7JsZo/VyxHjWGkxib3BH4mTzOueF37LYemhuDgUAu9AViKswXgeV6fWqsBBRZJ7NxZAp+ptjKRhFr1s4CC+BAY/GH5CVD2Kqx0b+30WpLbHTNld2NGo1umTXFq2buD1LM6iSxq5B+PhptxAVQjFz2hMtdzFvIzeBi7yPwQV9Bjhr6HJsfcOTye2nmsqnu2FGarHd16xOfSeBPkmUg2oJhxbqmj3yJ7oLg9spWYQIxwqkMBN1DUyQbcP4sxQTpS+o6JdpGtylj0F/WXYG45iOo6NqZ2hzOjb+zj4WCsPM0NimeqN+1BDKWAaXbsqguR+rTi7MpEC9yZw+HlHQa7c1as30VbisJdG2RyQoZsqebgslpltC3oeeI67F/wb63n+Rsg/GyV/wDpKmd84qyIcXKVdk671/KZg4wIFjeqowohgIlIpR8rcQlhvjoRCJoLXoN22K32c1YtFPCSKGpMW8HpFAxDspF+WVOCK1bYEkTVCMKX8h0J9plbBJF+ZxTNp9o7iQOxgCN0ufSE/RjzbFkr6eFx5AnIrLroQp76E2TZdOKCDqICdvRC/YPERvhRcNYY5llJH5LomgOO9S0tDbCKKR10JtS/IAcbvUtcgywUKyW9B0CZwfbo8HjhshZjqLdtawSjCAmL40F8OvYnxqdqn43VP2ieGGrABSYcO812cObAFI1mr5aBeJLcIOgV X-Microsoft-Antispam-Message-Info: KqK04VAcUrk0mOug5aMAa3U8iceOioji8MwJ537iLL/mLpcr5pLiWmUVjRAMVUAC7vfz9+fwVwjz2mFO7MF6jNaSp/JuRYL+d9pb72om4gba3mqBg97pLWN+CD7lrsnJ0Torf27jHQ4/NZG6G5sPPwZaIPGS+XEt9e5N1s748phd+vN6rnB5uy2L6puP34oMPo2JjQv00GHqdL9s5jW75tUMtx9uM7aWhuwNKDnJGi+ef0R15Y++XRJhCXORCcyIZLh3SvrrqsmLyHk6Hv//FACQUCnzZnVnwEjA7OIqve87wXnSEEGa43wDhSwCWC8OacPFZplzaeuNneJmNQ5ucPXxFdLTzt1i8ShKxpT5SMg= X-Microsoft-Exchange-Diagnostics: 1; AM0PR08MB3347; 6:5Hy/eAZJGMTdHKEUemmVYFpZUj77AAApw4wh6XOMA3QDYKdyv2eFvXZlBDSioovUYnCuYTsEFSSRvFZtcEA0Q32/+qFxdDt7IBix7+l6Z2R3wNRN83kkjfTNAr1cQDspwT9qDhvE5LRjni/CNlX2ZPJkxF84Ry1McXGSm3Mm+hzRaJadfB5mFHtK1snqq9tRtk07cS1EUHWbCZBJm1fCzdYftarPcQH9S8JyVfJQhR0P90Ejt0M4sv3WBRasXYoEfB4V67YaKQRgNmMUD6p5v0R8o+bY3lhvt2fgvoLIYZmH5X5o4A85Oz7+qafrc90BpAGdjC2o6jAK2ywI2LdwdwoGX9m5829Ib0Vcchas6o1jDzyS4WZVaMVg1t1N4dmcwwetJgq+KNR6XHYnPG0e63YZohYTYjyjxBDXz5ZxK2G8sECbBhvXSgAhAs0bL3VnecvcTHAhj8j3u6QZkIu7hA==; 5:ZufX3BMVVbe4f3cT+Tv7OShEHy2jm6GTh6PX9um/kWOHs6eYYOY1gP0foKJRK7rvWcrg/6hFVVAHFaHALvg2+uSv2CDgucM/FYheTM6HthJv7I+cKhdEEKjuIE3Yg61USTcj/cwvxBFiqKQmjju3Prkxi4dVvqrHAA/W2lxzUjs=; 7:A1NNA9pHEs3ynUmoc76HdReEf8DlnQFtf+atXIGoetnOVFkM63gLzmVQnvxnop93leUgaYo/aDpgMyjItUw0VEHvxxY+bHCUvVSgxirpiBgB17zkSxEtRzKjLcAAIlUtzuy7syVQ4LGEZk5AE/dZLNADXVoeY6MknWJJ3OsqxfGdYkOv8eGnlixcN/IuweThhx/V4BEs9vtBNGcukD5dMhgDAMZ6ZGf+xU8jOtCb1+bVqNcxhhklXi+CshEeUrAa SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM0PR08MB3347; 20:r490F9LzHVV8Fw2RCjCNyIwWT/6obPZelzXUbPmm5L1pRfdU4iPeh2U6uZ0itA/tcVIUXoztMV0kkCSG8Q+Ga7RHWgR3lwzetXKqBUEHhkqrQgl9iBPTAKIsJf7mPB8bLWWBm6mqGy/wWbpS+A833aZ0T3tTef3SA6kBEVx24VM= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Aug 2018 09:46:50.4044 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: dc01c90e-d33a-4c3b-bee3-08d6074b0574 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3347 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.4.110 Subject: [Qemu-devel] [PATCH v4 6/8] scsi: account unmap operations X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, Anton Nefedov , famz@redhat.com, den@virtuozzo.com, qemu-block@nongnu.org, armbru@redhat.com, mreitz@redhat.com, berto@igalia.com, pbonzini@redhat.com, jsnow@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Anton Nefedov Reviewed-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Alberto Garcia --- hw/scsi/scsi-disk.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c index 9d10daf..0aac137 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -1664,6 +1664,10 @@ static void scsi_unmap_complete_noio(UnmapCBData *data, int ret) goto done; } + block_acct_start(blk_get_stats(s->qdev.conf.blk), &r->acct, + r->sector_count * s->qdev.blocksize, + BLOCK_ACCT_UNMAP); + r->req.aiocb = blk_aio_pdiscard(s->qdev.conf.blk, r->sector * s->qdev.blocksize, r->sector_count * s->qdev.blocksize, @@ -1690,10 +1694,11 @@ static void scsi_unmap_complete(void *opaque, int ret) r->req.aiocb = NULL; aio_context_acquire(blk_get_aio_context(s->qdev.conf.blk)); - if (scsi_disk_req_check_error(r, ret, false)) { + if (scsi_disk_req_check_error(r, ret, true)) { scsi_req_unref(&r->req); g_free(data); } else { + block_acct_done(blk_get_stats(s->qdev.conf.blk), &r->acct); scsi_unmap_complete_noio(data, ret); } aio_context_release(blk_get_aio_context(s->qdev.conf.blk)); @@ -1740,10 +1745,12 @@ static void scsi_disk_emulate_unmap(SCSIDiskReq *r, uint8_t *inbuf) return; invalid_param_len: + block_acct_invalid(blk_get_stats(s->qdev.conf.blk), BLOCK_ACCT_UNMAP); scsi_check_condition(r, SENSE_CODE(INVALID_PARAM_LEN)); return; invalid_field: + block_acct_invalid(blk_get_stats(s->qdev.conf.blk), BLOCK_ACCT_UNMAP); scsi_check_condition(r, SENSE_CODE(INVALID_FIELD)); } From patchwork Tue Aug 21 09:46:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Nefedov X-Patchwork-Id: 10571317 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7314A921 for ; Tue, 21 Aug 2018 09:57:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6128229D44 for ; Tue, 21 Aug 2018 09:57:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 555DF29D4C; Tue, 21 Aug 2018 09:57:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BFFE729D50 for ; Tue, 21 Aug 2018 09:57:02 +0000 (UTC) Received: from localhost ([::1]:52027 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fs3PK-0005Oy-56 for patchwork-qemu-devel@patchwork.kernel.org; Tue, 21 Aug 2018 05:57:02 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48916) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fs3Fc-0003zQ-Ih for qemu-devel@nongnu.org; Tue, 21 Aug 2018 05:47:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fs3FX-00084J-OJ for qemu-devel@nongnu.org; Tue, 21 Aug 2018 05:47:00 -0400 Received: from mail-eopbgr40111.outbound.protection.outlook.com ([40.107.4.111]:59296 helo=EUR03-DB5-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fs3FX-00083k-8j; Tue, 21 Aug 2018 05:46:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=R3NFtSriKbaSY3WjKqAnepDtbfCyoeSTwhmxmRAz8To=; b=d58J0OMJjIy94XBYvjpgvKBsB6zdvmDd6eKuTzViV7Mcdwm2dvN6gFHpfoy9nDcopFIkwaorkMYpYjDXRdr1rOogKJ2d0QC9b69YMu/LbZA60SFbXb8a/Ahnb3ITM478Rpy6Rd1bcwRR5INwb7YejA1Au+UEfjerezWz+y+SIok= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=anton.nefedov@virtuozzo.com; Received: from xantnef-ws.sw.ru (185.231.240.5) by AM0PR08MB3347.eurprd08.prod.outlook.com (2603:10a6:208:5f::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1059.22; Tue, 21 Aug 2018 09:46:52 +0000 From: Anton Nefedov To: qemu-devel@nongnu.org Date: Tue, 21 Aug 2018 12:46:18 +0300 Message-Id: <1534844779-118784-8-git-send-email-anton.nefedov@virtuozzo.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1534844779-118784-1-git-send-email-anton.nefedov@virtuozzo.com> References: <1534844779-118784-1-git-send-email-anton.nefedov@virtuozzo.com> MIME-Version: 1.0 X-Originating-IP: [185.231.240.5] X-ClientProxiedBy: HE1PR08CA0076.eurprd08.prod.outlook.com (2603:10a6:7:2a::47) To AM0PR08MB3347.eurprd08.prod.outlook.com (2603:10a6:208:5f::20) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0f53f7cf-66a8-442c-78a5-08d6074b0690 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:AM0PR08MB3347; X-Microsoft-Exchange-Diagnostics: 1; AM0PR08MB3347; 3:gHkLBMB5wKRFkr4QUGWwV845sLEZxxVRc/+ZvrhOic9wiXGHOBdCuiouJ52T9dwWXQjnB3RWtx/pU5R0I3oYygmvpkS+ShrCbEFifrHl8kbOwjYOf8H+RJ9vvBIBMRHVae8RkGHylbVLgbSYIeg1ttXfo1LbJT0EhyFYJBN0G68s8o3QbBc55fbJaxizTxYh6xVFc+hKo8ZB+2YXHFcOTBD2/2V/6YSv6Efe3woSwkJStDeLhWNXENwl6QTu8gr/; 25:eK/JUoxlcVJHuCu8bt9C9d5T3XWLw569Oc1A1PDqxqRDFLG9YvtjYhkr2cQwI6X59GErkFm+6aY9mK76Q25E7H3rFLk/IfP27I7SC/hE6AYKUxJGUdz7nFACuQ6jKfVo31CjdpPl5HWQA9epZsDyrQ/IAPjWRPJCXpmWxDUmh2fVNJrOrJSWf77p5yi7vLI2h1+bpwQjb+VRcekmXHRC2s9JvKhK2qWSSc/pV9M4gpma0cOfoQyj78msezC9I2X3KpsTpmCPhg7kJxcH/OuP2UuCA6kLt7rkKr1kUk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/ob+meDT/NfA0ABcIqJZa9H69lQfDg9P2xB8fui0DbyO/OtiZ0FRaOjkPg2VvIo/hsA== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(10201501046)(3231311)(944501410)(52105095)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123558120)(20161123560045)(20161123564045)(201708071742011)(7699016); SRVR:AM0PR08MB3347; BCL:0; PCL:0; RULEID:; SRVR:AM0PR08MB3347; X-Forefront-PRVS: 0771670921 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(39850400004)(136003)(396003)(376002)(366004)(346002)(199004)(189003)(36756003)(305945005)(53416004)(105586002)(51416003)(48376002)(50226002)(8936002)(6116002)(7736002)(956004)(3846002)(69596002)(50466002)(68736007)(186003)(106356001)(2616005)(16526019)(16586007)(47776003)(486006)(476003)(52116002)(446003)(66066001)(86362001)(14444005)(107886003)(76176011)(2351001)(4326008)(316002)(5660300001)(25786009)(15650500001)(53936002)(478600001)(2361001)(6506007)(386003)(2906002)(6916009)(6486002)(6512007)(81156014)(81166006)(97736004)(6666003)(11346002)(8676002)(26005)(7416002)(44832011); DIR:OUT; SFP:1102; SCL:1; SRVR:AM0PR08MB3347; H:xantnef-ws.sw.ru; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM0PR08MB3347; 23:JPAsjYno6RSahFa3C4NLDxS6Uz4hPp1U2oxfXTIx8?= qttIwQUsytN7TMRuyhcW3bv9S4YCaMGtJqO9cesmGU4tGWkt1Mkx8LYZ/qS3TwG+/0jyYcDXAJ3J35b1wRoCAQgZRKTby1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LawEl+VAWQ7J0M4XwoH16Jx5rJgb1HDdpCGQWY8p3ZiY/+e6HembZG6i3PuQJxpDROajV1NTyeETXUAaBpCNd7UqVPORTNn9bQCFASM/MkRS28cYtzKi9a+nggtgc92bVhIXACpkovhMW/Nus+2ptdEpWU3o9WlA=; 7:/b4Sc4dMh7PgD4enkoVU0X0j7D0RFEHyzgP9Q2u2kdsAQAI74a7lqkqyFxhtRNdnasmfJBCu2Cz2ejUkew0kXwLgoUic7NcBu7M3XOhkJK/R70WBfpTO/YSxsmtrBF/mloloDPhohAy1ZluEmkqSCbuXXoFdJdxNWHmipLuHmBuD6xJWRlG6+AZp6zNZI/57ShlUo6zFyXtb7nlb27hse475MBLfZeLxw7k/GWLkleoPWU9cqibQFKLtPaXTnpRJ SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM0PR08MB3347; 20:NI9XVSCf5lbnXl4NMk9Ibi97drHBReVpr6d4QqTdoaaYssMDZvvRbasLcfiNyQl7qLXEd76ga+5DU8g13fPrppn1Dq8s/Cethtd2lnLssxL4uSs70+LaS64QDBEbRhynvTO/s/68c55OkkYBuYXNiUAJUjDDMU/Vqxrnzm98elU= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Aug 2018 09:46:52.2639 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0f53f7cf-66a8-442c-78a5-08d6074b0690 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3347 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.4.111 Subject: [Qemu-devel] [PATCH v4 7/8] file-posix: account discard operations X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, Anton Nefedov , famz@redhat.com, den@virtuozzo.com, qemu-block@nongnu.org, armbru@redhat.com, mreitz@redhat.com, berto@igalia.com, pbonzini@redhat.com, jsnow@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP This will help to identify how many of the user-issued discard operations (accounted on a device level) have actually suceeded down on the host file (even though the numbers will not be exactly the same if non-raw format driver is used (e.g. qcow2 sending metadata discards)). Note that these numbers will not include discards triggered by write-zeroes + MAY_UNMAP calls. Signed-off-by: Anton Nefedov --- block/file-posix.c | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/block/file-posix.c b/block/file-posix.c index fe83cbf..c420f76 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -163,6 +163,11 @@ typedef struct BDRVRawState { bool has_fallocate; bool needs_alignment; bool check_cache_dropped; + struct { + int64_t discard_nb_ok; + int64_t discard_nb_failed; + int64_t discard_bytes_ok; + } stats; PRManager *pr_mgr; } BDRVRawState; @@ -2575,12 +2580,25 @@ static void coroutine_fn raw_co_invalidate_cache(BlockDriverState *bs, #endif /* !__linux__ */ } +static void raw_account_discard(BDRVRawState *s, uint64_t nbytes, int ret) +{ + if (ret) { + s->stats.discard_nb_failed++; + } else { + s->stats.discard_nb_ok++; + s->stats.discard_bytes_ok += nbytes; + } +} + static coroutine_fn int raw_co_pdiscard(BlockDriverState *bs, int64_t offset, int bytes) { BDRVRawState *s = bs->opaque; + int ret; - return paio_submit_co(bs, s->fd, offset, NULL, bytes, QEMU_AIO_DISCARD); + ret = paio_submit_co(bs, s->fd, offset, NULL, bytes, QEMU_AIO_DISCARD); + raw_account_discard(s, bytes, ret); + return ret; } static int coroutine_fn raw_co_pwrite_zeroes( @@ -3077,10 +3095,14 @@ hdev_co_pdiscard(BlockDriverState *bs, int64_t offset, int bytes) ret = fd_open(bs); if (ret < 0) { + raw_account_discard(s, bytes, ret); return ret; } - return paio_submit_co(bs, s->fd, offset, NULL, bytes, - QEMU_AIO_DISCARD | QEMU_AIO_BLKDEV); + + ret = paio_submit_co(bs, s->fd, offset, NULL, bytes, + QEMU_AIO_DISCARD | QEMU_AIO_BLKDEV); + raw_account_discard(s, bytes, ret); + return ret; } static coroutine_fn int hdev_co_pwrite_zeroes(BlockDriverState *bs, From patchwork Tue Aug 21 09:46:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Nefedov X-Patchwork-Id: 10571319 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 88CA0921 for ; Tue, 21 Aug 2018 09:58:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 75AC7299A0 for ; Tue, 21 Aug 2018 09:58:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 69537299AF; Tue, 21 Aug 2018 09:58:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9649B29990 for ; Tue, 21 Aug 2018 09:58:37 +0000 (UTC) Received: from localhost ([::1]:52032 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fs3Qq-0006FR-R5 for patchwork-qemu-devel@patchwork.kernel.org; Tue, 21 Aug 2018 05:58:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48971) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fs3Fe-000422-V6 for qemu-devel@nongnu.org; Tue, 21 Aug 2018 05:47:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fs3Fa-00086L-5D for qemu-devel@nongnu.org; Tue, 21 Aug 2018 05:47:02 -0400 Received: from mail-eopbgr40131.outbound.protection.outlook.com ([40.107.4.131]:48462 helo=EUR03-DB5-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fs3FZ-00085E-Kp; Tue, 21 Aug 2018 05:46:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=M9NaEPEAeQQ5jlmY5Sg5vGfVuh67ReC4Dp0qNAyb81I=; b=fUmkrx44cYJnmkVo1orXJCZiGtY8OrOmLu6PGaxidxRaZwze0t31HAbCwvBaY9xwGDRmuaRlqdw/4MFAJQQLaXaoZl5VO6ml8LqF2LV8Izp/YxZwFCOf1Zg0zC6Pl7APnH8+nk5swSNzerNfLgpU2avxlh+tu/0KxkGSDMlW57c= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=anton.nefedov@virtuozzo.com; Received: from xantnef-ws.sw.ru (185.231.240.5) by AM0PR08MB3347.eurprd08.prod.outlook.com (2603:10a6:208:5f::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1059.22; Tue, 21 Aug 2018 09:46:54 +0000 From: Anton Nefedov To: qemu-devel@nongnu.org Date: Tue, 21 Aug 2018 12:46:19 +0300 Message-Id: <1534844779-118784-9-git-send-email-anton.nefedov@virtuozzo.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1534844779-118784-1-git-send-email-anton.nefedov@virtuozzo.com> References: <1534844779-118784-1-git-send-email-anton.nefedov@virtuozzo.com> MIME-Version: 1.0 X-Originating-IP: [185.231.240.5] X-ClientProxiedBy: HE1PR08CA0076.eurprd08.prod.outlook.com (2603:10a6:7:2a::47) To AM0PR08MB3347.eurprd08.prod.outlook.com (2603:10a6:208:5f::20) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b016028c-effc-4b30-e313-08d6074b07bc X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:AM0PR08MB3347; X-Microsoft-Exchange-Diagnostics: 1; AM0PR08MB3347; 3:iyE7BIxro0I+F7L7KzbhgsrNM+Pn4gxfh9OX5D/RQSkMMYXZ5wwYGeA4xnzDBgbms+s09TjMwUGlM0x+6RUDXIOlgRqNGgQ7k4ZeekKYalbn7oWSnEAlBPQZA+7fteqw1qMe1vaByK0Hszj4Qb1F/HsSrIjelnqzNXxN2sFG8dKV03hmDg4OH5K4kPExD/1E4A9hfK6U8xmYTrZxzJDMinwqAvDxZ2EWIgJBaDl1Bw2mBoX1Kyzt+1ziLJ6IG5f8; 25:oP2EW315eBzxNZrWISA8Jvmjzs1AwPbZcOI5tKwhF7VbpCOjh9P2WUBoP0ImO+DMDemjOccTDc9sG4RUTKJJ/TbCEDQASNltWEQOXBDY7x2t5qOX5lsvp2zg/MNF80AHMwB6MXaECSc0Q8HFcoAMcCLfa1WrRwkMCIUPGwdc/G0mMg1pXMDK07niV0CGM8DJTz1q3B8ojRy1Ol4JUBYc15nIqMqCnTebQhK05+SWFZD9n6X+YOno7XVp4g//RJSg+WsJcQMeRyb9e3lOQ1bbV3vvJ72FpbadeXv+jQAPbPIxSXldTVksykOuzQq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8RD+z81av26Yc382SpHzfjLfaDKPNzgLmQI/Abw9kUArk2QKEH8kJjIwrksEq+zOW76h6km1UqHaqeDlBHj3NE9wHj1VGiYw6Ez1tQFYOtGqs6OC1SbTa9gUZwR X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(20558992708506); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(10201501046)(3231311)(944501410)(52105095)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123558120)(20161123560045)(20161123564045)(201708071742011)(7699016); SRVR:AM0PR08MB3347; BCL:0; PCL:0; RULEID:; SRVR:AM0PR08MB3347; X-Forefront-PRVS: 0771670921 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(39850400004)(136003)(396003)(376002)(366004)(346002)(199004)(189003)(36756003)(305945005)(53416004)(105586002)(51416003)(48376002)(50226002)(8936002)(6116002)(7736002)(956004)(3846002)(69596002)(50466002)(68736007)(186003)(106356001)(2616005)(16526019)(16586007)(47776003)(486006)(476003)(52116002)(446003)(66066001)(86362001)(14444005)(107886003)(76176011)(2351001)(4326008)(316002)(5660300001)(25786009)(53936002)(478600001)(2361001)(6506007)(386003)(2906002)(6916009)(6486002)(6512007)(81156014)(81166006)(97736004)(6666003)(11346002)(8676002)(26005)(7416002)(44832011); DIR:OUT; SFP:1102; SCL:1; SRVR:AM0PR08MB3347; H:xantnef-ws.sw.ru; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM0PR08MB3347; 23:EuTiyKwKQKV4a80YRMf444Xlsn/K1z1v3jfVU4ukF?= tBv8370LBoxpn08tU7rYKRLhAuFu0EtJNL7M/i/xaTMz0Y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g==; 5:CaLKCXsg3jlggzeLtLr9bVvwIfW6PTixymcZm+HK2biwgsdHX3+nTJtRu1Tvvd7LTYwsU+UpMkncFGiAu2MMRiwLaQztkQxzLx+22IAFO5iCyWir5TiQI6xRSO2gOv7kSwCWaIVmSmY8Pn5vkdnhE+Op5fwQ9QZZ+FJqkw2DIhk=; 7:/umHLTjLl0x6FCVltszj2UM5QBBH7tV0/XwruGHBQ2khY5KG3EAFgDksAX6zxu/c8RouFjAhdZw6c2itIfa/VgYlPv1oekYBfbB2cJAjHRf2nFErKj06hywsc65qMnQpM54thdkFnwRfUMpHlSY3hk0ES9vvrONanNzI10PC6QF+tZJxfkG/6kHbkUjy+5JRDG5dC9CZWqMDVgi5xPf+1z1CrN1olr4eWOMn1ZLU7mNxyaHK/9fzl3nNJDGI3BQp SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM0PR08MB3347; 20:khSOCaunJ5R4eIO/KoJOeY0xoojU6t3I1KZ1S7OZEP6FUyWy+faGWj1SLkbycXsBbQ/9CykGUjW1xRwxROMBlivxIDnsP1C4Q+D1/3gjj1/hiSsP98ppOhCIzstqdBIVvK0feYhIUJUi2hf0ytIpGKaQmPsaRgLKW1JoFHefUnU= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Aug 2018 09:46:54.1858 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b016028c-effc-4b30-e313-08d6074b07bc X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3347 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.4.131 Subject: [Qemu-devel] [PATCH v4 8/8] qapi: query-blockstat: add driver specific file-posix stats X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, Anton Nefedov , famz@redhat.com, den@virtuozzo.com, qemu-block@nongnu.org, armbru@redhat.com, mreitz@redhat.com, berto@igalia.com, pbonzini@redhat.com, jsnow@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP A block driver can provide a callback to report driver-specific statistics. file-posix driver now reports discard statistics Signed-off-by: Anton Nefedov --- qapi/block-core.json | 39 +++++++++++++++++++++++++++++++++++++++ include/block/block.h | 1 + include/block/block_int.h | 1 + block.c | 9 +++++++++ block/file-posix.c | 17 +++++++++++++++++ block/qapi.c | 5 +++++ tests/qemu-iotests/227.out | 18 ++++++++++++++++++ 7 files changed, 90 insertions(+) diff --git a/qapi/block-core.json b/qapi/block-core.json index 19d4743..9cac2aa 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -878,6 +878,42 @@ '*x_flush_latency_histogram': 'BlockLatencyHistogramInfo' } } ## +# @BlockStatsSpecificFile: +# +# File driver statistics +# +# @discard-nb-ok: The number of succeeded discard operations performed by +# the driver. +# +# @discard-nb-failed: The number of failed discard operations performed by +# the driver. +# +# @discard-bytes-ok: The number of bytes discarded by the driver. +# +# Since 3.1 +## +{ 'struct': 'BlockStatsSpecificFile', + 'data': { + 'discard-nb-ok': 'int', + 'discard-nb-failed': 'int', + 'discard-bytes-ok': 'int' + } } + +## +# @BlockStatsSpecific: +# +# Block driver specific statistics +# +# Since: 3.1 +## +{ 'union': 'BlockStatsSpecific', + 'base': { 'driver': 'BlockdevDriver' }, + 'discriminator': 'driver', + 'data': { + 'file': 'BlockStatsSpecificFile' + } } + +## # @BlockStats: # # Statistics of a virtual block device or a block backing device. @@ -892,6 +928,8 @@ # # @stats: A @BlockDeviceStats for the device. # +# @driver-specific: Optional driver-specific stats. (Since 3.1) +# # @parent: This describes the file block device if it has one. # Contains recursively the statistics of the underlying # protocol (e.g. the host file for a qcow2 image). If there is @@ -905,6 +943,7 @@ { 'struct': 'BlockStats', 'data': {'*device': 'str', '*qdev': 'str', '*node-name': 'str', 'stats': 'BlockDeviceStats', + '*driver-specific': 'BlockStatsSpecific', '*parent': 'BlockStats', '*backing': 'BlockStats'} } diff --git a/include/block/block.h b/include/block/block.h index 4e0871a..cbfd831 100644 --- a/include/block/block.h +++ b/include/block/block.h @@ -478,6 +478,7 @@ const char *bdrv_get_device_or_node_name(const BlockDriverState *bs); int bdrv_get_flags(BlockDriverState *bs); int bdrv_get_info(BlockDriverState *bs, BlockDriverInfo *bdi); ImageInfoSpecific *bdrv_get_specific_info(BlockDriverState *bs); +BlockStatsSpecific *bdrv_get_specific_stats(BlockDriverState *bs); void bdrv_round_to_clusters(BlockDriverState *bs, int64_t offset, int64_t bytes, int64_t *cluster_offset, diff --git a/include/block/block_int.h b/include/block/block_int.h index 903b9c1..3ffe2e1 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -320,6 +320,7 @@ struct BlockDriver { Error **errp); int (*bdrv_get_info)(BlockDriverState *bs, BlockDriverInfo *bdi); ImageInfoSpecific *(*bdrv_get_specific_info)(BlockDriverState *bs); + BlockStatsSpecific *(*bdrv_get_specific_stats)(BlockDriverState *bs); int coroutine_fn (*bdrv_save_vmstate)(BlockDriverState *bs, QEMUIOVector *qiov, diff --git a/block.c b/block.c index 6161dbe..0ce4f4d 100644 --- a/block.c +++ b/block.c @@ -4200,6 +4200,15 @@ ImageInfoSpecific *bdrv_get_specific_info(BlockDriverState *bs) return NULL; } +BlockStatsSpecific *bdrv_get_specific_stats(BlockDriverState *bs) +{ + BlockDriver *drv = bs->drv; + if (!drv || !drv->bdrv_get_specific_stats) { + return NULL; + } + return drv->bdrv_get_specific_stats(bs); +} + void bdrv_debug_event(BlockDriverState *bs, BlkdebugEvent event) { if (!bs || !bs->drv || !bs->drv->bdrv_debug_event) { diff --git a/block/file-posix.c b/block/file-posix.c index c420f76..cc46ef8 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -2623,6 +2623,21 @@ static int raw_get_info(BlockDriverState *bs, BlockDriverInfo *bdi) return 0; } +static BlockStatsSpecific *raw_get_specific_stats(BlockDriverState *bs) +{ + BDRVRawState *s = bs->opaque; + BlockStatsSpecific *stats = g_new(BlockStatsSpecific, 1); + + stats->driver = BLOCKDEV_DRIVER_FILE; + stats->u.file = (BlockStatsSpecificFile){ + .discard_nb_ok = s->stats.discard_nb_ok, + .discard_nb_failed = s->stats.discard_nb_failed, + .discard_bytes_ok = s->stats.discard_bytes_ok, + }; + + return stats; +} + static QemuOptsList raw_create_opts = { .name = "raw-create-opts", .head = QTAILQ_HEAD_INITIALIZER(raw_create_opts.head), @@ -2734,6 +2749,7 @@ BlockDriver bdrv_file = { .bdrv_get_info = raw_get_info, .bdrv_get_allocated_file_size = raw_get_allocated_file_size, + .bdrv_get_specific_stats = raw_get_specific_stats, .bdrv_check_perm = raw_check_perm, .bdrv_set_perm = raw_set_perm, .bdrv_abort_perm_update = raw_abort_perm_update, @@ -3219,6 +3235,7 @@ static BlockDriver bdrv_host_device = { .bdrv_get_info = raw_get_info, .bdrv_get_allocated_file_size = raw_get_allocated_file_size, + .bdrv_get_specific_stats = raw_get_specific_stats, .bdrv_check_perm = raw_check_perm, .bdrv_set_perm = raw_set_perm, .bdrv_abort_perm_update = raw_abort_perm_update, diff --git a/block/qapi.c b/block/qapi.c index df31f35..74f762e 100644 --- a/block/qapi.c +++ b/block/qapi.c @@ -535,6 +535,11 @@ static BlockStats *bdrv_query_bds_stats(BlockDriverState *bs, s->stats->wr_highest_offset = stat64_get(&bs->wr_highest_offset); + s->driver_specific = bdrv_get_specific_stats(bs); + if (s->driver_specific) { + s->has_driver_specific = true; + } + if (bs->file) { s->has_parent = true; s->parent = bdrv_query_bds_stats(bs->file->bs, blk_level); diff --git a/tests/qemu-iotests/227.out b/tests/qemu-iotests/227.out index 736f2e3..62a9dba 100644 --- a/tests/qemu-iotests/227.out +++ b/tests/qemu-iotests/227.out @@ -15,6 +15,8 @@ Testing: -drive driver=null-co,if=virtio { "device": "virtio0", "stats": { + "unmap_operations": 0, + "unmap_merged": 0, "flush_total_time_ns": 0, "wr_highest_offset": 0, "wr_total_time_ns": 0, @@ -24,13 +26,17 @@ Testing: -drive driver=null-co,if=virtio "wr_bytes": 0, "timed_stats": [ ], + "failed_unmap_operations": 0, "failed_flush_operations": 0, "account_invalid": true, "rd_total_time_ns": 0, + "invalid_unmap_operations": 0, "flush_operations": 0, "wr_operations": 0, + "unmap_bytes": 0, "rd_merged": 0, "rd_bytes": 0, + "unmap_total_time_ns": 0, "invalid_flush_operations": 0, "account_failed": true, "rd_operations": 0, @@ -73,6 +79,8 @@ Testing: -drive driver=null-co,if=none { "device": "none0", "stats": { + "unmap_operations": 0, + "unmap_merged": 0, "flush_total_time_ns": 0, "wr_highest_offset": 0, "wr_total_time_ns": 0, @@ -82,13 +90,17 @@ Testing: -drive driver=null-co,if=none "wr_bytes": 0, "timed_stats": [ ], + "failed_unmap_operations": 0, "failed_flush_operations": 0, "account_invalid": true, "rd_total_time_ns": 0, + "invalid_unmap_operations": 0, "flush_operations": 0, "wr_operations": 0, + "unmap_bytes": 0, "rd_merged": 0, "rd_bytes": 0, + "unmap_total_time_ns": 0, "invalid_flush_operations": 0, "account_failed": true, "rd_operations": 0, @@ -160,6 +172,8 @@ Testing: -blockdev driver=null-co,node-name=null -device virtio-blk,drive=null,i { "device": "", "stats": { + "unmap_operations": 0, + "unmap_merged": 0, "flush_total_time_ns": 0, "wr_highest_offset": 0, "wr_total_time_ns": 0, @@ -169,13 +183,17 @@ Testing: -blockdev driver=null-co,node-name=null -device virtio-blk,drive=null,i "wr_bytes": 0, "timed_stats": [ ], + "failed_unmap_operations": 0, "failed_flush_operations": 0, "account_invalid": false, "rd_total_time_ns": 0, + "invalid_unmap_operations": 0, "flush_operations": 0, "wr_operations": 0, + "unmap_bytes": 0, "rd_merged": 0, "rd_bytes": 0, + "unmap_total_time_ns": 0, "invalid_flush_operations": 0, "account_failed": false, "rd_operations": 0,