From nobody Tue Apr 23 11:10:45 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1557835977; cv=none; d=zoho.com; s=zohoarc; b=QNYdyqMPX0VYdpdxLR5fuU8KbhhBPgAV2VBsrMM+UG6StUN8PIkE35yOnaDfTfWjCACWl498SZJA1XERFc71sg0KdGNLdGCuAds4lhbvUz3ADaeg+Pu1MuarS1lYJTAxKJxK4+O+WqpmvGom4nY43yM9fgXk8eHz6fPX8rMOGD4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557835977; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=Rg7D/a+iT9WfCd2aWRPFbMGZPpRwrY5dRk0eN4Tjngs=; b=N3d9meirGl2C1nMrWQiFbGCNdWLhxEoIqOHVJ878pfRDCAcUx1Dv8duQcrKF69MENeOTePlXuYS1+ApQJFoa60DfIKgcED4M9AenRuNWZtqDLE29xAP2DZ11PDErUhPzv00N5CioLu4pkhv3IizInDB0+EYWrzPl9Jy9Hq526i4= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1557835977386959.8062695804952; Tue, 14 May 2019 05:12:57 -0700 (PDT) Received: from localhost ([127.0.0.1]:47269 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQWIg-0004Xk-9E for importer@patchew.org; Tue, 14 May 2019 08:12:54 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60833) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQWGl-0003Fb-28 for qemu-devel@nongnu.org; Tue, 14 May 2019 08:10:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hQWGj-0001zn-CV for qemu-devel@nongnu.org; Tue, 14 May 2019 08:10:54 -0400 Received: from mail-ve1eur01on072b.outbound.protection.outlook.com ([2a01:111:f400:fe1f::72b]:39198 helo=EUR01-VE1-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 1hQWGb-0001pj-Ul; Tue, 14 May 2019 08:10:46 -0400 Received: from VI1PR08MB4078.eurprd08.prod.outlook.com (20.178.127.92) by VI1PR08MB4480.eurprd08.prod.outlook.com (20.179.27.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1900.16; Tue, 14 May 2019 12:10:41 +0000 Received: from VI1PR08MB4078.eurprd08.prod.outlook.com ([fe80::8ce8:ffb4:fe9:4900]) by VI1PR08MB4078.eurprd08.prod.outlook.com ([fe80::8ce8:ffb4:fe9:4900%3]) with mapi id 15.20.1878.024; Tue, 14 May 2019 12:10:41 +0000 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=Rg7D/a+iT9WfCd2aWRPFbMGZPpRwrY5dRk0eN4Tjngs=; b=PCd3iZyBRWmtH7jULuSKp+KjSBOZBME6BwAhTwpctHEhRQVDFx1Qr29noF+SPGKWGzvOxUrfMMtJ+v4ZbE+cGim4pEigY4oDdxlY5i4mFGNij0ZGr6rWWYGWmpEiDdMzAN8ekhLC19Mysr9iQheJrxje0G80PC4cINK7we/1cnI= From: Anton Nefedov To: "qemu-block@nongnu.org" Thread-Topic: [PATCH v7 1/9] qapi: group BlockDeviceStats fields Thread-Index: AQHVCk4Msg5xVF3ks0K0yXQYuJj01Q== Date: Tue, 14 May 2019 12:10:41 +0000 Message-ID: <20190514121015.32190-2-anton.nefedov@virtuozzo.com> References: <20190514121015.32190-1-anton.nefedov@virtuozzo.com> In-Reply-To: <20190514121015.32190-1-anton.nefedov@virtuozzo.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR0701CA0057.eurprd07.prod.outlook.com (2603:10a6:3:9e::25) To VI1PR08MB4078.eurprd08.prod.outlook.com (2603:10a6:803:e5::28) authentication-results: spf=none (sender IP is ) smtp.mailfrom=anton.nefedov@virtuozzo.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.17.1 x-originating-ip: [185.231.240.5] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 29aa7d06-e5f2-4ff3-48ac-08d6d8652ef9 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600141)(711020)(4605104)(2017052603328)(7193020); SRVR:VI1PR08MB4480; x-ms-traffictypediagnostic: VI1PR08MB4480: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6790; x-forefront-prvs: 0037FD6480 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(346002)(366004)(136003)(396003)(376002)(39850400004)(189003)(199004)(186003)(86362001)(6116002)(486006)(3846002)(66066001)(4326008)(256004)(52116002)(316002)(26005)(44832011)(36756003)(6512007)(6486002)(25786009)(6506007)(14444005)(478600001)(102836004)(6916009)(386003)(2351001)(54906003)(76176011)(64756008)(66446008)(66556008)(5640700003)(7736002)(14454004)(2616005)(2906002)(73956011)(53936002)(476003)(71190400001)(446003)(71200400001)(11346002)(99286004)(107886003)(66946007)(66476007)(2501003)(305945005)(6436002)(8936002)(1076003)(81166006)(81156014)(8676002)(5660300002)(50226002)(68736007); DIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR08MB4480; H:VI1PR08MB4078.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; received-spf: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: 3ZiYLaJgTMEaeYypNXmYesDANv7TkuFuoCbCXk0hnNOiLVIl/5dtHx5oJKzWrYKj5IJT+4UEiQISbr5/iBsnxIqJWoFmgPm/FomfdkuvRgEKOASL5YFoipNf/w8j6YK3mhC6T5B6GcrTuKWM9YFKoCGWKEa7dcV5TnMFNngzddyMInBQN2jjxdTtWETY1v0nUaKJm+VryEPXq6jRjXTTdiMOcUwHvmNKbZyMeBF5S5eDijLb0AEbXIIvTs8bMJZvqH8SXa2XPxlvEtSuHOmuFETovrDvLWmaGXAtLuFhyZFfOX13SVlYyfN+Tg+GqZWtVKkEp0EWF75UNlE8sgP/hpWyyXQilhs9fOgC3Qk+AF/R+fWPTcYYwr1b18ruCf2uikZ7MJTsAAbeTVYLSEE6893HU2lyQLr7aUfG5SuQajo= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 29aa7d06-e5f2-4ff3-48ac-08d6d8652ef9 X-MS-Exchange-CrossTenant-originalarrivaltime: 14 May 2019 12:10:41.3441 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB4480 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 2a01:111:f400:fe1f::72b Subject: [Qemu-devel] [PATCH v7 1/9] 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" , Vladimir Sementsov-Ogievskiy , "berto@igalia.com" , Denis Lunev , "qemu-devel@nongnu.org" , "mreitz@redhat.com" , Anton Nefedov , "pbonzini@redhat.com" , "jsnow@redhat.com" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) 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 Reviewed-by: Alberto Garcia Reviewed-by: Vladimir Sementsov-Ogievskiy --- 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 7ccbfff9d0..754d07f1fb 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -863,12 +863,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.1= 5.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 @@ -921,14 +921,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': 'in= t', + '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'], '*rd_latency_histogram': 'BlockLatencyHistogramInfo', --=20 2.17.1 From nobody Tue Apr 23 11:10:45 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1557836139; cv=none; d=zoho.com; s=zohoarc; b=mBBRMliP/23I0qzQJ4W61KSGEMGW+l7RIFY9zivzqwnTa0hCvsekDo9dbGqE3/wotJ4tlUIhWkXoqPPnWHAKiC7YLFzQ5SzYyvLot7cNkw98jZ98N18Xi6c52ScM2+Kjcx+CNVi5gdklc06uf+rZtLzuaqim4qrdcMCsptXs+1M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557836139; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=OoWsBi0VOeYTbTOIpGENEXoYFlpNwi7fDqAqXi9ALUU=; b=OJdtGJxdeB1PteyJpZ9mujHcgsPg8Fj4Q+7JaEuudxanZ98m8bbb28Kq8LVe8QM6ES9rxz0RErqix16ss0RryhJgM0Dmfut/c5hQBVwytmUh+F8w1xyRlk93acmRXWcaSqtX7ZvZzWRwpcnm2hOCgps6K6pV0N4jXXHaZMDyEwk= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1557836139610904.2877793415877; Tue, 14 May 2019 05:15:39 -0700 (PDT) Received: from localhost ([127.0.0.1]:47303 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQWLG-0006uE-Gn for importer@patchew.org; Tue, 14 May 2019 08:15:34 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60921) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQWGp-0003NV-Ug for qemu-devel@nongnu.org; Tue, 14 May 2019 08:11:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hQWGn-00022r-FF for qemu-devel@nongnu.org; Tue, 14 May 2019 08:10:59 -0400 Received: from mail-ve1eur01on072b.outbound.protection.outlook.com ([2a01:111:f400:fe1f::72b]:39198 helo=EUR01-VE1-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 1hQWGh-0001pj-Jb; Tue, 14 May 2019 08:10:52 -0400 Received: from VI1PR08MB4078.eurprd08.prod.outlook.com (20.178.127.92) by VI1PR08MB4480.eurprd08.prod.outlook.com (20.179.27.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1900.16; Tue, 14 May 2019 12:10:42 +0000 Received: from VI1PR08MB4078.eurprd08.prod.outlook.com ([fe80::8ce8:ffb4:fe9:4900]) by VI1PR08MB4078.eurprd08.prod.outlook.com ([fe80::8ce8:ffb4:fe9:4900%3]) with mapi id 15.20.1878.024; Tue, 14 May 2019 12:10:42 +0000 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=OoWsBi0VOeYTbTOIpGENEXoYFlpNwi7fDqAqXi9ALUU=; b=JF8fP4Ob8dWRqJ8UBuDKOBcbVkXn4BuV5QyOsRHZb1E/HLtIp+RLuo+algK9YwnGqd398HEK1NVMu1dYhVnyAd2mRFrNJYilRhgs5MAY2cXC2wZIDOU3EmOA171Q2A/XygoWFPbS0kYqKKBOOFjkSkRgN9LX0jLhswMevMhVAkE= From: Anton Nefedov To: "qemu-block@nongnu.org" Thread-Topic: [PATCH v7 2/9] qapi: add unmap to BlockDeviceStats Thread-Index: AQHVCk4N6mm8547R/kuZsscbVfUnfQ== Date: Tue, 14 May 2019 12:10:42 +0000 Message-ID: <20190514121015.32190-3-anton.nefedov@virtuozzo.com> References: <20190514121015.32190-1-anton.nefedov@virtuozzo.com> In-Reply-To: <20190514121015.32190-1-anton.nefedov@virtuozzo.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR0701CA0057.eurprd07.prod.outlook.com (2603:10a6:3:9e::25) To VI1PR08MB4078.eurprd08.prod.outlook.com (2603:10a6:803:e5::28) authentication-results: spf=none (sender IP is ) smtp.mailfrom=anton.nefedov@virtuozzo.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.17.1 x-originating-ip: [185.231.240.5] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 8422edfa-f0f9-4cfa-22ee-08d6d8652fa6 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600141)(711020)(4605104)(2017052603328)(7193020); SRVR:VI1PR08MB4480; x-ms-traffictypediagnostic: VI1PR08MB4480: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6430; x-forefront-prvs: 0037FD6480 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(346002)(366004)(136003)(396003)(376002)(39850400004)(189003)(199004)(186003)(86362001)(6116002)(486006)(3846002)(66066001)(4326008)(256004)(52116002)(316002)(26005)(44832011)(36756003)(6512007)(6486002)(25786009)(6506007)(14444005)(478600001)(102836004)(6916009)(386003)(2351001)(54906003)(76176011)(64756008)(66446008)(66556008)(5640700003)(7736002)(14454004)(2616005)(2906002)(73956011)(53936002)(476003)(71190400001)(446003)(71200400001)(11346002)(99286004)(107886003)(66946007)(66476007)(2501003)(305945005)(6436002)(8936002)(1076003)(81166006)(81156014)(8676002)(5660300002)(50226002)(68736007); DIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR08MB4480; H:VI1PR08MB4078.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; received-spf: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: VtEBDjR8g3wizRlLBiOST/+ZczXxvqaA7+qClCE1SwnZ0yTSaJAZeXx4INlAoiEq2MzxixjYJhZ7m/M1WZoyGvtaflHV6U850YlHNpVz7FC5po1r/6sy47MarytqPSjDGAjbUlZeyjwCnF0xIhSAaiPPakj6Q8z8UP7uycG40hSWjZxkTEQs9FYjqzRC7gg4+0DdRy2LPXpBSRismXJJcnzPMRSZ8M5P0zpDekZBSqRamuK8XGUk6Eiex4ZbR9GrL1hKD9KM07r2ZHPoj8v0IZK29WAmh0WT7q3c9OGiEvYheunVL2oci2uPF7QDr2+k8VJuHeZ6ntysSVMq4oGkxo7sM7wAyrG/e0DbZjGmOgXXT1B4fuBUm/wcUMDnJIKJvbA8uenjQe8Q7RzkU0WDEWl7K/qi0F0NuD6ayvU+hC0= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8422edfa-f0f9-4cfa-22ee-08d6d8652fa6 X-MS-Exchange-CrossTenant-originalarrivaltime: 14 May 2019 12:10:42.5739 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB4480 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 2a01:111:f400:fe1f::72b Subject: [Qemu-devel] [PATCH v7 2/9] 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" , Vladimir Sementsov-Ogievskiy , "berto@igalia.com" , Denis Lunev , "qemu-devel@nongnu.org" , "mreitz@redhat.com" , Anton Nefedov , "pbonzini@redhat.com" , "jsnow@redhat.com" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) 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 ++++++ tests/qemu-iotests/227.out | 18 ++++++++++++++++++ 4 files changed, 48 insertions(+), 6 deletions(-) diff --git a/qapi/block-core.json b/qapi/block-core.json index 754d07f1fb..55194f84ce 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -856,6 +856,8 @@ # # @wr_bytes: The number of bytes written by the device. # +# @unmap_bytes: The number of bytes unmapped by the device (Since 4.1) +# # @rd_operations: The number of read operations performed by the device. # # @wr_operations: The number of write operations performed by the device. @@ -863,6 +865,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 4.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). @@ -870,6 +875,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 4.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 @@ -881,6 +889,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 anoth= er +# request (Since 4.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). @@ -894,6 +905,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 4.1) +# # @invalid_rd_operations: The number of invalid read operations # performed by the device (Since 2.5) # @@ -903,6 +917,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 perfor= med +# by the device (Since 4.1) +# # @account_invalid: Whether invalid operations are included in the # last access statistics (Since 2.5) # @@ -921,18 +938,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': 'i= nt', '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'], '*rd_latency_histogram': 'BlockLatencyHistogramInfo', diff --git a/include/block/accounting.h b/include/block/accounting.h index d1f67b10dd..ba8b04d572 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, }; =20 diff --git a/block/qapi.c b/block/qapi.c index 0c13c86f4e..f9447a3297 100644 --- a/block/qapi.c +++ b/block/qapi.c @@ -434,24 +434,30 @@ static void bdrv_query_blk_stats(BlockDeviceStats *ds= , BlockBackend *blk) =20 ds->rd_bytes =3D stats->nr_bytes[BLOCK_ACCT_READ]; ds->wr_bytes =3D stats->nr_bytes[BLOCK_ACCT_WRITE]; + ds->unmap_bytes =3D stats->nr_bytes[BLOCK_ACCT_UNMAP]; ds->rd_operations =3D stats->nr_ops[BLOCK_ACCT_READ]; ds->wr_operations =3D stats->nr_ops[BLOCK_ACCT_WRITE]; + ds->unmap_operations =3D stats->nr_ops[BLOCK_ACCT_UNMAP]; =20 ds->failed_rd_operations =3D stats->failed_ops[BLOCK_ACCT_READ]; ds->failed_wr_operations =3D stats->failed_ops[BLOCK_ACCT_WRITE]; ds->failed_flush_operations =3D stats->failed_ops[BLOCK_ACCT_FLUSH]; + ds->failed_unmap_operations =3D stats->failed_ops[BLOCK_ACCT_UNMAP]; =20 ds->invalid_rd_operations =3D stats->invalid_ops[BLOCK_ACCT_READ]; ds->invalid_wr_operations =3D stats->invalid_ops[BLOCK_ACCT_WRITE]; ds->invalid_flush_operations =3D stats->invalid_ops[BLOCK_ACCT_FLUSH]; + ds->invalid_unmap_operations =3D stats->invalid_ops[BLOCK_ACCT_UNMAP]; =20 ds->rd_merged =3D stats->merged[BLOCK_ACCT_READ]; ds->wr_merged =3D stats->merged[BLOCK_ACCT_WRITE]; + ds->unmap_merged =3D stats->merged[BLOCK_ACCT_UNMAP]; ds->flush_operations =3D stats->nr_ops[BLOCK_ACCT_FLUSH]; ds->wr_total_time_ns =3D stats->total_time_ns[BLOCK_ACCT_WRITE]; ds->rd_total_time_ns =3D stats->total_time_ns[BLOCK_ACCT_READ]; ds->flush_total_time_ns =3D stats->total_time_ns[BLOCK_ACCT_FLUSH]; + ds->unmap_total_time_ns =3D stats->total_time_ns[BLOCK_ACCT_UNMAP]; =20 ds->has_idle_time_ns =3D stats->last_access_time_ns > 0; if (ds->has_idle_time_ns) { diff --git a/tests/qemu-iotests/227.out b/tests/qemu-iotests/227.out index e77efaf4cf..e9ab4d21f9 100644 --- a/tests/qemu-iotests/227.out +++ b/tests/qemu-iotests/227.out @@ -15,6 +15,8 @@ Testing: -drive driver=3Dnull-co,if=3Dvirtio { "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=3Dnull-co,if=3Dvirtio "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, @@ -74,6 +80,8 @@ Testing: -drive driver=3Dnull-co,if=3Dnone { "device": "none0", "stats": { + "unmap_operations": 0, + "unmap_merged": 0, "flush_total_time_ns": 0, "wr_highest_offset": 0, "wr_total_time_ns": 0, @@ -83,13 +91,17 @@ Testing: -drive driver=3Dnull-co,if=3Dnone "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, @@ -163,6 +175,8 @@ Testing: -blockdev driver=3Dnull-co,node-name=3Dnull -d= evice virtio-blk,drive=3Dnull,i { "device": "", "stats": { + "unmap_operations": 0, + "unmap_merged": 0, "flush_total_time_ns": 0, "wr_highest_offset": 0, "wr_total_time_ns": 0, @@ -172,13 +186,17 @@ Testing: -blockdev driver=3Dnull-co,node-name=3Dnull = -device virtio-blk,drive=3Dnull,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, --=20 2.17.1 From nobody Tue Apr 23 11:10:45 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1557836279; cv=none; d=zoho.com; s=zohoarc; b=gTCtN4ReVaTjz4DUC4b0avvCKEnQaOvdHG/Sq1/8Eg4jVgkb6K2szJHk34UJP0e76kDKkcuiB8req0dF8gXsyOZ6Twn8i5CUa7WoZsoRqLKkqD5MdatQuSajn5NfKBAgihFZOu4TdOEwXLOcOkbtwIRbyI7Qq/BJTXB0F7PTv1I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557836279; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=ZdMZapHQp3Vidfmzw0RIi6/r8xvt8tB0Bl5ST/5EBe0=; b=eNJM545iXVCtIlWbte9cqaCVqvScLIms0zpnqpQXFS8lhcJVZ9bL467sIxjgLVUVSeoRdLjxZRCO5tZ0KUwovPBiBVExmUnM8pQYiQjvrh4j2WjoBmEGKR45jvNawatu3iRrRPyvUK5j3KjG84jnIDDUsCmJrc+R6GN9Y8B6Dos= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 155783627993466.47724585205879; Tue, 14 May 2019 05:17:59 -0700 (PDT) Received: from localhost ([127.0.0.1]:47348 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQWNU-0000LB-UC for importer@patchew.org; Tue, 14 May 2019 08:17:52 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60957) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQWGr-0003Pc-5O for qemu-devel@nongnu.org; Tue, 14 May 2019 08:11:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hQWGp-00024a-N5 for qemu-devel@nongnu.org; Tue, 14 May 2019 08:11:01 -0400 Received: from mail-ve1eur01on072b.outbound.protection.outlook.com ([2a01:111:f400:fe1f::72b]:39198 helo=EUR01-VE1-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 1hQWGk-0001pj-6h; Tue, 14 May 2019 08:10:54 -0400 Received: from VI1PR08MB4078.eurprd08.prod.outlook.com (20.178.127.92) by VI1PR08MB4480.eurprd08.prod.outlook.com (20.179.27.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1900.16; Tue, 14 May 2019 12:10:43 +0000 Received: from VI1PR08MB4078.eurprd08.prod.outlook.com ([fe80::8ce8:ffb4:fe9:4900]) by VI1PR08MB4078.eurprd08.prod.outlook.com ([fe80::8ce8:ffb4:fe9:4900%3]) with mapi id 15.20.1878.024; Tue, 14 May 2019 12:10:43 +0000 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=ZdMZapHQp3Vidfmzw0RIi6/r8xvt8tB0Bl5ST/5EBe0=; b=Yy+j0SHdi8zQV+veQAfzJHSSCpjEnyGQqO1vYSEd0/ljuEub1VJhO67Pb77XI4lmQkUsKuMcbX4pjj1Pakl2N48GBYqS15rCiKA/8M14T1IJGKsHKYZg1m4kDjKfZcUgt6eUOecckUT8y4BVaQ7nvRnUVlDxvSE0TWY9TSJS4M4= From: Anton Nefedov To: "qemu-block@nongnu.org" Thread-Topic: [PATCH v7 3/9] block: add empty account cookie type Thread-Index: AQHVCk4Of4uBzUzUXUyD4Gm3vKa2lA== Date: Tue, 14 May 2019 12:10:43 +0000 Message-ID: <20190514121015.32190-4-anton.nefedov@virtuozzo.com> References: <20190514121015.32190-1-anton.nefedov@virtuozzo.com> In-Reply-To: <20190514121015.32190-1-anton.nefedov@virtuozzo.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR0701CA0057.eurprd07.prod.outlook.com (2603:10a6:3:9e::25) To VI1PR08MB4078.eurprd08.prod.outlook.com (2603:10a6:803:e5::28) authentication-results: spf=none (sender IP is ) smtp.mailfrom=anton.nefedov@virtuozzo.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.17.1 x-originating-ip: [185.231.240.5] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 9f81cc88-8fdc-4695-b39e-08d6d8653064 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600141)(711020)(4605104)(2017052603328)(7193020); SRVR:VI1PR08MB4480; x-ms-traffictypediagnostic: VI1PR08MB4480: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8273; x-forefront-prvs: 0037FD6480 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(346002)(366004)(136003)(396003)(376002)(39850400004)(189003)(199004)(186003)(86362001)(6116002)(486006)(15650500001)(3846002)(66066001)(4326008)(256004)(52116002)(316002)(26005)(44832011)(36756003)(6512007)(6486002)(25786009)(6506007)(14444005)(478600001)(102836004)(6916009)(386003)(2351001)(54906003)(76176011)(64756008)(66446008)(66556008)(5640700003)(7736002)(14454004)(2616005)(2906002)(73956011)(53936002)(476003)(71190400001)(446003)(71200400001)(11346002)(99286004)(107886003)(66946007)(66476007)(2501003)(305945005)(6436002)(8936002)(1076003)(81166006)(81156014)(8676002)(5660300002)(50226002)(68736007); DIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR08MB4480; H:VI1PR08MB4078.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; received-spf: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: +F3JImuiap+XXelbQufBrq8lVik+4i0yTUdqn5PN2S1V8MNDUlggK5xZ20Bo0CxeESeyOz5ooX0K3+NROuAB1juCF1WOLDTyuLho2ejmZQC5H2juqVdYFkGZxHx6z1aoG5kpgwd/j19P6ykxYzyD+oBwkSRQ9IYqcYORfftl1bstqHlcY/URxAY/XEBx+g1A7aEhr29mbQ6I0Lj7pVYvNEQs5FsyDUpp1ZXnx+9VU7saHrxdllSiTEExC7Dy2X+WOWh6UONdEd8wcYY0f3roF9nIs5n88ZmhCHXFAOjjxXTbHXy4HEW//+c4JjSNXR0obSWEDkLcNONZ9z9NiDm6LUCEmHh/kp8vgMauJXeIq80dUzR5TO+pSGTYNxMXAxH4i9Z/7aFeaTaMIw+RSDs7G+sRCHEYeAUbps9MMVuK5v4= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9f81cc88-8fdc-4695-b39e-08d6d8653064 X-MS-Exchange-CrossTenant-originalarrivaltime: 14 May 2019 12:10:43.7918 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB4480 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 2a01:111:f400:fe1f::72b Subject: [Qemu-devel] [PATCH v7 3/9] block: add empty account cookie type 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" , Vladimir Sementsov-Ogievskiy , "berto@igalia.com" , Denis Lunev , "qemu-devel@nongnu.org" , "mreitz@redhat.com" , Anton Nefedov , "pbonzini@redhat.com" , "jsnow@redhat.com" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) This adds some protection from accounting uninitialized cookie. That is, block_acct_failed/done without previous block_acct_start; in that case, cookie probably holds values from previous operation. (Note: it might also be uninitialized holding garbage value and there is still "< BLOCK_MAX_IOTYPE" assertion for that. So block_acct_failed/done without previous block_acct_start should be used with caution.) Currently this is particularly useful in ide code where it's hard to keep track whether the request started accounting or not. For example, trim requests do the accounting separately. Signed-off-by: Anton Nefedov --- include/block/accounting.h | 1 + block/accounting.c | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/include/block/accounting.h b/include/block/accounting.h index ba8b04d572..878b4c3581 100644 --- a/include/block/accounting.h +++ b/include/block/accounting.h @@ -33,6 +33,7 @@ typedef struct BlockAcctTimedStats BlockAcctTimedStats; typedef struct BlockAcctStats BlockAcctStats; =20 enum BlockAcctType { + BLOCK_ACCT_NONE =3D 0, BLOCK_ACCT_READ, BLOCK_ACCT_WRITE, BLOCK_ACCT_FLUSH, diff --git a/block/accounting.c b/block/accounting.c index 70a3d9a426..8d41c8a83a 100644 --- a/block/accounting.c +++ b/block/accounting.c @@ -195,6 +195,10 @@ static void block_account_one_io(BlockAcctStats *stats= , BlockAcctCookie *cookie, =20 assert(cookie->type < BLOCK_MAX_IOTYPE); =20 + if (cookie->type =3D=3D BLOCK_ACCT_NONE) { + return; + } + qemu_mutex_lock(&stats->lock); =20 if (failed) { @@ -217,6 +221,8 @@ static void block_account_one_io(BlockAcctStats *stats,= BlockAcctCookie *cookie, } =20 qemu_mutex_unlock(&stats->lock); + + cookie->type =3D BLOCK_ACCT_NONE; } =20 void block_acct_done(BlockAcctStats *stats, BlockAcctCookie *cookie) --=20 2.17.1 From nobody Tue Apr 23 11:10:45 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1557835988; cv=none; d=zoho.com; s=zohoarc; b=Ir3Rwu/t3gvl6JdqU24xpEapNTH5iNAqKMo9TNN0RVb7XIeaMG5KDBbZWeH1G8dNVIdvPrqd/uccFjsEM87auJnERRdy/hMnznXZet+Evpn8ZY30NT/AjSr7pKOT9JmNFQm9WR8xNT2tIsWAsyXdZ0FziI7RBdh/Rvtz9b+4noM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557835988; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=gt0hMf9ZBXik+jmEEgrHy5mPCOkpE2mno2OKBrXALZI=; b=YhQBounAqrq6rDyl8SIKAKiTlD7McF4ZXnWx7l3A0EBJ4b6i7h37u1QtUvIRT0WYxXuYYEkCqWc5041hh3Bp3t3wgLMB53bqDfctBPeMNk2WQtJzgnBnLVv1ulyr+UO897I9TmoyilvRP/bwesF9j8tZC1g4ASvkn3IPhgg+jh0= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1557835988026802.2933194474867; Tue, 14 May 2019 05:13:08 -0700 (PDT) Received: from localhost ([127.0.0.1]:47271 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQWIq-0004h7-Uo for importer@patchew.org; Tue, 14 May 2019 08:13:04 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60906) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQWGp-0003Lq-46 for qemu-devel@nongnu.org; Tue, 14 May 2019 08:10:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hQWGn-00022i-EW for qemu-devel@nongnu.org; Tue, 14 May 2019 08:10:58 -0400 Received: from mail-eopbgr10138.outbound.protection.outlook.com ([40.107.1.138]:29223 helo=EUR02-HE1-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 1hQWGh-0001va-M3; Tue, 14 May 2019 08:10:52 -0400 Received: from VI1PR08MB4078.eurprd08.prod.outlook.com (20.178.127.92) by VI1PR08MB4573.eurprd08.prod.outlook.com (20.178.126.206) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1900.16; Tue, 14 May 2019 12:10:45 +0000 Received: from VI1PR08MB4078.eurprd08.prod.outlook.com ([fe80::8ce8:ffb4:fe9:4900]) by VI1PR08MB4078.eurprd08.prod.outlook.com ([fe80::8ce8:ffb4:fe9:4900%3]) with mapi id 15.20.1878.024; Tue, 14 May 2019 12:10:45 +0000 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=gt0hMf9ZBXik+jmEEgrHy5mPCOkpE2mno2OKBrXALZI=; b=AUSrP4e2+5epaejg2i6+e5FgrrX1iQx4Wf56KdX/54y2LHdzvODrmJVlEtJyfkR1cxaFHSgWstqTUrSvakHa7klwRVrCYUkMJiK00ZWSeVv46rkyDURn27f4Z8nBEUnVv54WMtz3Z+XnUfHUFWdejijDok+qe3+Ip8FmJcoEqwk= From: Anton Nefedov To: "qemu-block@nongnu.org" Thread-Topic: [PATCH v7 4/9] ide: account UNMAP (TRIM) operations Thread-Index: AQHVCk4OQluzFK8n80WAwbR9XUOfMQ== Date: Tue, 14 May 2019 12:10:44 +0000 Message-ID: <20190514121015.32190-5-anton.nefedov@virtuozzo.com> References: <20190514121015.32190-1-anton.nefedov@virtuozzo.com> In-Reply-To: <20190514121015.32190-1-anton.nefedov@virtuozzo.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR0701CA0057.eurprd07.prod.outlook.com (2603:10a6:3:9e::25) To VI1PR08MB4078.eurprd08.prod.outlook.com (2603:10a6:803:e5::28) authentication-results: spf=none (sender IP is ) smtp.mailfrom=anton.nefedov@virtuozzo.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.17.1 x-originating-ip: [185.231.240.5] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 1c29e3bd-1c47-40c6-28be-08d6d865311d x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600141)(711020)(4605104)(2017052603328)(7193020); SRVR:VI1PR08MB4573; x-ms-traffictypediagnostic: VI1PR08MB4573: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:51; x-forefront-prvs: 0037FD6480 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39850400004)(136003)(376002)(346002)(396003)(366004)(199004)(189003)(386003)(6506007)(102836004)(305945005)(5640700003)(6436002)(66946007)(26005)(316002)(7736002)(6512007)(64756008)(66446008)(66556008)(107886003)(66476007)(73956011)(76176011)(11346002)(446003)(2906002)(6486002)(476003)(2616005)(3846002)(6916009)(25786009)(4326008)(2351001)(186003)(53936002)(6116002)(44832011)(486006)(86362001)(71190400001)(71200400001)(52116002)(50226002)(256004)(66066001)(2501003)(1076003)(5660300002)(68736007)(8676002)(99286004)(14454004)(478600001)(36756003)(8936002)(81156014)(81166006)(54906003); DIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR08MB4573; H:VI1PR08MB4078.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; received-spf: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: Eg8lXzqGvfwXy7S5wFJ/ARKGLHWxshL1WoaEUTXSgIU+7S4NMF9MBr9Z+RkD3Irdi6ws3ZAJ7F10RtSEDX5ZY2QOwWYPpNyJpbMkKroozVDNG7GXKrf8c0FbXQHkKCKSNtGTAMCiMtTvGNFL+0PzUvGN5o6cLfS78b0Z07MLW6eqtQOpIGU8LVq1SmFafuLWsCvBz0ptINtOYzayL9bSQ3e+UYrUeZqk4f6imMaaL4p6ux3Qj2NYIhiQojWAbTmGYzov4Ww3fsk6viIwC/9dCIA8CgKFCm0UCMfDkMltS4Au+7YfHYuUm3xjhndYu210ix8J/Wf11Zb105rT4NO+6nqewWcfphbMyHHMhZ/oINw7QpouNONV0xkL96QxMR3HmXgQPHlkcLei5xRx1sbAjAr1tmI6rsCBl8ASsCLbRQ4= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1c29e3bd-1c47-40c6-28be-08d6d865311d X-MS-Exchange-CrossTenant-originalarrivaltime: 14 May 2019 12:10:44.9356 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB4573 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.1.138 Subject: [Qemu-devel] [PATCH v7 4/9] 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" , Vladimir Sementsov-Ogievskiy , "berto@igalia.com" , Denis Lunev , "qemu-devel@nongnu.org" , "mreitz@redhat.com" , Anton Nefedov , "pbonzini@redhat.com" , "jsnow@redhat.com" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Signed-off-by: Anton Nefedov Reviewed-by: Vladimir Sementsov-Ogievskiy --- hw/ide/core.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/hw/ide/core.c b/hw/ide/core.c index 6afadf894f..3a7ac93777 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -441,6 +441,14 @@ static void ide_issue_trim_cb(void *opaque, int ret) TrimAIOCB *iocb =3D opaque; IDEState *s =3D iocb->s; =20 + if (iocb->i >=3D 0) { + if (ret >=3D 0) { + block_acct_done(blk_get_stats(s->blk), &s->acct); + } else { + block_acct_failed(blk_get_stats(s->blk), &s->acct); + } + } + if (ret >=3D 0) { while (iocb->j < iocb->qiov->niov) { int j =3D iocb->j; @@ -458,10 +466,14 @@ static void ide_issue_trim_cb(void *opaque, int ret) } =20 if (!ide_sect_range_ok(s, sector, count)) { + block_acct_invalid(blk_get_stats(s->blk), BLOCK_ACCT_U= NMAP); iocb->ret =3D -EINVAL; goto done; } =20 + block_acct_start(blk_get_stats(s->blk), &s->acct, + count << BDRV_SECTOR_BITS, BLOCK_ACCT_UNM= AP); + /* Got an entry! Submit and exit. */ iocb->aiocb =3D blk_aio_pdiscard(s->blk, sector << BDRV_SECTOR_BITS, --=20 2.17.1 From nobody Tue Apr 23 11:10:45 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1557836051; cv=none; d=zoho.com; s=zohoarc; b=onfFy/63M7A5ZerwzrRitqWJer4PLdvOg8RfJnNz43k57Ea8XfN/MyGEqiF24gD1guaBA7O3c8FfIYreUEbnvZhwm6hrNKfFVwWRqv0DwFVd71M8sVkoHWl33WZAGgjU5qzCIKbCcirVoPhcftNNHmsG052maAGUIsPGYBiR9AI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557836051; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=8Vuro0sVpR0xlJmaNRlVzc6rhupoWU7IJROEwWQ3Whw=; b=haLilStEbvCP/NhAblwWF/L19aFy/1D79d5Hur3JwRFFN/YBiySTlJ+t0FmpnE1UmW/GzEcelayqQn0IV0NHU5b7XhppdGw0aUZnsldCi0rTL/L8+1yaLRglpZGhlrn+KotSqiWFrueg6kaicGyAloogw05MS9NDd/poFh7YUGk= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1557836051204819.9237104772837; Tue, 14 May 2019 05:14:11 -0700 (PDT) Received: from localhost ([127.0.0.1]:47275 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQWJj-0005Sf-20 for importer@patchew.org; Tue, 14 May 2019 08:13:59 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60874) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQWGn-0003Hi-GI for qemu-devel@nongnu.org; Tue, 14 May 2019 08:10:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hQWGl-00021I-31 for qemu-devel@nongnu.org; Tue, 14 May 2019 08:10:57 -0400 Received: from mail-eopbgr10138.outbound.protection.outlook.com ([40.107.1.138]:29223 helo=EUR02-HE1-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 1hQWGh-0001va-1D; Tue, 14 May 2019 08:10:51 -0400 Received: from VI1PR08MB4078.eurprd08.prod.outlook.com (20.178.127.92) by VI1PR08MB4573.eurprd08.prod.outlook.com (20.178.126.206) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1900.16; Tue, 14 May 2019 12:10:46 +0000 Received: from VI1PR08MB4078.eurprd08.prod.outlook.com ([fe80::8ce8:ffb4:fe9:4900]) by VI1PR08MB4078.eurprd08.prod.outlook.com ([fe80::8ce8:ffb4:fe9:4900%3]) with mapi id 15.20.1878.024; Tue, 14 May 2019 12:10:46 +0000 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=8Vuro0sVpR0xlJmaNRlVzc6rhupoWU7IJROEwWQ3Whw=; b=T/DAOnFazV5NCDkRuLmRQneQGFhadI2tuyveLTkBSHuGLlLOye28kXS+6RP1cTx4Z7V4U5PXg4pzKw7PbilDsJwOOpyaYWkqIc1LdIGrq1q70KRu/bslEZZAQs1CiZX7FFUA7NgNumTBwSpdsVO4TooXH6KD0iQ1+xKhT3hGJOY= From: Anton Nefedov To: "qemu-block@nongnu.org" Thread-Topic: [PATCH v7 5/9] scsi: store unmap offset and nb_sectors in request struct Thread-Index: AQHVCk4PBXRkD3MHw0CKqzQxcpy1IA== Date: Tue, 14 May 2019 12:10:46 +0000 Message-ID: <20190514121015.32190-6-anton.nefedov@virtuozzo.com> References: <20190514121015.32190-1-anton.nefedov@virtuozzo.com> In-Reply-To: <20190514121015.32190-1-anton.nefedov@virtuozzo.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR0701CA0057.eurprd07.prod.outlook.com (2603:10a6:3:9e::25) To VI1PR08MB4078.eurprd08.prod.outlook.com (2603:10a6:803:e5::28) authentication-results: spf=none (sender IP is ) smtp.mailfrom=anton.nefedov@virtuozzo.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.17.1 x-originating-ip: [185.231.240.5] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 5f137c87-cc61-4028-66a0-08d6d86531c9 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600141)(711020)(4605104)(2017052603328)(7193020); SRVR:VI1PR08MB4573; x-ms-traffictypediagnostic: VI1PR08MB4573: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:224; x-forefront-prvs: 0037FD6480 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39850400004)(136003)(376002)(346002)(396003)(366004)(199004)(189003)(386003)(6506007)(102836004)(305945005)(5640700003)(6436002)(66946007)(26005)(316002)(7736002)(6512007)(64756008)(66446008)(66556008)(107886003)(66476007)(73956011)(76176011)(11346002)(446003)(2906002)(6486002)(476003)(2616005)(3846002)(6916009)(25786009)(4326008)(2351001)(186003)(53936002)(6116002)(44832011)(486006)(86362001)(71190400001)(71200400001)(52116002)(50226002)(256004)(66066001)(2501003)(1076003)(5660300002)(68736007)(8676002)(99286004)(14454004)(478600001)(36756003)(8936002)(81156014)(81166006)(54906003); DIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR08MB4573; H:VI1PR08MB4078.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; received-spf: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: lE1RdAmIzg8rAR9+r9WryU2oqWiPLR+9PixaTv4InZMS9ajgxxUeWpUtuXjFOD2BzMR7EHpytevJOVSoY9mCtouxI/bN7F3tSkuEgdaikymIC+2zAbgTdxVnfM6GV4XNLw7AWtzmlcYRv63MTnRt/INeroFO3hFVmNeIF8luBUPcPzFPsHQUhSHF3yesod83BRqKRtjcIGSM9pzsT0KPONv1yRDoUqVjv4qobtLeoOf6EAfamgdb1gQ/JBI2zi9NKh6TbDiJXvMAroLpIbSkaYH5mmq7tjNivtn2Kgh4UYqv2tYMF7s3cQ6go1yY3zxpFzwR5KgUSQPU+rYDvohYxEevcc2htmuOETB2nHcv6+qyUdZy3QyH+RtcwUBTog04CWKAORfO2SM9c+B+iVk372sYoIYd5bsbz1QV3BGmiqU= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5f137c87-cc61-4028-66a0-08d6d86531c9 X-MS-Exchange-CrossTenant-originalarrivaltime: 14 May 2019 12:10:46.0814 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB4573 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.1.138 Subject: [Qemu-devel] [PATCH v7 5/9] 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" , Vladimir Sementsov-Ogievskiy , "berto@igalia.com" , Denis Lunev , "qemu-devel@nongnu.org" , "mreitz@redhat.com" , Anton Nefedov , "pbonzini@redhat.com" , "jsnow@redhat.com" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) 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 e7e865ab3b..b43254103c 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -1602,8 +1602,6 @@ static void scsi_unmap_complete_noio(UnmapCBData *dat= a, int ret) { SCSIDiskReq *r =3D data->r; SCSIDiskState *s =3D DO_UPCAST(SCSIDiskState, qdev, r->req.dev); - uint64_t sector_num; - uint32_t nb_sectors; =20 assert(r->req.aiocb =3D=3D NULL); if (scsi_disk_req_check_error(r, ret, false)) { @@ -1611,16 +1609,16 @@ static void scsi_unmap_complete_noio(UnmapCBData *d= ata, int ret) } =20 if (data->count > 0) { - sector_num =3D ldq_be_p(&data->inbuf[0]); - nb_sectors =3D ldl_be_p(&data->inbuf[8]) & 0xffffffffULL; - if (!check_lba_range(s, sector_num, nb_sectors)) { + r->sector =3D ldq_be_p(&data->inbuf[0]); + r->sector_count =3D 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; } =20 r->req.aiocb =3D 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.blocksiz= e, scsi_unmap_complete, data); data->count--; data->inbuf +=3D 16; --=20 2.17.1 From nobody Tue Apr 23 11:10:45 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1557836285; cv=none; d=zoho.com; s=zohoarc; b=V9XNr7n/OhaUe7CpnPHitK3rSjjS9l5mqtqW4S3Lboa6t8SqEBTmlioUKnZypZIXpY36EBQy3pS01X1G+CbAA8L9pcq589ofh+J4xbmYjoLLXCkv6ksMuV3gflIRnszqHtb4ToSOJSzXHj5Z1JlHnqQGjLHo2O3lzwG2hP6wbNo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557836285; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=Pzck4rLP/X0t3KVWctGsX2zK+4JgrCX/03+50mc/gCU=; b=PFXqPQNlGpmPx9BCrhpG83Mm9RhtcBwBi0NxXNcMuVR0JvXvUEf0WjSqmpvAtyj91rDHaE6GUF+1QHulf4avReTsNuNA/gvRYivrNzC9jT9iWxsj8XwcgDIqU7/bRAVGE/gTsj8z86qAIrc9svs6I+pj4eVCxMrdXi4V1p7huJU= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1557836285749148.68504311414506; Tue, 14 May 2019 05:18:05 -0700 (PDT) Received: from localhost ([127.0.0.1]:47350 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQWNd-0000SG-OK for importer@patchew.org; Tue, 14 May 2019 08:18:01 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60997) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQWGu-0003TD-2a for qemu-devel@nongnu.org; Tue, 14 May 2019 08:11:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hQWGr-00026u-3B for qemu-devel@nongnu.org; Tue, 14 May 2019 08:11:02 -0400 Received: from mail-eopbgr10128.outbound.protection.outlook.com ([40.107.1.128]:12999 helo=EUR02-HE1-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 1hQWGl-00020g-CV; Tue, 14 May 2019 08:10:56 -0400 Received: from VI1PR08MB4078.eurprd08.prod.outlook.com (20.178.127.92) by VI1PR08MB4573.eurprd08.prod.outlook.com (20.178.126.206) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1900.16; Tue, 14 May 2019 12:10:47 +0000 Received: from VI1PR08MB4078.eurprd08.prod.outlook.com ([fe80::8ce8:ffb4:fe9:4900]) by VI1PR08MB4078.eurprd08.prod.outlook.com ([fe80::8ce8:ffb4:fe9:4900%3]) with mapi id 15.20.1878.024; Tue, 14 May 2019 12:10:47 +0000 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=Pzck4rLP/X0t3KVWctGsX2zK+4JgrCX/03+50mc/gCU=; b=XniCoD4yZ06WEvR14eXwFvFzsGw5/T6WZZyXLiiJjvOum3dnwei7sWMjzD0xv1sWXZ/9V6aVRnkhDQ2YmjCrqYUGGLWK4zGN+vrHIBIfPghPpuP+EP30DnXJWfmSmTmoyhcqhZdqBvWWx3TrrrBd46/HpAzAQOHUdAD6wMSitTc= From: Anton Nefedov To: "qemu-block@nongnu.org" Thread-Topic: [PATCH v7 6/9] scsi: move unmap error checking to the complete callback Thread-Index: AQHVCk4Q89Y0ADlSmECDOCwW3DOS2A== Date: Tue, 14 May 2019 12:10:47 +0000 Message-ID: <20190514121015.32190-7-anton.nefedov@virtuozzo.com> References: <20190514121015.32190-1-anton.nefedov@virtuozzo.com> In-Reply-To: <20190514121015.32190-1-anton.nefedov@virtuozzo.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR0701CA0057.eurprd07.prod.outlook.com (2603:10a6:3:9e::25) To VI1PR08MB4078.eurprd08.prod.outlook.com (2603:10a6:803:e5::28) authentication-results: spf=none (sender IP is ) smtp.mailfrom=anton.nefedov@virtuozzo.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.17.1 x-originating-ip: [185.231.240.5] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 7647bbc3-256f-4dbe-ef18-08d6d8653277 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600141)(711020)(4605104)(2017052603328)(7193020); SRVR:VI1PR08MB4573; x-ms-traffictypediagnostic: VI1PR08MB4573: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:130; x-forefront-prvs: 0037FD6480 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39850400004)(136003)(376002)(346002)(396003)(366004)(199004)(189003)(386003)(6506007)(102836004)(305945005)(5640700003)(6436002)(66946007)(26005)(316002)(7736002)(6512007)(64756008)(66446008)(66556008)(107886003)(66476007)(73956011)(76176011)(11346002)(446003)(2906002)(6486002)(476003)(2616005)(3846002)(6916009)(25786009)(4326008)(2351001)(186003)(53936002)(6116002)(44832011)(486006)(86362001)(71190400001)(71200400001)(52116002)(50226002)(256004)(14444005)(66066001)(2501003)(1076003)(5660300002)(68736007)(8676002)(99286004)(14454004)(478600001)(36756003)(8936002)(81156014)(81166006)(54906003); DIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR08MB4573; H:VI1PR08MB4078.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; received-spf: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: oFlNo9fbPAFnLvuqFwcqSk5V53R9AQS6HfjZfdVQnHrnAWUHZeC4rCd/YIrutsCO7fvd4LR5s5b/vZo7DWBHSXi0Uo3V/p7FJh+VOhPNK394WZJ5VYnm6KgSLRzu7QD9aSgb9l4mmspyUu0lk8RHA4REIL2/bDU/UnRtOh6gvFXUGBEx4gg1NOUl+ABWq3HW2WCQILKX4fQxxm9hw9ZwSQQ64L31W/Eh518N6Ezoxnqp1RulBHpCMLzw2k9kuoAaOGu5ysW+2wioTbFsbalthgUK5rWM6zO0SG/6+vykfyz4EUiCH8nophficwS0Uns761VPa0070ap/Z9yzzm400QE/yAKJdNIEGr9erqVvbRzoGRyFwxMTsmz1WeN5GM35p/XE6lA0MESaFkR6/TEO2dICDYNcZK/IcNtS3/cYRQU= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7647bbc3-256f-4dbe-ef18-08d6d8653277 X-MS-Exchange-CrossTenant-originalarrivaltime: 14 May 2019 12:10:47.2603 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB4573 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.1.128 Subject: [Qemu-devel] [PATCH v7 6/9] 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" , Vladimir Sementsov-Ogievskiy , "berto@igalia.com" , Denis Lunev , "qemu-devel@nongnu.org" , "mreitz@redhat.com" , Anton Nefedov , "pbonzini@redhat.com" , "jsnow@redhat.com" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) 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 b43254103c..6eff496b54 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -1604,9 +1604,6 @@ static void scsi_unmap_complete_noio(UnmapCBData *dat= a, int ret) SCSIDiskState *s =3D DO_UPCAST(SCSIDiskState, qdev, r->req.dev); =20 assert(r->req.aiocb =3D=3D NULL); - if (scsi_disk_req_check_error(r, ret, false)) { - goto done; - } =20 if (data->count > 0) { r->sector =3D ldq_be_p(&data->inbuf[0]); @@ -1642,7 +1639,12 @@ static void scsi_unmap_complete(void *opaque, int re= t) r->req.aiocb =3D NULL; =20 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)); } =20 --=20 2.17.1 From nobody Tue Apr 23 11:10:45 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1557836446; cv=none; d=zoho.com; s=zohoarc; b=XPoNQojhQoSwV62BgQ/ETRJpi1Dk37EB6zx9E6GHQ2iakKS0SIBTz+KYRONYSWHG+zBg+gOp7epIvVjDMzuMgs9s0HkSv3v66c1Hfd7hIXHDB3E4yTFdgt3XmQYag5oAks6xTfWwXC+hTcwB67WKGV1xjk1QEw4FjibtP7+mmIQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557836446; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=ixGQ0ZT3JiaGoKxFRNxEP+ryXJN0//iy+zU6kNk4OTk=; b=VlFqCXLefksRXGeqnF09xwRekyIERVJm+NQQKEQIr1qDJtGIEHDgE2J7sITCL3r0xzhffNf4ycx2Zz9ibcK7YP+Mzu9WSUWUBIS3aqsSL44YNudEm5lqhcVBczp/qUSjkDtrScLpD4z3p9BoGtWw66giGg41i2l94WuZAC00ulc= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1557836446971275.7045705948342; Tue, 14 May 2019 05:20:46 -0700 (PDT) Received: from localhost ([127.0.0.1]:47383 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQWQF-0002Il-TA for importer@patchew.org; Tue, 14 May 2019 08:20:43 -0400 Received: from eggs.gnu.org ([209.51.188.92]:32816) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQWGx-0003Wj-5f for qemu-devel@nongnu.org; Tue, 14 May 2019 08:11:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hQWGu-00029c-1d for qemu-devel@nongnu.org; Tue, 14 May 2019 08:11:05 -0400 Received: from mail-eopbgr10128.outbound.protection.outlook.com ([40.107.1.128]:12999 helo=EUR02-HE1-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 1hQWGo-00020g-ST; Tue, 14 May 2019 08:10:59 -0400 Received: from VI1PR08MB4078.eurprd08.prod.outlook.com (20.178.127.92) by VI1PR08MB4573.eurprd08.prod.outlook.com (20.178.126.206) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1900.16; Tue, 14 May 2019 12:10:48 +0000 Received: from VI1PR08MB4078.eurprd08.prod.outlook.com ([fe80::8ce8:ffb4:fe9:4900]) by VI1PR08MB4078.eurprd08.prod.outlook.com ([fe80::8ce8:ffb4:fe9:4900%3]) with mapi id 15.20.1878.024; Tue, 14 May 2019 12:10:48 +0000 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=ixGQ0ZT3JiaGoKxFRNxEP+ryXJN0//iy+zU6kNk4OTk=; b=LUbazGVZ/FB4gdgTfifo46WNHO8sYIrdRR1QQH4G0KgiC/yiiLmYR7nvwL1Ps3kh/Rhe8AfwHljwM2ltJ2wLu7580c0mhBDgi56xz6kIs6PmqVC2Tfca1tJiSWaehYgjJYNz7h0cdOS4nthLGpk0uSDx2rZpMLX/ZTIJ/3i9zdQ= From: Anton Nefedov To: "qemu-block@nongnu.org" Thread-Topic: [PATCH v7 7/9] scsi: account unmap operations Thread-Index: AQHVCk4Q8nj0UfWiUE6OdglBhWEhaQ== Date: Tue, 14 May 2019 12:10:48 +0000 Message-ID: <20190514121015.32190-8-anton.nefedov@virtuozzo.com> References: <20190514121015.32190-1-anton.nefedov@virtuozzo.com> In-Reply-To: <20190514121015.32190-1-anton.nefedov@virtuozzo.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR0701CA0057.eurprd07.prod.outlook.com (2603:10a6:3:9e::25) To VI1PR08MB4078.eurprd08.prod.outlook.com (2603:10a6:803:e5::28) authentication-results: spf=none (sender IP is ) smtp.mailfrom=anton.nefedov@virtuozzo.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.17.1 x-originating-ip: [185.231.240.5] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 1520ac6f-a204-4b3c-a86e-08d6d865332b x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600141)(711020)(4605104)(2017052603328)(7193020); SRVR:VI1PR08MB4573; x-ms-traffictypediagnostic: VI1PR08MB4573: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:40; x-forefront-prvs: 0037FD6480 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39850400004)(136003)(376002)(346002)(396003)(366004)(199004)(189003)(386003)(6506007)(102836004)(305945005)(5640700003)(6436002)(66946007)(26005)(316002)(7736002)(6512007)(64756008)(66446008)(66556008)(107886003)(66476007)(73956011)(76176011)(11346002)(446003)(2906002)(6486002)(476003)(2616005)(3846002)(6916009)(25786009)(4326008)(2351001)(186003)(53936002)(6116002)(44832011)(486006)(86362001)(71190400001)(71200400001)(52116002)(50226002)(256004)(14444005)(66066001)(2501003)(1076003)(5660300002)(68736007)(8676002)(99286004)(14454004)(478600001)(36756003)(8936002)(81156014)(81166006)(54906003); DIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR08MB4573; H:VI1PR08MB4078.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; received-spf: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: TkqkSXad+ywWq7Uloy7HlPusuwWGKf/+FjOF5e3EReZfs00G7dL7RdgZZQnMG0htxecDexkfnmiATaxiqa3N/Uk88XL/h0it2uMUxbDLK1w3TQ9jCY0ck758aT67LUgOWDkiagGcWz7REDGYkTWF6vudGvgfgbkC7UvZDUb1S1Vvto/v77Xem9CxDf1L7tm7vMK74pKBOUgAKHThvtP6ZKmL6HpIi3tcJZvBDsLibx6+wd9GkqGDj4XShfNNm1Hy/bUsbjd3jO6UGtBRFpGY8UFQPJcd9dqcCe/5PuLtAyDz2l4PS1zCG2Bj3gT0RaMwlPWqgqJ8C1XePsZ2z1V4CFpsLLJ58NWgDxA04qqzkeWmY+OdsCtnJLD8XbsBhrpgPS97OV0ydZ8qjABL0mbYcuFsvnQookWswq+E6iWrhYA= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1520ac6f-a204-4b3c-a86e-08d6d865332b X-MS-Exchange-CrossTenant-originalarrivaltime: 14 May 2019 12:10:48.3771 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB4573 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.1.128 Subject: [Qemu-devel] [PATCH v7 7/9] 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" , Vladimir Sementsov-Ogievskiy , "berto@igalia.com" , Denis Lunev , "qemu-devel@nongnu.org" , "mreitz@redhat.com" , Anton Nefedov , "pbonzini@redhat.com" , "jsnow@redhat.com" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Signed-off-by: Anton Nefedov Reviewed-by: Vladimir Sementsov-Ogievskiy --- hw/scsi/scsi-disk.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c index 6eff496b54..5c77981d60 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -1609,10 +1609,16 @@ static void scsi_unmap_complete_noio(UnmapCBData *d= ata, int ret) r->sector =3D ldq_be_p(&data->inbuf[0]); r->sector_count =3D ldl_be_p(&data->inbuf[8]) & 0xffffffffULL; if (!check_lba_range(s, r->sector, r->sector_count)) { + block_acct_invalid(blk_get_stats(s->qdev.conf.blk), + BLOCK_ACCT_UNMAP); scsi_check_condition(r, SENSE_CODE(LBA_OUT_OF_RANGE)); goto done; } =20 + block_acct_start(blk_get_stats(s->qdev.conf.blk), &r->acct, + r->sector_count * s->qdev.blocksize, + BLOCK_ACCT_UNMAP); + r->req.aiocb =3D blk_aio_pdiscard(s->qdev.conf.blk, r->sector * s->qdev.blocksize, r->sector_count * s->qdev.blocksiz= e, @@ -1639,10 +1645,11 @@ static void scsi_unmap_complete(void *opaque, int r= et) r->req.aiocb =3D NULL; =20 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)); @@ -1674,6 +1681,7 @@ static void scsi_disk_emulate_unmap(SCSIDiskReq *r, u= int8_t *inbuf) } =20 if (blk_is_read_only(s->qdev.conf.blk)) { + block_acct_invalid(blk_get_stats(s->qdev.conf.blk), BLOCK_ACCT_UNM= AP); scsi_check_condition(r, SENSE_CODE(WRITE_PROTECTED)); return; } @@ -1689,10 +1697,12 @@ static void scsi_disk_emulate_unmap(SCSIDiskReq *r,= uint8_t *inbuf) return; =20 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; =20 invalid_field: + block_acct_invalid(blk_get_stats(s->qdev.conf.blk), BLOCK_ACCT_UNMAP); scsi_check_condition(r, SENSE_CODE(INVALID_FIELD)); } =20 --=20 2.17.1 From nobody Tue Apr 23 11:10:45 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1557836539; cv=none; d=zoho.com; s=zohoarc; b=iZeB3JgoyVYli1z6WfWYThrnwOA9Xvq0ng4BM+r1txkCTLpTfHGjkPXM2q6sRDPigJBIJ/l7GEzCny4Z0Vaipz7TrQNfbBjpjA8dIY2wPgxDBis5EyMUknqQEaXmsjrX21YMxSXDO0HZCj8nHL2XlLoED/Z7mEj71zhLOhnstWQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557836539; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=lYLyh+9bxLXOkoak9kC6UGRcqlEZ9Oc04EES8GyG2Aw=; b=S6P+EZB0QSn91wt0+jtrmFGPkzBr8VyD51iXNWam/85K67zQdqRvoCMXh//1MT0n2THO+oSYAq2FnioiOHDFBZDpdGHo9xIgeqfxGWX28Gmvq4q1j9tCOuZfrDXOl6M1Rl9DdyBvQzT/wIma/GOLrFff6WKpVLbrzMXQBusmb58= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1557836539352754.3748062347903; Tue, 14 May 2019 05:22:19 -0700 (PDT) Received: from localhost ([127.0.0.1]:47445 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQWRj-0003gS-53 for importer@patchew.org; Tue, 14 May 2019 08:22:15 -0400 Received: from eggs.gnu.org ([209.51.188.92]:32840) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQWGy-0003YP-Qi for qemu-devel@nongnu.org; Tue, 14 May 2019 08:11:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hQWGw-0002C8-Hz for qemu-devel@nongnu.org; Tue, 14 May 2019 08:11:08 -0400 Received: from mail-eopbgr10128.outbound.protection.outlook.com ([40.107.1.128]:12999 helo=EUR02-HE1-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 1hQWGq-00020g-Po; Tue, 14 May 2019 08:11:01 -0400 Received: from VI1PR08MB4078.eurprd08.prod.outlook.com (20.178.127.92) by VI1PR08MB4573.eurprd08.prod.outlook.com (20.178.126.206) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1900.16; Tue, 14 May 2019 12:10:49 +0000 Received: from VI1PR08MB4078.eurprd08.prod.outlook.com ([fe80::8ce8:ffb4:fe9:4900]) by VI1PR08MB4078.eurprd08.prod.outlook.com ([fe80::8ce8:ffb4:fe9:4900%3]) with mapi id 15.20.1878.024; Tue, 14 May 2019 12:10:49 +0000 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=lYLyh+9bxLXOkoak9kC6UGRcqlEZ9Oc04EES8GyG2Aw=; b=EZLnJ4oBQaIasSMZMqKIOMnxvSWZJWXnZCHBmWsMvpCuP96ZE8dLJhKkLmF4Rq8RSweYhJGe91UTGt5lCpC1Wc8f1uORt8E9nolsVJ0FUZ8h9KaRtocp2JeVvnPOf/2u0iyKMANp0Y7ruIGXYbmoEUhCO9/qU/Wq86JzoiohqWw= From: Anton Nefedov To: "qemu-block@nongnu.org" Thread-Topic: [PATCH v7 8/9] file-posix: account discard operations Thread-Index: AQHVCk4RAFKe40evC0O/XAe8I3+ubQ== Date: Tue, 14 May 2019 12:10:49 +0000 Message-ID: <20190514121015.32190-9-anton.nefedov@virtuozzo.com> References: <20190514121015.32190-1-anton.nefedov@virtuozzo.com> In-Reply-To: <20190514121015.32190-1-anton.nefedov@virtuozzo.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR0701CA0057.eurprd07.prod.outlook.com (2603:10a6:3:9e::25) To VI1PR08MB4078.eurprd08.prod.outlook.com (2603:10a6:803:e5::28) authentication-results: spf=none (sender IP is ) smtp.mailfrom=anton.nefedov@virtuozzo.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.17.1 x-originating-ip: [185.231.240.5] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 7fa40454-adb8-4570-22da-08d6d86533d7 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600141)(711020)(4605104)(2017052603328)(7193020); SRVR:VI1PR08MB4573; x-ms-traffictypediagnostic: VI1PR08MB4573: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:873; x-forefront-prvs: 0037FD6480 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39850400004)(136003)(376002)(346002)(396003)(366004)(199004)(189003)(386003)(6506007)(102836004)(305945005)(5640700003)(6436002)(66946007)(26005)(316002)(7736002)(6512007)(64756008)(66446008)(66556008)(107886003)(66476007)(73956011)(76176011)(11346002)(446003)(2906002)(6486002)(476003)(2616005)(3846002)(6916009)(25786009)(4326008)(2351001)(186003)(53936002)(6116002)(44832011)(486006)(86362001)(71190400001)(71200400001)(52116002)(50226002)(256004)(14444005)(66066001)(2501003)(1076003)(5660300002)(15650500001)(68736007)(8676002)(99286004)(14454004)(478600001)(36756003)(8936002)(81156014)(81166006)(54906003); DIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR08MB4573; H:VI1PR08MB4078.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; received-spf: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: VbwZ32X7XDw+sDBOobjBho2CTTV6kfdFUp1CpWqNveb7iiUuHuFi3NHsfGUjyHhowtAi0nzy9ORGQ8Nm15OqxrtFs5cfgMRrk0jqo+5ZdG049m8nm1Kk0JYgS664tt6WxNf/fQ/0Sjby6QUBHTOIstllUgrlerobx1fAAeWs25YACUzEFzOdmt/DgPhY3Qr5GSGT1Q5+iSPAcE4cyvR6CysmB/S9WeLl+kdd0/OzIV3sjHOw/WAg2/GpZf3GbB9soF/9qIkc6iSxtWPjjULJoArD5G6rwERKD2OT2fIRpJGymFUkxHYXlKu4gRvyGa8pu53mJVj4CLUFynVQGA+HdqKLzyweS335wPJQd6nbffCqiGAVAHuStDk9uO/4yrOXBFW5KoPHCjCmn6mk0+UgHd/oEVON8iFS9h5tqhMVNHU= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7fa40454-adb8-4570-22da-08d6d86533d7 X-MS-Exchange-CrossTenant-originalarrivaltime: 14 May 2019 12:10:49.5239 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB4573 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.1.128 Subject: [Qemu-devel] [PATCH v7 8/9] 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" , Vladimir Sementsov-Ogievskiy , "berto@igalia.com" , Denis Lunev , "qemu-devel@nongnu.org" , "mreitz@redhat.com" , Anton Nefedov , "pbonzini@redhat.com" , "jsnow@redhat.com" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) 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 | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/block/file-posix.c b/block/file-posix.c index 1cf4ee49eb..76d54b3a85 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -159,6 +159,11 @@ typedef struct BDRVRawState { bool needs_alignment; bool drop_cache; bool check_cache_dropped; + struct { + int64_t discard_nb_ok; + int64_t discard_nb_failed; + int64_t discard_bytes_ok; + } stats; =20 PRManager *pr_mgr; } BDRVRawState; @@ -2630,11 +2635,22 @@ static void coroutine_fn raw_co_invalidate_cache(Bl= ockDriverState *bs, #endif /* !__linux__ */ } =20 +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 +=3D nbytes; + } +} + static coroutine_fn int raw_do_pdiscard(BlockDriverState *bs, int64_t offset, int bytes, bool blkd= ev) { BDRVRawState *s =3D bs->opaque; RawPosixAIOData acb; + int ret; =20 acb =3D (RawPosixAIOData) { .bs =3D bs, @@ -2648,7 +2664,9 @@ raw_do_pdiscard(BlockDriverState *bs, int64_t offset,= int bytes, bool blkdev) acb.aio_type |=3D QEMU_AIO_BLKDEV; } =20 - return raw_thread_pool_submit(bs, handle_aiocb_discard, &acb); + ret =3D raw_thread_pool_submit(bs, handle_aiocb_discard, &acb); + raw_account_discard(s, bytes, ret); + return ret; } =20 static coroutine_fn int @@ -3263,10 +3281,12 @@ static int fd_open(BlockDriverState *bs) static coroutine_fn int hdev_co_pdiscard(BlockDriverState *bs, int64_t offset, int bytes) { + BDRVRawState *s =3D bs->opaque; int ret; =20 ret =3D fd_open(bs); if (ret < 0) { + raw_account_discard(s, bytes, ret); return ret; } return raw_do_pdiscard(bs, offset, bytes, true); --=20 2.17.1 From nobody Tue Apr 23 11:10:45 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1557836186; cv=none; d=zoho.com; s=zohoarc; b=OX04y9wAX7D2kR8kH0PynUrk4dBvyug0n52hmKYY3JW5pmofSSGI5IHkh6xwDmIVjehtF5i8cPDHNV5VGhP0vR161yLHUONR402bKIEJuZtgIxVVXjZF14niJHSLGGF285ZjMwDZ8Oe8Te3ET3ba6a5a+E7AL31HjSUrf048S3I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557836186; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=K4YYf3PuR34VNjFvC7sGzLzq8045B+QePLtmcbZ/Udo=; b=PyZMRYuw6ahA5FC8jT1qM1N5uO8xQHzO0SFeOoOGmNPxykqo6bXUIFCJGcLimlZasf70lBy97pvhpd6mpimmiEfChdQR155+ZLwsMW00RCRJT1yS84UoEG09MBxhsiQQ1rO9wELKgRYD8WePPriT/D7otSxA4N8h1t9R5ztcE88= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1557836186992482.9177480155013; Tue, 14 May 2019 05:16:26 -0700 (PDT) Received: from localhost ([127.0.0.1]:47329 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQWM2-0007Z7-Pz for importer@patchew.org; Tue, 14 May 2019 08:16:22 -0400 Received: from eggs.gnu.org ([209.51.188.92]:32886) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQWH3-0003cw-C3 for qemu-devel@nongnu.org; Tue, 14 May 2019 08:11:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hQWH2-0002Gt-1L for qemu-devel@nongnu.org; Tue, 14 May 2019 08:11:13 -0400 Received: from mail-eopbgr10128.outbound.protection.outlook.com ([40.107.1.128]:12999 helo=EUR02-HE1-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 1hQWGu-00020g-9R; Tue, 14 May 2019 08:11:05 -0400 Received: from VI1PR08MB4078.eurprd08.prod.outlook.com (20.178.127.92) by VI1PR08MB4573.eurprd08.prod.outlook.com (20.178.126.206) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1900.16; Tue, 14 May 2019 12:10:50 +0000 Received: from VI1PR08MB4078.eurprd08.prod.outlook.com ([fe80::8ce8:ffb4:fe9:4900]) by VI1PR08MB4078.eurprd08.prod.outlook.com ([fe80::8ce8:ffb4:fe9:4900%3]) with mapi id 15.20.1878.024; Tue, 14 May 2019 12:10:50 +0000 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=K4YYf3PuR34VNjFvC7sGzLzq8045B+QePLtmcbZ/Udo=; b=XkQA9k9OUJ5Lfjmpoe7qJsd+5yqYubH9PGmGh24d/ISYoADXfhKJHf6O0OXgYM95AMsQsGuG9oamlgsM5zpyin1A1l6g0ilp5iIGQRlZP/sUFifVb2Mbb50r0QNoarGa0IPfwn/jA76+GS0LLUU6kynPeawcHBjO1Av9gkIv6i8= From: Anton Nefedov To: "qemu-block@nongnu.org" Thread-Topic: [PATCH v7 9/9] qapi: query-blockstat: add driver specific file-posix stats Thread-Index: AQHVCk4SN315YgoU806PWwRT21zAmg== Date: Tue, 14 May 2019 12:10:50 +0000 Message-ID: <20190514121015.32190-10-anton.nefedov@virtuozzo.com> References: <20190514121015.32190-1-anton.nefedov@virtuozzo.com> In-Reply-To: <20190514121015.32190-1-anton.nefedov@virtuozzo.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR0701CA0057.eurprd07.prod.outlook.com (2603:10a6:3:9e::25) To VI1PR08MB4078.eurprd08.prod.outlook.com (2603:10a6:803:e5::28) authentication-results: spf=none (sender IP is ) smtp.mailfrom=anton.nefedov@virtuozzo.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.17.1 x-originating-ip: [185.231.240.5] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 2fbdb9a2-8cd8-48cf-95a3-08d6d8653486 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600141)(711020)(4605104)(2017052603328)(7193020); SRVR:VI1PR08MB4573; x-ms-traffictypediagnostic: VI1PR08MB4573: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:390; x-forefront-prvs: 0037FD6480 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39850400004)(136003)(376002)(346002)(396003)(366004)(199004)(189003)(386003)(6506007)(102836004)(305945005)(5640700003)(6436002)(66946007)(26005)(316002)(7736002)(6512007)(64756008)(66446008)(66556008)(107886003)(66476007)(73956011)(76176011)(11346002)(446003)(2906002)(6486002)(476003)(2616005)(3846002)(6916009)(25786009)(4326008)(2351001)(186003)(53936002)(6116002)(44832011)(486006)(86362001)(71190400001)(71200400001)(52116002)(50226002)(256004)(14444005)(66066001)(2501003)(1076003)(5660300002)(68736007)(8676002)(99286004)(14454004)(478600001)(36756003)(8936002)(81156014)(81166006)(54906003); DIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR08MB4573; H:VI1PR08MB4078.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; received-spf: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: JPXLvDrY8qgel2GrYy7mZdqxrVWC8NkonhTNwB3LDGxqylTY4QIHZI5wxJB33wWrik3G1wwg3toW7GTyKWN0LBL/+kLvDp2rKxM+nZIhR7y4uqchb+bTnLULkhjb+9nX6rYUe1HFxF/fFI/VkQjEH5Zh5pelnykSSpxW15KavAvp/MmkTjOEHx2GGBagLXUAKF+Uxff5NZu2yuIft10Ra+vDQviJFkIpqP8+BqtI3m23efrdcWI85aL5FZvlOGNj5JyBYXeG3zKCpJ7xT5l2r/E08CK7wdKcyM+GJwB6JYVqBElYEYqUknOpHE0+ST6UMzb+Bw6x2ul0UEckqYfdrCqfF1H1MgIAQMWq16m+GuBKDLs3jRoYb5Vbr+Je91pLURRVbiRKJPs233ADk2U/IOk8Ik9aT9SI49q4nj+ab6s= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2fbdb9a2-8cd8-48cf-95a3-08d6d8653486 X-MS-Exchange-CrossTenant-originalarrivaltime: 14 May 2019 12:10:50.6337 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB4573 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.1.128 Subject: [Qemu-devel] [PATCH v7 9/9] 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" , Vladimir Sementsov-Ogievskiy , "berto@igalia.com" , Denis Lunev , "qemu-devel@nongnu.org" , "mreitz@redhat.com" , Anton Nefedov , "pbonzini@redhat.com" , "jsnow@redhat.com" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) A block driver can provide a callback to report driver-specific statistics. file-posix driver now reports discard statistics Signed-off-by: Anton Nefedov Reviewed-by: Vladimir Sementsov-Ogievskiy Acked-by: Markus Armbruster --- qapi/block-core.json | 38 ++++++++++++++++++++++++++++++++++++++ include/block/block.h | 1 + include/block/block_int.h | 1 + block.c | 9 +++++++++ block/file-posix.c | 38 +++++++++++++++++++++++++++++++++++--- block/qapi.c | 5 +++++ 6 files changed, 89 insertions(+), 3 deletions(-) diff --git a/qapi/block-core.json b/qapi/block-core.json index 55194f84ce..368e09ae37 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -956,6 +956,41 @@ '*wr_latency_histogram': 'BlockLatencyHistogramInfo', '*flush_latency_histogram': 'BlockLatencyHistogramInfo' } } =20 +## +# @BlockStatsSpecificFile: +# +# File driver statistics +# +# @discard-nb-ok: The number of successful 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: 4.1 +## +{ 'struct': 'BlockStatsSpecificFile', + 'data': { + 'discard-nb-ok': 'uint64', + 'discard-nb-failed': 'uint64', + 'discard-bytes-ok': 'uint64' } } + +## +# @BlockStatsSpecific: +# +# Block driver specific statistics +# +# Since: 4.1 +## +{ 'union': 'BlockStatsSpecific', + 'base': { 'driver': 'BlockdevDriver' }, + 'discriminator': 'driver', + 'data': { + 'file': 'BlockStatsSpecificFile', + 'host_device': 'BlockStatsSpecificFile' } } + ## # @BlockStats: # @@ -971,6 +1006,8 @@ # # @stats: A @BlockDeviceStats for the device. # +# @driver-specific: Optional driver-specific stats. (Since 4.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 @@ -984,6 +1021,7 @@ { 'struct': 'BlockStats', 'data': {'*device': 'str', '*qdev': 'str', '*node-name': 'str', 'stats': 'BlockDeviceStats', + '*driver-specific': 'BlockStatsSpecific', '*parent': 'BlockStats', '*backing': 'BlockStats'} } =20 diff --git a/include/block/block.h b/include/block/block.h index 5e2b98b0ee..b182f0c7ae 100644 --- a/include/block/block.h +++ b/include/block/block.h @@ -490,6 +490,7 @@ int bdrv_get_flags(BlockDriverState *bs); int bdrv_get_info(BlockDriverState *bs, BlockDriverInfo *bdi); ImageInfoSpecific *bdrv_get_specific_info(BlockDriverState *bs, Error **errp); +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 94d45c9708..dc3bc97ea3 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -358,6 +358,7 @@ struct BlockDriver { int (*bdrv_get_info)(BlockDriverState *bs, BlockDriverInfo *bdi); ImageInfoSpecific *(*bdrv_get_specific_info)(BlockDriverState *bs, Error **errp); + BlockStatsSpecific *(*bdrv_get_specific_stats)(BlockDriverState *bs); =20 int coroutine_fn (*bdrv_save_vmstate)(BlockDriverState *bs, QEMUIOVector *qiov, diff --git a/block.c b/block.c index 6999aad446..f68fb5aaec 100644 --- a/block.c +++ b/block.c @@ -4942,6 +4942,15 @@ ImageInfoSpecific *bdrv_get_specific_info(BlockDrive= rState *bs, return NULL; } =20 +BlockStatsSpecific *bdrv_get_specific_stats(BlockDriverState *bs) +{ + BlockDriver *drv =3D 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 76d54b3a85..a2f01cfe10 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -160,9 +160,9 @@ typedef struct BDRVRawState { bool drop_cache; bool check_cache_dropped; struct { - int64_t discard_nb_ok; - int64_t discard_nb_failed; - int64_t discard_bytes_ok; + uint64_t discard_nb_ok; + uint64_t discard_nb_failed; + uint64_t discard_bytes_ok; } stats; =20 PRManager *pr_mgr; @@ -2723,6 +2723,36 @@ static int raw_get_info(BlockDriverState *bs, BlockD= riverInfo *bdi) return 0; } =20 +static BlockStatsSpecificFile get_blockstats_specific_file(BlockDriverStat= e *bs) +{ + BDRVRawState *s =3D bs->opaque; + return (BlockStatsSpecificFile) { + .discard_nb_ok =3D s->stats.discard_nb_ok, + .discard_nb_failed =3D s->stats.discard_nb_failed, + .discard_bytes_ok =3D s->stats.discard_bytes_ok, + }; +} + +static BlockStatsSpecific *raw_get_specific_stats(BlockDriverState *bs) +{ + BlockStatsSpecific *stats =3D g_new(BlockStatsSpecific, 1); + + stats->driver =3D BLOCKDEV_DRIVER_FILE; + stats->u.file =3D get_blockstats_specific_file(bs); + + return stats; +} + +static BlockStatsSpecific *hdev_get_specific_stats(BlockDriverState *bs) +{ + BlockStatsSpecific *stats =3D g_new(BlockStatsSpecific, 1); + + stats->driver =3D BLOCKDEV_DRIVER_HOST_DEVICE; + stats->u.host_device =3D get_blockstats_specific_file(bs); + + return stats; +} + static QemuOptsList raw_create_opts =3D { .name =3D "raw-create-opts", .head =3D QTAILQ_HEAD_INITIALIZER(raw_create_opts.head), @@ -2922,6 +2952,7 @@ BlockDriver bdrv_file =3D { .bdrv_get_info =3D raw_get_info, .bdrv_get_allocated_file_size =3D raw_get_allocated_file_size, + .bdrv_get_specific_stats =3D raw_get_specific_stats, .bdrv_check_perm =3D raw_check_perm, .bdrv_set_perm =3D raw_set_perm, .bdrv_abort_perm_update =3D raw_abort_perm_update, @@ -3400,6 +3431,7 @@ static BlockDriver bdrv_host_device =3D { .bdrv_get_info =3D raw_get_info, .bdrv_get_allocated_file_size =3D raw_get_allocated_file_size, + .bdrv_get_specific_stats =3D hdev_get_specific_stats, .bdrv_check_perm =3D raw_check_perm, .bdrv_set_perm =3D raw_set_perm, .bdrv_abort_perm_update =3D raw_abort_perm_update, diff --git a/block/qapi.c b/block/qapi.c index f9447a3297..3afcb9dc5c 100644 --- a/block/qapi.c +++ b/block/qapi.c @@ -537,6 +537,11 @@ static BlockStats *bdrv_query_bds_stats(BlockDriverSta= te *bs, =20 s->stats->wr_highest_offset =3D stat64_get(&bs->wr_highest_offset); =20 + s->driver_specific =3D bdrv_get_specific_stats(bs); + if (s->driver_specific) { + s->has_driver_specific =3D true; + } + if (bs->file) { s->has_parent =3D true; s->parent =3D bdrv_query_bds_stats(bs->file->bs, blk_level); --=20 2.17.1