From patchwork Tue Aug 21 09:46:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Nefedov X-Patchwork-Id: 10571289 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 93F41921 for ; Tue, 21 Aug 2018 09:48:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8413729BF5 for ; Tue, 21 Aug 2018 09:48:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 77F7D29CCC; Tue, 21 Aug 2018 09:48:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1010929BF5 for ; Tue, 21 Aug 2018 09:48:25 +0000 (UTC) Received: from localhost ([::1]:51976 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fs3Gy-0004w0-AH for patchwork-qemu-devel@patchwork.kernel.org; Tue, 21 Aug 2018 05:48:24 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48646) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fs3FR-0003qq-2f for qemu-devel@nongnu.org; Tue, 21 Aug 2018 05:46:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fs3FP-0007vl-Gq for qemu-devel@nongnu.org; Tue, 21 Aug 2018 05:46:48 -0400 Received: from mail-eopbgr40122.outbound.protection.outlook.com ([40.107.4.122]:7520 helo=EUR03-DB5-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fs3FP-0007oN-8H; Tue, 21 Aug 2018 05:46:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DIPyL382KKpw2GSzxwpfZKC04VZ/LUzN1D9CP+L9AOM=; b=DT9Zu/YVQpGRz/vzew0U0grkNu+oTuxW1RE73GIkYSWb/V9adbm6jIj83LUzO7ewH2IuFET0wgDRagrecKE80wwTwEhejvaFbYzLrFcHrT6aJ433m7pLnAGRG6rFSVOZ57G3vJQzFRmyI9iDxouzGtX1DhzIy6tgsZqeZZkf/us= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=anton.nefedov@virtuozzo.com; Received: from xantnef-ws.sw.ru (185.231.240.5) by AM0PR08MB3347.eurprd08.prod.outlook.com (2603:10a6:208:5f::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1059.22; Tue, 21 Aug 2018 09:46:44 +0000 From: Anton Nefedov To: qemu-devel@nongnu.org Date: Tue, 21 Aug 2018 12:46:14 +0300 Message-Id: <1534844779-118784-4-git-send-email-anton.nefedov@virtuozzo.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1534844779-118784-1-git-send-email-anton.nefedov@virtuozzo.com> References: <1534844779-118784-1-git-send-email-anton.nefedov@virtuozzo.com> MIME-Version: 1.0 X-Originating-IP: [185.231.240.5] X-ClientProxiedBy: HE1PR08CA0076.eurprd08.prod.outlook.com (2603:10a6:7:2a::47) To AM0PR08MB3347.eurprd08.prod.outlook.com (2603:10a6:208:5f::20) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5f2a524f-1a28-4cfe-577f-08d6074b0207 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:AM0PR08MB3347; X-Microsoft-Exchange-Diagnostics: 1; AM0PR08MB3347; 3:iKu5DoqNpWBdo7WxKl32NJNXvdeE+BamriiJZHXW5XDfQCReHXXKSQEk173V+mKQKnsedy9OEUwOTj84vOHh9BMt5H+IkC5ZiMqIhHPCxB27ZsLdQVyMyPGZROZquE/2c/qfXC/uzOV9uj7d5Bgq0Zs6GMHpb5yHv2Nl5v//TjhQQZ37Ly2K0kVb4CG1pSd1iTeyXLkssj2I9nW6ShH77l4znxTUydf8ENG7N3InYpbGPNNx0itToplUAHUQPSIp; 25:dKmNysWD/NO52Fh1JPTzAWSEzBZYnv20dCUw7/DNU0Ev14gBXe5O27LDZb4H6U0gP1CCBGylBhtoNwda7BU+Aas19dFV8ZDL3UebcZUYlUNoMkUo7w3Z0Aaktkezwqm9eLrH+MNeAvPHwIjXNQ5kmrSjg4AIgSYszaShHf6jwpieKRHLqAUHBLtyh2uvs1VxmgNye2phXjYBvaA8JhiNgy4Q4bz8SU2lyaF6Kp8XAKaNWuXnHEd3cMPuk3suqGh2Oik6HPAM2smdR/bgnTQm8fTPgvm2xJGdfC7A5QYlAm+D+UoOm4RvO4uZG03eDd8RMUD+tjHSPNFnOJsSHjH+og==; 31:3j8txRVQ3FIBSKu9kC4fzpxocNj2nHMKFaOO/KhpEKDt+LIINBv+AXKjashpIzghtGXSkpU/n7trfc/a1D/IJ5IpfmKvRnkjAtNIku6KTYHge7CIuJU1Yg9Vqg5pUIXL5P1YU/WOh2d6D2FBV8c4bvaytcyIjTu2EsQxRWfPxD+YK6Nd2EubtLtrOZx86F3CRORncU5pqqDSdVgvdfRCpwz7KiIomRNfFn3+Nytioms= X-MS-TrafficTypeDiagnostic: AM0PR08MB3347: X-Microsoft-Exchange-Diagnostics: 1; AM0PR08MB3347; 20:jNTvoyZ6JvYexoPmmK7pPebi2GRBpWgVEoAQQWt1B08QVjEyhsIQnEGeFvH02R9ZK/4RV+uIqK4W0YbWYo1BAENF4XtbnkkahohnI2gvbSI+G2X5FVdEuS37OLZeILOsbVfeOzZZBfwidFzUOi4F1vcuUiFSIx+Ib60kzPjORpQQVGjvxvaUaSJxVr084ty0X0LRWVBJstWjWB+TiPVVRH/dMiCext39D8EVXr6k/IPQcxEmEH3uLMbd4cNpXPsaUIxRoRtFSJULnhRZLI6uJtW+6VyTu93JQDpXC53sgv3GUdC4/H/n7LPLITeeV0pMSuFsIOolvrwOmx/7G6GQn7+LY0IdRQ8MQ8PwNR7HmTPphtv6482PBfnfB2kglz8C5zZZwERHuYWcrlvcV4izuYxoqxp54ktEmheprca1tPiLyCyeLLZ4fKbttr77EFC3kxIrJc2pMTfKjNyngAutTc+7Ym6IFJ/6Z9LJStG9zyjD4rgxbACR9rLVDW9wX+Ld; 4:ASwRN+/dXLdgd/TVW3bDBwPrJJ/C/N0aoNup8yJhj5yGZlyTo5lIyYW3onb/m3lA1e2EQ8R1IQcr+nhH4TgV0dY7hAn+KsneSprXthj6kiX4je2rn93Ba7NXOTHhLo2c8nuk94KkpBDbXuLp2b8bMX/1+mDjh12kZfSIAif0XQGbbra+2GGOW7qA7dj2fE35EWCtujGXyapbm+/bfNgFSB3xANV1iEtP300yhK08dQ+yEh9RSrvSV8Ad6sSsOqbR47mmEAmn6HqCRGTRcY7zPg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(10201501046)(3231311)(944501410)(52105095)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123558120)(20161123560045)(20161123564045)(201708071742011)(7699016); SRVR:AM0PR08MB3347; BCL:0; PCL:0; RULEID:; SRVR:AM0PR08MB3347; X-Forefront-PRVS: 0771670921 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(39850400004)(136003)(396003)(376002)(366004)(346002)(199004)(189003)(36756003)(305945005)(53416004)(105586002)(51416003)(48376002)(50226002)(8936002)(6116002)(7736002)(956004)(3846002)(69596002)(50466002)(68736007)(186003)(106356001)(2616005)(16526019)(16586007)(47776003)(486006)(476003)(52116002)(446003)(66066001)(86362001)(107886003)(76176011)(2351001)(4326008)(316002)(5660300001)(25786009)(53936002)(478600001)(2361001)(6506007)(386003)(2906002)(6916009)(6486002)(6512007)(81156014)(81166006)(97736004)(6666003)(11346002)(8676002)(26005)(7416002)(44832011); DIR:OUT; SFP:1102; SCL:1; SRVR:AM0PR08MB3347; H:xantnef-ws.sw.ru; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM0PR08MB3347; 23:rbhAMgxF+8hbcgY8wXRz/bJxBvLlwSdwOZ/P4POKq?= JmjxKB3iiqV/mVfd/3j1bNTVPIHRUxqE+bfvclik9lhLrYMwx0L/DjIC4nPRp0hvSN27JvOMgIP4epwoBV5u7nzi6QScRSWB17Cdhhk9o92CQ6WSv4L416WKobCZoKdv/jVHLJlvhMHyQItUwDLP8dip6L5co5i1I8vnUq/MPWIJ9o00A2q3UbUI0t4kb8thpBz1xo+6hFdtkLh7lML83Uvq9vKSfIfjMB0VURY+a9la2SIvpVk9+4Ow6zTBwjPUbHsMiWMy9PZ9MXaO1nCtLKWNQl7fw4JoksTbVbug/biobukdsXxnZ1vok9VyX7Bw/OK7W0p7tBVNXIcRFWHEFFTpg9TSDL07LLM3hzsMFQsNbikUDlsQF/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6NU05eETDZq/WXpn6J/W0Cgt01qc37SecDS0IsM101v0kw0jbjU0GSQeneYJ38CMBnxdOGtn75z1U SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM0PR08MB3347; 20:lqe9wZ9pvioBcpQqkd10EO1y7JUAkZI3yONjQmDhWLjGGWzjJkNIBImWTUnVh5Gj/BFJEJGGy3ejUfBObBB1agV766iGegXE7BwlBFTiFbqqDNboxMhp6jLM9qCdrVVh+enif+sHP2I33dzjTfGy27Ad1AI2hykF5RUQNgFgqko= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Aug 2018 09:46:44.6543 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5f2a524f-1a28-4cfe-577f-08d6074b0207 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3347 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.4.122 Subject: [Qemu-devel] [PATCH v4 3/8] ide: account UNMAP (TRIM) operations X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, Anton Nefedov , famz@redhat.com, den@virtuozzo.com, qemu-block@nongnu.org, armbru@redhat.com, mreitz@redhat.com, berto@igalia.com, pbonzini@redhat.com, jsnow@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Anton Nefedov Reviewed-by: Alberto Garcia --- hw/ide/core.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/hw/ide/core.c b/hw/ide/core.c index 2c62efc..352429b 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -440,6 +440,14 @@ static void ide_issue_trim_cb(void *opaque, int ret) TrimAIOCB *iocb = opaque; IDEState *s = iocb->s; + if (iocb->i >= 0) { + if (ret >= 0) { + block_acct_done(blk_get_stats(s->blk), &s->acct); + } else { + block_acct_failed(blk_get_stats(s->blk), &s->acct); + } + } + if (ret >= 0) { while (iocb->j < iocb->qiov->niov) { int j = iocb->j; @@ -461,6 +469,9 @@ static void ide_issue_trim_cb(void *opaque, int ret) goto done; } + block_acct_start(blk_get_stats(s->blk), &s->acct, + count << BDRV_SECTOR_BITS, BLOCK_ACCT_UNMAP); + /* Got an entry! Submit and exit. */ iocb->aiocb = blk_aio_pdiscard(s->blk, sector << BDRV_SECTOR_BITS, @@ -845,6 +856,7 @@ static void ide_dma_cb(void *opaque, int ret) } if (ret == -EINVAL) { + block_acct_invalid(blk_get_stats(s->blk), BLOCK_ACCT_UNMAP); ide_dma_error(s); return; }