Message ID | 1528911866-37489-8-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 E1017603B4 for <patchwork-qemu-devel@patchwork.kernel.org>; Wed, 13 Jun 2018 17:53:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CE3B228F22 for <patchwork-qemu-devel@patchwork.kernel.org>; Wed, 13 Jun 2018 17:53:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C305E28F74; Wed, 13 Jun 2018 17:53:08 +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 50C3528ECE for <patchwork-qemu-devel@patchwork.kernel.org>; Wed, 13 Jun 2018 17:53:08 +0000 (UTC) Received: from localhost ([::1]:36006 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 1fT9xD-0000w9-Lb for patchwork-qemu-devel@patchwork.kernel.org; Wed, 13 Jun 2018 13:53:07 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59596) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <anton.nefedov@virtuozzo.com>) id 1fT9pO-0003Rx-3I for qemu-devel@nongnu.org; Wed, 13 Jun 2018 13:45:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <anton.nefedov@virtuozzo.com>) id 1fT9pL-0007R0-Bc for qemu-devel@nongnu.org; Wed, 13 Jun 2018 13:45:02 -0400 Received: from mail-eopbgr10099.outbound.protection.outlook.com ([40.107.1.99]:57531 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 1fT9pK-0007HZ-Sp; Wed, 13 Jun 2018 13:44:59 -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=XsLE67n6aH7RJirPDl8oeNcxq7ZdPT6IUO6ag67xnOc=; b=IpkaTyeIn/qH4IX9ODzkT0FKkiWBaYp5R+A0VVKqDHkLoYufb2oxFx4TvujyXv8Vn1bqwD/nzV7FNK7+eR25QShU11op836NUOb/8fD6eTqU1bEqEv6LRorcvB6jKrcMK7yOHU9tXG5QcqEyGko6TGUnMICslEE4WWvPLIgb9/8= 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:53 +0000 From: Anton Nefedov <anton.nefedov@virtuozzo.com> To: qemu-devel@nongnu.org Date: Wed, 13 Jun 2018 20:44:25 +0300 Message-Id: <1528911866-37489-8-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: 890b5302-282a-4a78-2b76-08d5d1555ef1 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:tr7kpkHseMI+Mk/tNFbdYuSdDS4MD4ePnPsSlLSR4/HvkJEP/jJRAM2tim8P0lLRdFzgw7E1Yrjq1EMf522DflwpxbJLRTf48aTYgnRsAKWoTb48EoLjNuWOg5+J0H5V2ed7XieDzGXSZBITjt1d2mOT8I0qQpfSgI6AAc2JhXRIkymB2FXZoL8Z6G8vLo8hBY0fNgSbm04NS3ksu5rL+oLpjIU47bd5xgb05YTTkPjR2S9v3CF0AbRbKhGwW4kg; 25:cLJT1kut1s+DGjQF+zvuowgMMAADBeO33+yfmdTdA942SHPMkhuFDouIKRpwyhT2hUcMh5JOJRZ70258Yn2+HGZxuQc6VMpdXqgAWnm8xR4FBKVDMwD3q7jqTNmm16zWhqIzBn025hSIDq1IdEXiEyd5iVw7G7lvsxBdrn6uN4vRFlW9iCKpfcyiehHFsWYpy9GmuhK1mnzPNepoUh4SRsdeVXG9rqEYWhaPrS20j0+FQltBQLDi18PlUn3YigeOGwYDEKV4O74DMjKkzS+c7D6wiBbsdSLH0x1mYZBVBbv+a+A4JXH+qddrJO7esQMGFYyZ/5SMs2IonngPjERT7Q==; 31:oysWeWLAJKBclrqrAPeT7BA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X-Microsoft-Antispam-PRVS: <AM0PR08MB3347BBE914A257916529E079F87E0@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)(15650500001)(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:BUH/9rdmkraM9Ni25DBR47x8yz1mV/e+SiB/e9noR?= =?us-ascii?Q?ypR4hLDd4gQvXI2dgt7sNoeAuAiQSmRUkQQiEyjABU0UDf+iv/zC80OpIab5?= =?us-ascii?Q?jWCku2gQSLt0K8WJP2Y6YRV6KhAlsMZ1lS6v14NvWGSe2olIgnbfVCILS8t0?= =?us-ascii?Q?BuDzCrb/hJpx2Jt0uXFf81bT1J2STYuE/I7eMzIVPNpy8LHX50EDMarybznD?= =?us-ascii?Q?C4MJe61khzwiWhIX0z153nd5BgsbuHPfS4ptvf2uuIV0vOMnb2dgL+Vbq3Xr?= =?us-ascii?Q?TstM8Gm1Bck31LwvVOOyz6MXLKKDw8thMDNbo5Ifgk26IZHZjdsI/JFo235x?= =?us-ascii?Q?/htpXT57qgobmUnrs4207cnE4O650ifSxer2l8l5jrdmucht8Di2pRzgYBmY?= =?us-ascii?Q?LOr7phzbVZaTltP50pFYqEFwwDjSOgtFGYO+O0pgDt7U+Suy7KqUEGP2StDT?= =?us-ascii?Q?U68y2a2EMWWYcoElgb0YuPm2ing1nywXNR/H7eoS0+fDUH59I8sjMt16Fm6e?= =?us-ascii?Q?pXDWBp1apIdp4zuoztCqE1rX7VZ+qjwW92cCPsJqrVAca8Ok5e4e5F5FXxH2?= =?us-ascii?Q?l/o46pIh5JAPNb0iBybrh8msXINotBoHyYo9K4YWYscwzcmsS7vyvTri6InN?= =?us-ascii?Q?F6mKhSUws3hzEkeyTOF9AdZWIf4ZDeebjzniC3usdHtfij87BO16dhtZ4TF2?= =?us-ascii?Q?9e8pirSbDrRxud3sjSAqCKXZbvFiowqVgLgyNpYKDc0AOIbI5dhJwHffVyI8?= =?us-ascii?Q?zlMglppg01vn0v+OuuY1Jrw3j+yUJzFwzOQf+aW34T++fHjPy0Miv5AHUAl8?= =?us-ascii?Q?j3liO6bUXQxQaZdlbWnsB8PQmjGp6i2f54YGOu8CZfAVUtl8NPXpfE+gLPGD?= =?us-ascii?Q?0q43rm8TLbOjg2grsTJ9mLIcOrTQ+h/tE9OWvQEjGyJOZBbxUqso+91E4R/v?= =?us-ascii?Q?VYELOgixayXPGxKm4ri+mYpnk9tHIxaTAyoPmo8POFJZAOkPA/Hy4ri3EpNn?= =?us-ascii?Q?UBxj3qLXiv4gq6ClCA8NrIGOZqBjeqHCvzuwDm7BKZchqA5nXbxl4uUASTU4?= =?us-ascii?Q?JSxGnGedaI6ToCFTkfj+zaZzKSGKw5mGJF0yYuK0bQroCCgYCm68JVJ6Pvyc?= =?us-ascii?Q?9XZHVuu4BNRkGA6jhHHAnweblCNbOF3XE7/IU6HhfycQ0IncYDXk9YQlx0qg?= =?us-ascii?Q?4cfXGrnwpCXe2BNQQ7B+UTgkrBOeyRGUdg5bk5CKyq3BgRFYWyHH2hGgi8+q?= =?us-ascii?Q?Vr8y6COrJSvdlMsFteaM/E4v4iaXbEX38RJnwUN/tDwp7/QFsjAJx1EgoFNo?= =?us-ascii?Q?jAfF9n+Ft7sCP9caDQO8xUkyDKos/XlNI+pI57iCFSR7lzjtgy9tLF+jifop?= =?us-ascii?Q?1WX3H0pgkXVv9/uHVtWlu8KprA=3D?= X-Microsoft-Antispam-Message-Info: vOKSmS/A2SicYkovAY2pWARuj9vlVCwJCohwTyDJKO4UFtEFXrs/gOqFZa7SUVz5uzkEb3XznFiCJurWwDTnJMy94xaoXVke+ZvIjRPGU0rVQljSuicPUotYSFCPlV8Va6umsRz0nKoifFIhyh20rsy4SN7rHibta10u2fHOp9hDa98dCxkSPDZzqj+k4IXQ X-Microsoft-Exchange-Diagnostics: 1; AM0PR08MB3347; 6:dj3yC5nYBGWqofU3c98GFr3u9xFqMfNYwZxIElm5jw09SriEfZtEyjrKKco53Jb/8scsy1vbxmTdBjqGAmW3dTQ0opdk10UpQltfHrcz1eWaMcV3vvKcckv8NaPmDBQ4AVP8SS+pahYHorBXtjwBtn4BXbEHi/iBPcXR6GLdtK98iPpwJ0C+kBcIsOQ9YSeraqt0HYvILoWsNPxjS2zt4hIFerkun73yoakOQcGw+JSca/PeJcR1VJazMIgCTb0rYyWzdzHucKm0M+KGAFcQv2MUjkub47ahMu+nhD9Yb7czXDFXmRLrEnfBfcY9k9YohdHlKT2IKC/imKWrcqX6zW7i+sCFSygce0d8LrrjIHh0yUcsi0UqkDpUaZTK++sdPW8ADFSZ6zFCZuwITYxGPayZAb3kD1uFWqnmymDDR5fUB/saHrEtaEAWFIoQztTyoIGOlr09Muzo3KPp3r4fnw==; 5:iwpLjQR5TPl3OH0C8hlH97T5K1EMvFFhX56rjxd2IfDNbn6HsbEfXE5gXnFoe5/j5IK3E9+rYtkHUK4mV0mA26qF/vpOsVnReawvGAIapTobiJxcCfDURfc9JgTwtzDAl1NF4FBVR9BnqKMK+8A9xloqA9tKRTEuHXYT1CTe3c8=; 24:7QGNFU1HM8/lakwcHEZpE+RnXOqWJIevGYsDEsx7UfGxrryEBirobnUXx2j+3W39N5PuWHELAu/P2hKnWTDbM4nPuYMXUQ/Cm1QKbeTl2AM= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM0PR08MB3347; 7:cLFOnaJ8YMtVtNphFhZ6bxLJUP9QEvclc+mqVj9n9mtSc/HiGkx7WONMX1K5Hw2W6DavhK5UlpE0/zeO++NahLPITb8wxap1eaE1hRmp0Hy3e7dci8ZBqxOoo8CyojsSHKdX+7tc/nu4TlqjGTPhXF0SUYFMjGrDln3cdwveM+SZSWwMspkJKWFOAOWlsZNVlSZ5Fm0U9Eq2KnYxvO4bLThfYSRuWkKLNseXNJt7W3hh9AD4oiWLieN8QlRvLUSv; 20:bvzWP5UmOVaNdbBD+cTMwsfaAgAtbu/aEDreWVvxJKCWWY+IbuhShNSysjJ/grfn2sx24UxZxNK66liWGWC+dN3ZkO/NeLDj3cUzhJ80dUHTtcW+4zWpRUPqIxvwgXgoe/qUY15cnDTZCH/Z1cMLVLBdIb0okfiM01KFDbuLyuw= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jun 2018 17:44:53.0336 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 890b5302-282a-4a78-2b76-08d5d1555ef1 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.99 Subject: [Qemu-devel] [PATCH v3 7/8] file-posix: account discard 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/block/file-posix.c b/block/file-posix.c index 07bb061..4a2e394 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -163,6 +163,11 @@ typedef struct BDRVRawState { bool has_fallocate; bool needs_alignment; bool check_cache_dropped; + struct { + int64_t discard_nb_ok; + int64_t discard_nb_failed; + int64_t discard_bytes_ok; + } stats; PRManager *pr_mgr; } BDRVRawState; @@ -1533,6 +1538,16 @@ static ssize_t handle_aiocb_discard(RawPosixAIOData *aiocb) return ret; } +static void raw_account_discard(BDRVRawState *s, uint64_t nbytes, int ret) +{ + if (ret) { + s->stats.discard_nb_failed++; + } else { + s->stats.discard_nb_ok++; + s->stats.discard_bytes_ok += nbytes; + } +} + static int aio_worker(void *arg) { RawPosixAIOData *aiocb = arg; @@ -1569,6 +1584,7 @@ static int aio_worker(void *arg) break; case QEMU_AIO_DISCARD: ret = handle_aiocb_discard(aiocb); + raw_account_discard(aiocb->bs->opaque, aiocb->aio_nbytes, ret); break; case QEMU_AIO_WRITE_ZEROES: ret = handle_aiocb_write_zeroes(aiocb); @@ -2965,8 +2981,9 @@ static coroutine_fn BlockAIOCB *hdev_aio_pdiscard(BlockDriverState *bs, BlockCompletionFunc *cb, void *opaque) { BDRVRawState *s = bs->opaque; - - if (fd_open(bs) < 0) { + int ret = fd_open(bs); + if (ret < 0) { + raw_account_discard(s, bytes, ret); return NULL; } return paio_submit(bs, s->fd, offset, NULL, bytes,