Message ID | 1528911866-37489-7-git-send-email-anton.nefedov@virtuozzo.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org> 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 61AB1603B4 for <patchwork-qemu-devel@patchwork.kernel.org>; Wed, 13 Jun 2018 17:50:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4E80428DC1 for <patchwork-qemu-devel@patchwork.kernel.org>; Wed, 13 Jun 2018 17:50:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 42E0A28F54; Wed, 13 Jun 2018 17:50:36 +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 A371F28F5A for <patchwork-qemu-devel@patchwork.kernel.org>; Wed, 13 Jun 2018 17:50:35 +0000 (UTC) Received: from localhost ([::1]:35980 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org>) id 1fT9uk-0007MY-TO for patchwork-qemu-devel@patchwork.kernel.org; Wed, 13 Jun 2018 13:50:34 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59571) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <anton.nefedov@virtuozzo.com>) id 1fT9pN-0003Qu-6Y for qemu-devel@nongnu.org; Wed, 13 Jun 2018 13:45:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <anton.nefedov@virtuozzo.com>) id 1fT9pH-0007F0-Gu for qemu-devel@nongnu.org; Wed, 13 Jun 2018 13:45:01 -0400 Received: from mail-eopbgr10095.outbound.protection.outlook.com ([40.107.1.95]:27040 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 <anton.nefedov@virtuozzo.com>) id 1fT9pG-0007AL-Vd; Wed, 13 Jun 2018 13:44:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=14aCL/lbJZM7qtcl4+wDBCEQcbvz3lVcxByqTagh12k=; b=buI18NulGy4alzq1b+34btSlSRb9wacUNyfwxFcona6uYybK3tRs4INEJI/jaXPAb1Iop8QnJbUv64X1rx8ilcsWq8zbOf9IdGAsB3dPBlwXBaEvCHloPtNAyLduuf4H3XZLC9XT5nhTWksoXvkmWFP57H9w2zEgUaqPQBc+ZII= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=anton.nefedov@virtuozzo.com; Received: from xantnef-ws.sw.ru (195.214.232.6) 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.863.16; Wed, 13 Jun 2018 17:44:51 +0000 From: Anton Nefedov <anton.nefedov@virtuozzo.com> To: qemu-devel@nongnu.org Date: Wed, 13 Jun 2018 20:44:24 +0300 Message-Id: <1528911866-37489-7-git-send-email-anton.nefedov@virtuozzo.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1528911866-37489-1-git-send-email-anton.nefedov@virtuozzo.com> References: <1528911866-37489-1-git-send-email-anton.nefedov@virtuozzo.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: HE1PR0902CA0023.eurprd09.prod.outlook.com (2603:10a6:3:e5::33) To AM0PR08MB3347.eurprd08.prod.outlook.com (2603:10a6:208:5f::20) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 951804f7-dd5d-4fa4-fff5-08d5d1555e26 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(711020)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:AM0PR08MB3347; X-Microsoft-Exchange-Diagnostics: 1; AM0PR08MB3347; 3:XK5Snfa/ef/J743r4snqsjoqmgTBXzIb8RX2duFwl4bY0ly93scIQ3e8INbwM4r4hpVlmuNZlcv2EFp8oKTSVfhX2qTiahaaUd76x3ctWaaOQNYJ8ZmsKd9S6D96toBuJKkSSEiwYzBGRjs59fJ8BzuOu2YKhPMkIhq3hEmdo7XQHadZ91wUX4zZ/M05gH7OsjQmECtUGugaotAqXQLOQPYcP4+j1CVW3GjOhEIb6iv8d4hTO1BP1WDTsrZYTOVM; 25:d9m5vKWvjj8YNIo/aFJM3b92DlXYCK76oxhUw0Mhy2EdBqzxc1BpIxo3GWEENZqzqDnVBovFFK9RaX9WT0KzYvhZhkhqKPuN48tSSYy0OPo9HaO6OL1W4pvRGa2DozKC4ATWXCr4gZM6eWogy+FhvTghr98LvV7WDn6W0fV3Bs892v62rD4/4BkU82Zd9rCrLPOkzn9207vNt0+J2lwlQ8DzzMEm46BzPGv/FDVtI3FyXsw2wn7az6dSIXWzTM/TO85aC54Gu8O9phLT8fBlDWJEiEHQhIyW3ZF0/qxCcCzD7OvhA1cMlkTFPlUw5x/KEl19IIiiAmZ0tGjjz1TccA==; 31:RSp0zqMbZPx+RPC3Edm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-Antispam-PRVS: <AM0PR08MB334709FB455E6102CBFA7EC5F87E0@AM0PR08MB3347.eurprd08.prod.outlook.com> 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)(3002001)(93006095)(93001095)(3231254)(944501410)(52105095)(10201501046)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123558120)(20161123564045)(6072148)(201708071742011)(7699016); SRVR:AM0PR08MB3347; BCL:0; PCL:0; RULEID:; SRVR:AM0PR08MB3347; X-Forefront-PRVS: 07025866F6 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(396003)(346002)(376002)(39850400004)(366004)(39380400002)(199004)(189003)(50466002)(2351001)(386003)(4326008)(2361001)(59450400001)(6512007)(52116002)(105586002)(486006)(478600001)(106356001)(44832011)(53416004)(107886003)(51416003)(53936002)(76176011)(11346002)(956004)(446003)(2616005)(476003)(69596002)(6486002)(48376002)(16526019)(6506007)(7736002)(97736004)(186003)(5660300001)(6666003)(25786009)(6916009)(305945005)(8936002)(6116002)(3846002)(50226002)(66066001)(36756003)(8676002)(86362001)(47776003)(55236004)(68736007)(316002)(2906002)(16586007)(81166006)(26005)(81156014); 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:SrfUL3d7cIlNNtNhYFweG6jrIPso4D9mtyEHt8Hxb?= =?us-ascii?Q?be1MWnyQSBMZVEWX9bzjo4SNiBk51kcfxYZ+pxp3FTc+u85QTInowchE4A2C?= =?us-ascii?Q?0/eDKB1xY8XBjmn5KmZpBE9DxltP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?iWZnE49hKY3eGwM3uapbYnOvcVPk2iTH2fQk9Hc9uMzhEdbCJ1C7ElXCecNX?= =?us-ascii?Q?/AnI+Ao/mQtH+wPVkM701VKg/0yREkn+YnE58SgiNJHZuIm1aZJV+tQM5otq?= =?us-ascii?Q?l7zCcJmV6U9o8W4SftWQG3BF1wIZLAKYe5JXTHpBi3dD8xPO+cUXt5mNgnNe?= =?us-ascii?Q?j2hKg/Vn9kcfjKR7vD66CVRuehhxejVUqocpSdl3FsM8KNAuwsUWugULlzQ8?= =?us-ascii?Q?gQb31Nh+kvjYMDns+ZPlx3de1hrjmnFierfEJqLqceD/iftursjf9ug9tDuo?= =?us-ascii?Q?TluKYNeiAUAz9aETC639qoCIwrQLSDrZyhsG4EOBRpMXieAY67ZHxM92BBc3?= =?us-ascii?Q?us8tA=3D=3D?= X-Microsoft-Antispam-Message-Info: jGV4AMCujDjxqrHTRXYjj89t++oRXdYcVqlRy9crdjZkL3P3u5r5C/TLr6BYmZhaEeFHkMMIcAd6Qhl0du5UQOICa8CC4RcwqOaYKSiefs1WEJ5sDYlFbClLMXDaG5xQ5Eqfj4Pj8mVSQUTVudwJBKCRyhOuySOg/WL9NidgXW2AcHG3lAJMRrVNIzpIb9+Y X-Microsoft-Exchange-Diagnostics: 1; AM0PR08MB3347; 6:if6CMH6ymqXoBM7R0U5ei7C82TM+FhQ3VOOboiIgxuoGkrpNdG+cJwxm9A6R2otQXP+szFS4vlXWy6KZXiilLx+lVFuAhsA86THCU7t43/dZf7tjP9JjtTs6S84Ehki0xtmisuO1bVQ/atKZz1b2lyIgfP6odkbwwbNu99+QiS9iIB/R3JdNvRpZGWO/R/UEtZvPPSpWk+WiLh+936a+UCrFHug9rD9mekR1qK2cfJA5DgvbdtgWPRMlr9A7jah370AD1J8+o16ESHlcpQ3y8ijJBSnESwjFBE4HKVxc1wHi3HcuWMfIMkJpEGn/EMKjdSWlsq6K+mpZyuZAK1dQQYmv3R9Gvr7L/MO+bQU3FvxLcJamAs+twdauRy5EkmKZupogmRwzadFhaRdk6sNrWQ3t6B5snScAz/dQrrr/iI8rK+lZyatieJt5G66UbpsYcjsHVk/7TT4U0zHRlf2fCQ==; 5:gAETiKSQs2q5loThyxOt0msjyHxgKUli5Zhvkn9Qs1dqE71DgS+WtRpTdWJsC7VT0LxZvQiACi6LIVgitt/SKKAxQ1RWVzWTE0oiz17IZ074ssmrG3t55BBLuIk3sOGFkTfyFC9qg2zYnhBExpSeqgk/HwfworLb1RJkJtn+ChY=; 24:+YSE8vcCmkTST1PAtf8HA1VyOmQqqg8psm+TnRu8qJ8dgOq1lVI7LjkVXWcpXtT5E42GMGCC4DwwovtYspZ5xr/8V/oon5v/w7c+swZpQWg= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM0PR08MB3347; 7:7+syPl+ATmiXgSpf38QZqxp9knF8O1yrQl4lLBSoACZz71gkAcPbTa6dfWcWl+aNIIP8zNLDh14ui/sTtJzTx4PZa2GXZinqIq4w7W7/PjNsd5jqP5eEQ0k0p4P7IJX63+Yi4tbs2bxjy8i/wnmkAdhwsVv/3Ui9yKv8blOlA4usTUc5Ol0ZhQxcW/x5KnHEgqNJh+IHBNIjQnd0VNPffTb4glAM1lzMC2ikm9t/UniLPbUBBogcfLP8nn+H0N3D; 20:ZcmgBoufcg3dDdkLgkGQ5xzidPtiR0g9WjnRd+OAXtktbcye0DWL9mT23HoFCz+SA/E/smeHMSLZ+K2ZH7MI0u8eg/mzl/TsHWeUavE6pLJnTzy+G+wih/G96EayzflL7VH7YCPsGDFWooUJ0jIl71+8VsAKqdm9hsdsqqQdawo= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jun 2018 17:44:51.7307 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 951804f7-dd5d-4fa4-fff5-08d5d1555e26 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.1.95 Subject: [Qemu-devel] [PATCH v3 6/8] scsi: account unmap operations X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: <qemu-devel.nongnu.org> List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe> List-Archive: <http://lists.nongnu.org/archive/html/qemu-devel/> List-Post: <mailto:qemu-devel@nongnu.org> List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help> List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=subscribe> Cc: kwolf@redhat.com, Anton Nefedov <anton.nefedov@virtuozzo.com>, berto@igalia.com, 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" <qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org> X-Virus-Scanned: ClamAV using ClamSMTP |
diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c index 0b68a8d..ed72662 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -1653,6 +1653,10 @@ static void scsi_unmap_complete_noio(UnmapCBData *data, int ret) goto done; } + block_acct_start(blk_get_stats(s->qdev.conf.blk), &r->acct, + r->sector_count * s->qdev.blocksize, + BLOCK_ACCT_UNMAP); + r->req.aiocb = blk_aio_pdiscard(s->qdev.conf.blk, r->sector * s->qdev.blocksize, r->sector_count * s->qdev.blocksize, @@ -1679,10 +1683,11 @@ static void scsi_unmap_complete(void *opaque, int ret) r->req.aiocb = NULL; aio_context_acquire(blk_get_aio_context(s->qdev.conf.blk)); - if (scsi_disk_req_check_error(r, ret, false)) { + if (scsi_disk_req_check_error(r, ret, true)) { scsi_req_unref(&r->req); g_free(data); } else { + block_acct_done(blk_get_stats(s->qdev.conf.blk), &r->acct); scsi_unmap_complete_noio(data, ret); } aio_context_release(blk_get_aio_context(s->qdev.conf.blk)); @@ -1729,10 +1734,12 @@ static void scsi_disk_emulate_unmap(SCSIDiskReq *r, uint8_t *inbuf) return; invalid_param_len: + block_acct_invalid(blk_get_stats(s->qdev.conf.blk), BLOCK_ACCT_UNMAP); scsi_check_condition(r, SENSE_CODE(INVALID_PARAM_LEN)); return; invalid_field: + block_acct_invalid(blk_get_stats(s->qdev.conf.blk), BLOCK_ACCT_UNMAP); scsi_check_condition(r, SENSE_CODE(INVALID_FIELD)); }