From patchwork Fri Jan 19 12:50:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Nefedov X-Patchwork-Id: 10175217 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2685060392 for ; Fri, 19 Jan 2018 12:56:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 17B1A28685 for ; Fri, 19 Jan 2018 12:56:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0B1E328698; Fri, 19 Jan 2018 12:56:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8BAEA28696 for ; Fri, 19 Jan 2018 12:56:55 +0000 (UTC) Received: from localhost ([::1]:47536 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ecWE2-0003qi-PX for patchwork-qemu-devel@patchwork.kernel.org; Fri, 19 Jan 2018 07:56:54 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57945) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ecW7s-0006pn-Ql for qemu-devel@nongnu.org; Fri, 19 Jan 2018 07:50:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ecW7p-00037x-LN for qemu-devel@nongnu.org; Fri, 19 Jan 2018 07:50:32 -0500 Received: from mail-db5eur01on0090.outbound.protection.outlook.com ([104.47.2.90]:56398 helo=EUR01-DB5-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ecW7o-00037O-Pa; Fri, 19 Jan 2018 07:50:29 -0500 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; bh=QpizvfvgHRIsIk/9t6uQde2ycomDeRp9cWJV9d1GfIw=; b=KlQ7HXpoN1YHav4SXWgu3e6PmJb87Mzxdt+6oeWjiW0RJ8MbC3savVNL8HTFEES+kU7hACnLhlLD1UmIzwWSTTZ0jNDGQG71kJTnYom7qg4Dx+vYsOKlBRHziiZIkFipXHExaPT5yqgzMX32bQnS4GMsgT/1NLMI8ExqxfEu0WY= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=anton.nefedov@virtuozzo.com; Received: from xantnef-ws.sw.ru (195.214.232.6) by VI1PR0801MB1999.eurprd08.prod.outlook.com (2603:10a6:800:8a::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.428.17; Fri, 19 Jan 2018 12:50:26 +0000 From: Anton Nefedov To: qemu-devel@nongnu.org Date: Fri, 19 Jan 2018 15:50:02 +0300 Message-Id: <1516366207-109842-4-git-send-email-anton.nefedov@virtuozzo.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516366207-109842-1-git-send-email-anton.nefedov@virtuozzo.com> References: <1516366207-109842-1-git-send-email-anton.nefedov@virtuozzo.com> MIME-Version: 1.0 X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: DB6PR0202CA0008.eurprd02.prod.outlook.com (2603:10a6:4:29::18) To VI1PR0801MB1999.eurprd08.prod.outlook.com (2603:10a6:800:8a::20) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c6542121-8b3e-4a52-15a7-08d55f3b36f9 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:VI1PR0801MB1999; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB1999; 3:M1bfGj7BJ6LWDy0NP9zkDDclU2rYk2X7SDG156rV+9oxMPKqxLSDvNPcuYOgMGyD/8xodmrU+Vq1ylmshivjaUZpwlEIkcBLXigHb91Z/F3dfN4LV0pFSBj/KiayJzl0cgFB3cbK3Vbfb4eCthiAI4/nji0BsQuBJIBK4uFPATqPT/UluN50to63qKClkHf4v9zUkUEQG3vUPWEKAsM1V8yUx6iM/DDuQvFij5xsT2keZHrSqh8NFhRQ8/w9zyDr; 25:3f6vwPOVTEFl7CzDtrpcs9BPnwTIh1XfEHw2Q/Vnqv902miGoXprGRFzlOgM2QIY5XDYXSayQ6LazrOo/nTAdkCpAvmvo3fixZ+WvUbTtXbngRdoqkIYgSAhdTJWu8aFmIyzL9kDI9mr1TgHo6KMrbXMvsMO9yGkK+a5S7lgcO5pKxa74yeVvkTiQdKJXO5v/vk4GZMKI22ah4NZh7cSbAzLUNbDFqu9k7wzfcmUPybAq0vRDuTeubcb7P1QpgTu+J1WYOR7tiSxIxAwZ0Pw7rNOWF07T6s1JKxWssvy02doduTGWPl1F+A8q7391CbQqaYRFOHY3qktp+s4ntchGg==; 31:Y8fOt7GfomOXbSdTUBScSTZWNefcnlJbx4i6eVkgYT6lDJ+dMb2GGOf91HXGt0UD/UA/9w418Duz9xz4Lu4C+KFz7dQWgztdHrcdHn+6vy38ThEJmMtRrvpzFcUDEYG0BruhE9fQe+ukqyf+CDwsiQ4Rjfmxl2xeLQ9Cwmf3ozRHneghcOQZzZBJmZRQIQ/dZpZuHPKoU6T3VrHW5J2BR40FSIKCKcisWUzekhda2Nc= X-MS-TrafficTypeDiagnostic: VI1PR0801MB1999: X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB1999; 20:0dKl6aeVsKX68sIOMQF0Gc6t5LIrySXalL/vUuKCPYb0fbkprKgk//wSsNaNm55dWUtsl1UujXHMbYUWaQl40GlH61geQhuLu6UCgiMhFTUT5fB2MImtBNSt2rqCZk9MFbaD5hiEQ25apxIjkm7M7SZ6S/wGj0jHNDnkd2ZSb99l5XOmbZtCjrFxlcnZ+Q4QT2MfUO4935Ft/9ZZ/nViMKo1jS8kL0ufxZdzuCzefl9Q3FsPs6cesmn9R2MbHiP+5gLdcXSzuugmM08LOAbCcdz/xPKyHyI6O54MKwPGNJSVs87BAJNDbHzrb7aHXPPsVd5j9Euq4H59Y4H7CZVHXOYvV/JmJipuPtWVZul2hwJNJmNhsVK6BoWX1YvZ6+680Wjze6ak3cJsH46FaUwmzGrOXc6cZ3Jrj4jrV730UMA=; 4:q0NNWAT0Djw1oYPIKAf0p9g1ismkLIuJ6fEB3ckN51sk4GcdGbt8YwCGdgGWOlHoBJmvHClamYIrmnmw149FXSNfRP9BaYrtbTGj8fhpVI3XY5VNyVbOCd4p3zy2YQQUp64IjWFCPZeoFQSygXahR4C3P0Q1ItNl0E9xW9PXa+iPkVlUeEXoN+m0BYK/gfV56SFmAmE/ThSbWXrAcjDkZHk5xbhG5MwbBhyFuA89U4XhL2GvQ1ciGXhuYoyWNmqP90qQpgzUUZE22IiseWn2Pg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(8121501046)(5005006)(3002001)(93006095)(93001095)(3231023)(2400077)(944501161)(10201501046)(6041268)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123558120)(20161123564045)(6072148)(201708071742011); SRVR:VI1PR0801MB1999; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:VI1PR0801MB1999; X-Forefront-PRVS: 0557CBAD84 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(366004)(346002)(39850400004)(376002)(396003)(39380400002)(189003)(199004)(16586007)(5660300001)(53936002)(6666003)(6916009)(6512007)(36756003)(2950100002)(53416004)(6116002)(69596002)(105586002)(6486002)(50466002)(48376002)(2361001)(3846002)(52116002)(81166006)(106356001)(2351001)(66066001)(305945005)(47776003)(107886003)(7736002)(81156014)(86362001)(6506007)(478600001)(8676002)(386003)(316002)(2906002)(16526018)(76176011)(4326008)(25786009)(50226002)(68736007)(51416003)(26005)(97736004)(8936002); DIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR0801MB1999; H:xantnef-ws.sw.ru; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR0801MB1999; 23:0p6b4N92PRPTC1K01bYZ581QXsNWSz2raVxtx0a?= =?us-ascii?Q?HMHEOnkoN7Z2Ag5aXNuTZOIJfqzSgIvcZ/evUyZY6rp1NsHdGa0pAckp5B3/?= =?us-ascii?Q?mLOx4uov+suKfOrNa6qyeVa6LSD4hYM4Prdi4vqNP4YT+cpp0UZz/p9K1I+0?= =?us-ascii?Q?+kO2OvhU56VJbMf2z5zh6ihlHWVPuT8VHQaHE9pts+yfHT71Yjh5L4KdDaAe?= =?us-ascii?Q?W+kSrYmmIHBXzWD5m+LfwROP1HN+IaOX0wYdZ458CxQkRefTNrSJuKsixB84?= =?us-ascii?Q?MvsEy2NsoKSKytstL2NqvWEvPgRI9OvwKfHCPS5aHlm4/Wb31HA4HH4ohLa9?= =?us-ascii?Q?+/2wmzjTakZmRqkoWAllEBriw5G8CbabYxKjvfgqh3fcUvJ84sAPrv8lupWC?= =?us-ascii?Q?R9k9FrW0ZWDcIwlvubsYTTyjUmiyCuqqoHPQTARkBJyXlxf3T6prrSG1bqv+?= =?us-ascii?Q?B1Q0+xp2aHpyENss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dv1TvccwPWSN+varqUAblotyQKo700fxQngYALctSvgAbWkwm18OkBIvip66hI04GS87Jva6T9NEoAbWAqN5zRxxgojQCB/WwAeYvMCmaRjjxhcAeap/AvIY3a9QaDNQVSp2Np3vdIyWnn4jJORNtHC/UV2BESpAOq+G7ybDZP8aBYcoear7pDy9Mez2Y0jhBkl4no5Youbn7eG8DAOcPLJoS9A7eEj26+U=; 5:d+RHNOPFX2caHlQeE3cBWukHiL0d+HPiyZMCnpXvX3p7ErSMbpfoydNiudkIwU6EcAob7SUn3jB+ke5bDLfHgpGTclERm3ZyRZC3NK2zQTWnf600QRt5PWTtzkWZ4/ej1wE3QJKhF7LQSLotSSrOR3PLQJDghNDdjsMTDzdCmE4=; 24:HftKa3F3pvvmxKXBgICIrtOosOy686AIEz/btm2c7urUeCq6a+PO/Ji2ZnjiU8vLlL2BZMhcGuxy5Xp5nS+CTYO63MGY4F/LRN1gyzJRERQ=; 7:bNVZJVjLXRH0fRj9QodcyzspN0/OpdZyT2VTFQXnxvu3FP4Vyel8IlrxdtQMHVrJHNkx2xGOuXjNWNdunqJ4ixqHpuZQjEJrHI0D9ArTaRyBYjceaMtMBLOSBWvDzabZ9RyutSgb3hlLg9xnkdwcQ6w4Pwd3XNqbetLSL+7r6AFvrcNekaMdsojKeDRnX+sl/2gCnMRnwh++1gfPF6T4PhhZdIzxTCM0rC4UnLDt71dyZPy5oGtqM7y5PkiLFnrt SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB1999; 20:TpAz8UvU7516N5cfEKnoV51zF+wIV0wzwhOBMaa0/O7YcTJhOOL+xj76J4CvpkiLSBmla/X0bP1G5AjmPHOEKBs6MHEisUx0xAk6VzF0nlx6TSAgNllw6ZQFHBUTgS1z29M9h6t8Chid1o765RNm9cc83N0P0k3w0B41MQdtewo= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2018 12:50:26.1233 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c6542121-8b3e-4a52-15a7-08d55f3b36f9 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0801MB1999 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.2.90 Subject: [Qemu-devel] [PATCH v2 3/8] ide: account UNMAP (TRIM) operations X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, Anton Nefedov , den@virtuozzo.com, qemu-block@nongnu.org, armbru@redhat.com, mreitz@redhat.com, pbonzini@redhat.com, jsnow@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Anton Nefedov Reviewed-by: Alberto Garcia --- hw/ide/core.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/hw/ide/core.c b/hw/ide/core.c index 5be72d4..6fdc936 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -443,6 +443,14 @@ static void ide_issue_trim_cb(void *opaque, int ret) TrimAIOCB *iocb = opaque; IDEState *s = iocb->s; + if (iocb->i >= 0) { + if (ret >= 0) { + block_acct_done(blk_get_stats(s->blk), &s->acct); + } else { + block_acct_failed(blk_get_stats(s->blk), &s->acct); + } + } + if (ret >= 0) { while (iocb->j < iocb->qiov->niov) { int j = iocb->j; @@ -460,10 +468,15 @@ static void ide_issue_trim_cb(void *opaque, int ret) } if (!ide_sect_range_ok(s, sector, count)) { + block_acct_invalid(blk_get_stats(s->blk), + BLOCK_ACCT_UNMAP); iocb->is_invalid = true; goto done; } + block_acct_start(blk_get_stats(s->blk), &s->acct, + count << BDRV_SECTOR_BITS, BLOCK_ACCT_UNMAP); + /* Got an entry! Submit and exit. */ iocb->aiocb = blk_aio_pdiscard(s->blk, sector << BDRV_SECTOR_BITS,