From patchwork Thu Jun 1 15:14:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Nefedov X-Patchwork-Id: 9759823 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 A686D602BF for ; Thu, 1 Jun 2017 15:17:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 96E622849A for ; Thu, 1 Jun 2017 15:17:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8B07A284F8; Thu, 1 Jun 2017 15:17:23 +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 E33252849A for ; Thu, 1 Jun 2017 15:17:22 +0000 (UTC) Received: from localhost ([::1]:45185 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dGRqj-00013N-Tu for patchwork-qemu-devel@patchwork.kernel.org; Thu, 01 Jun 2017 11:17:22 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51518) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dGRoW-000080-Bj for qemu-devel@nongnu.org; Thu, 01 Jun 2017 11:15:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dGRoU-0004e9-7L for qemu-devel@nongnu.org; Thu, 01 Jun 2017 11:15:04 -0400 Received: from mail-eopbgr40133.outbound.protection.outlook.com ([40.107.4.133]:34349 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 1dGRoT-0004d9-W7 for qemu-devel@nongnu.org; Thu, 01 Jun 2017 11:15:02 -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; bh=qspFrB1CSixx2NJ9PsYR+CnZTOhCbTyEnSbWFnoiHyU=; b=FXM/vwlShScw40EeydFFKyGvhdgotkTZUZFTkNCOgbuGt3ir31j6myMfOCqvyDngI/Yc0OVd1sxtNqVUj0xs+f99Ku3SbLnAB/sOyQJH3fdrDppO6wz9N40uWVTzYktA3kwBLcnWlQqqC4yUNAYKRpRan9bqJxKppTDtCQ/gfsE= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none; nongnu.org; dmarc=none action=none header.from=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_128_CBC_SHA256_P256) id 15.1.1124.9; Thu, 1 Jun 2017 15:14:58 +0000 From: Anton Nefedov To: Date: Thu, 1 Jun 2017 18:14:20 +0300 Message-ID: <1496330073-51338-3-git-send-email-anton.nefedov@virtuozzo.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1496330073-51338-1-git-send-email-anton.nefedov@virtuozzo.com> References: <1496330073-51338-1-git-send-email-anton.nefedov@virtuozzo.com> MIME-Version: 1.0 X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: DB6PR1001CA0005.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:4:b7::15) To VI1PR0801MB1999.eurprd08.prod.outlook.com (2603:10a6:800:8a::20) X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR0801MB1999: X-MS-Office365-Filtering-Correlation-Id: b2676780-218a-437c-83d5-08d4a900f840 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131423075)(201703031133081); SRVR:VI1PR0801MB1999; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB1999; 3:qIygn44ZBQrEOqrb+tNfl+Vg6KnOXJ0BqWd+h/soPjFM36eUdmZBIhOd9AuYl7QkYx0prZq2em8Vf9QWpyYGBSdW3IsthpYSNLtL0BFtQ+XsvBoHVrxqNr/BNw9XncRqQ6/1cvUmzYR+QkI7P2xGC2DtWtRvJ8PzpfMz8G/62V0IHZglY9JuK9zZM/mSO7DHZ2Nuz8mRpWKJFkGpSCHPlOlh/dEoXWPdzVm+UOTa1HoqF7XsAStMmdu2JTlEQWYd8UUTX5de7I8KJXNG97TL8e99qkscNAhNOqd45W/2c4/dRmuTYqRRKph+XyS/1rYCU7sw6ubh6IHbHgEIZorbxg==; 25:T1hifuxhf6Eh25s9Ce+RowtqlhZtcIcX37Y4cjCGV2CDIyXX344C1bJhQEx6OeQGQdhrIfK15NQx776AWJfHSd9iAT4V6iDJ9SAhfp/ghOO4+atGmZphqyAPVQGrwsAKFNB4pPFnPsqScmeQ4dCTkbx4UIrYkVCSYlsoKLO0LbdltnTGs+L0REBduPyaFcKO2RMhlXvahlhB0mjVnWRPV04VFS40IjK2vgpTr4PsJWOk1dof5FmauADGHPguRpizjXRLGG6L2bYjKxcm3U2sPnKxdyb/9IQPPpwo3ZXJDdksQdyRcv+DkC/Gm5G6lQtQm4QdXcPbt3DxbtMPwqqy/UInBlYcRYfyGDQGj6Wm4wBy7rCofnWkXFiV1B6alriED98xyTxSorLyxYTu0RRKTjbspoa2U2t67MGblpvOZQ/GofCcOd5jQVQ/hrTj2jxufH6T0dzAM52aFlHL0Q/K5YztuLJz9veLgsoYYrgDAQs= X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB1999; 31:BjVv+6c1M3vLbOYrqRZIETWAJSUkKq4N7uc6ag6uKK8D0bx8wlIYeI6FiqtrcjShpx/WmcZJrv1HzptLB8go19/eQBudAd4sbcZUqx9oftFj/W2576eSQiGOZz7KQPVHqvmnilSC7WMDN3cLcf3k//eXM8pYguoznqx1405rMZw9Q15miwhboGChDoijXsqOqUM0VxrkGqPnWjEYDUyhEYcgyFdYsCXHvMEvpXTviDc=; 20:d61kXgEJ1Flvl+dYNO/Nt9OFF0tI5AnLuZ8bagDyE8nl1tqmG0Ua4mvKp1eJGK7GBY2BIie/8fypEkQQc8zd6AYSohlYV/wRY8GQ6wGZlTLMSGpVxCTDhDr8VBR+72lFJEHLRVZA4MLUCIEidF/eixG73vimJ+LKhkJesMaaHrf3VCMpQhChpI3QrnbWbo+hAGZutbVuIMIQTTnXQJv0RnKuWCPRE0Ijd6IUKivjcerMGOV18vFAi/wwW2FSlsIQ6eKNoTQHjDSU4Us5z3tqUWhiwzRpaA4einc3uhZqhq4xjjok5uZloVVJSZUW/07fmI64L5ly0JTmbKzcaPfYb51zsWsdgOP6Mu8S/I0INwGP4muTRjS3gib5sGnEhnBViljNkGYmp7R8Bhutn27g+GZI7UAvCm26OL4zPMpZDqM= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(100000703101)(100105400095)(3002001)(6041248)(20161123560025)(20161123558100)(20161123555025)(20161123562025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(6072148)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:VI1PR0801MB1999; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100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/nRp7GQf0q?= =?us-ascii?Q?eMS8+qtI79cZiSX/29cSA4Y5TfnwYl96+a41pgURQv/uWyInYV/dhXzhuk+K?= =?us-ascii?Q?QSqpOubcinLPx5wVl7hW7nuTeYuPAx42U9GfRrJAqx4dbj6tCFQrGYqGGEhx?= =?us-ascii?Q?tjmt9WEzvvazrdGnrag9vE30Ti1xXHjhF446HJHmOCIJa/rI/Cm4J/MS+FuJ?= =?us-ascii?Q?xhukW6aBporAGeqgKeBS5w9f+ag7RDngisGiAQIImcepQQdNlFSJ2CgzaixY?= =?us-ascii?Q?A8eZeQdF/3Q+p3BYKnm7lZmPWZbjgiqiJqlVssoXeRvOlQyXHRhwlUkdfU/U?= =?us-ascii?Q?qa/BwBB6SbJVFrC40NR2h+TwcIyLYaXz?= X-Forefront-PRVS: 0325F6C77B X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(39830400002)(39450400003)(39400400002)(6916009)(6666003)(6486002)(7736002)(478600001)(5660300001)(305945005)(54906002)(53936002)(4326008)(6512007)(6506006)(2950100002)(110136004)(107886003)(3846002)(50226002)(8676002)(66066001)(42186005)(81166006)(38730400002)(25786009)(6116002)(76176999)(50986999)(47776003)(86362001)(5003940100001)(2906002)(2351001)(36756003)(48376002)(50466002)(33646002)(53416004)(189998001); DIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR0801MB1999; H:xantnef-ws.sw.ru; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR0801MB1999; 23:Csk1PPCU53XYFS+m/Rm5xWt3MbxAjRPskSRWrXV?= =?us-ascii?Q?4TJUVANk5mFVS+ZZfEFfqKk1heNSLFVuvJ/ptOhIAiDw1brMaTchsZja/uOo?= =?us-ascii?Q?8/BUj7f5lpRY4T87dk+7yAW+6mfl1M8bqMXdWNgqoTGEsVKUM10LxPWt9sM5?= =?us-ascii?Q?nRgiy3mZDN0Mmn6P4ryb/oMuWZKefpjqfZD8L6SWG7HMasbqCvhjw8jPn5fM?= =?us-ascii?Q?VHtefwu5Ivr4hGA5L8nI9t1hFz25mkhqkH0vkWai1MOmKZed0OtAt3LgJ1hl?= =?us-ascii?Q?pxp7ZY8ggvBjHAOC7HLX8drJlxp6181ckAQDPy7P/OjxkujyySC5NcBpXk28?= =?us-ascii?Q?YnOI/DoMCVA9P5lNFKOanKjb0LQcFCPoucnzZ6oHtcKpn8CeMrocvd6Rviij?= =?us-ascii?Q?SrvEuNGdHck3L1wvLAQRKk/cSrvzq8HFINprXhZGLBVEGky0x6TLhMzHgy41?= =?us-ascii?Q?vfRNxJEFmsdWI3h5pw+L8kHxt89O32JSwmFIj2WCXrJCgnSlWPNhjNp75ZsS?= =?us-ascii?Q?39tGXDfue5Gj8fFYioar3Y/uRhFN+gE75o2q9gUuwNwXz5f9AJPNn67JcQfA?= =?us-ascii?Q?2CcActy+YYQNBP25K8EzVmOCEJ66DB5jLdE6+Zfu5My1IoHpvsltfQKGXVx6?= =?us-ascii?Q?t/tOaURF2operCMmqcWqcl4zGf7VSOODmzYHlBBcucZF+Y5SkKOVEj0eYUAN?= =?us-ascii?Q?qD13BfQhrl5++AtWfK8Jcz5QWtXycWkVnUZycyd43kceWZz0SmbrQcycpEuS?= =?us-ascii?Q?2m/JclmJ2RoNPqfqKX0yhSC8Z48tNkpxyqw65MPnGLUdMnyM3To5umK5hL2v?= =?us-ascii?Q?QxAdX3ZiD2yFnw0aoUS7T/uHVAdHcLzHhneJEM7vSLf/EXKF7I3fHYX40rcq?= =?us-ascii?Q?sisgxuCHK+9k0hdEMexhUt0osLr9FzG0jHs7MJ1uJWgK44giiSKazU3ckFsj?= =?us-ascii?Q?/jmouxvvrcH4VK/SIGc/p49XiKopAQ5rU1yk/gBLnZXh2EzhiYpwoVVe922b?= =?us-ascii?Q?cI457fR42R1crhmYN4U87GIhcnhuAuRRASBqZcKrd3l6ba058ei2Cs7+sPCB?= =?us-ascii?Q?jfEH39Ig=3D?= X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB1999; 6:v/nxRyKss+K+SNn8c7QMpoNL5RT2BlWhsSNTuK55WiLplTgPwBtlN23mF2AAzPsKw65sD5eDfgRzcYwoCvRUHQhmu7vXUZSpCsIdlBfvL8Xonh7UMJ/smvZMB2hHZjrFBP9w+6U46APYYITznlN9lKGKwH3Sdsauy+Dv5fFjzelzk/Vwg3SFaHjggHNBFSSllI6jyPhjzX6LnmdslSQlkJrxoaaxoK+QwLKd417Kp494S5giBa4390Vn9GIgxUQVJdu1jPdZskTsvhoID5z+dRDgmiwEuPeKK5cqLTdbhTtmAC27mFureKqIaJcJb77AYsWiOC9yEMOPXutfj3219OwV8qHzEDsjHPvspsqk0x4/nUy1fQ0ndgclCcWm8EFXXBysb3VtZS+XblPrrDo/EEFRaMgc+rnYaQ36BZ0Yv2GAWvds8VXFJKe+nKb7oDcKm/rkv2zH4R9jnGhYo1W2Rg+2N+vYGYiRXHfjJnDasKJRH492kppAuthrA/sv+lgPFoCoDijSdyXtaJpb58mBmg== X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB1999; 5:mprrhVhrjUXEm2OoA5mlxkKouPMjisQBshK0zrn3mJzi/nO28AjuTaIX7J8cZkKOB7udgvzI6bH32hLT3yju2ryOqpyuSXf5/i7P5sXGF4X/6RiVRck3m1eqhAHueqKiYiDpHEE7TYaQzVBdgan8NFr74lYRCJ4VQMNRl+hlEMVybmxoYk+m/FuaONBa/nQgaAOXWosSuQ5224Xatr9VXnVtAPBbf4jku86HA7lnGE9d8ofX97ADHwC/HBU0J8vFFHmT4rO9Ozv2h2ALsG4y2C7nrv89EJ96TMhDoiqLlefOCXOukTzDvNEEv9xMyhefL4rlKhlq/9/6PlfS4Nr445CZdafyM7hM0ucMQxVoqYCbGa/nqJm+CToKN9jyH31xrpdLg2gc1P0P1oRm2dXgImloizsk98T8g1XfavSkY9gl2OwFIn1ZdGBP0ZAvAUwC7qZG+FO64yvsuex7uh+XR18HU7IkNboHKURBbwbSU+SxXbv44WcoEkzThs/a1g7i; 24:J/9M9A/va7SIdvfUbdTqSt3n4ix3bEEmY+MD2gyUOqEo0Dp2ZWtdnjMfFOpbMIQgfpe2146eB3hMjLv9coBATGQsfFrZ0UuIkHRT9PxNSY8= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB1999; 7:CL0gO/nixdBB3+YcOd3M0i37+rAxD8CGvdGE96tFe4pdK/7bvQ9hO258z9CWYovE1MPdCSr4q5Kk7MesTg3tw2S0c82URB2+pXNKDR6lHmSKyYuvTrHnDIk867NC73bDdyKs+3rUKvIo9qAmUyRw3bbm1G9MfolD+likeg5tAchYasG3i2bW7d7x6prekQ/R86Bjo7RAuohP6UDtB8PnmPvI/4S4N/u+x2NrHvgE3jOAVP8CkR9KOm7HrA7olJHe6XZCfPwWU4MDNFj9Fiqls+UNFJDkEKYzLPCruhlDRbouB+wr1VyWJqAPp5wdgaiaEhtUQw+A12adjjuymGvDlQ==; 20:JjWZjpnOL5REK422QjWrcTneKW0b9YSFqcD+zFEzJooOpN1NkWpAfB07fS+CvqFNFqPDkJQhX07NF20arGYxG4y6Zv5fULEjdxj4jI6D4J6Jf6kctM0AUXaUQfvmWuJiBqaRdSVcfvvsByd14LMCcTJJ3A9xsGysB/frTgSF1S4= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jun 2017 15:14:58.8341 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0801MB1999 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.4.133 Subject: [Qemu-devel] [PATCH v2 02/15] file-posix: support BDRV_REQ_ALLOCATE 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, mreitz@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Current write_zeroes implementation is good enough to satisfy this flag too Signed-off-by: Anton Nefedov --- block/file-posix.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/block/file-posix.c b/block/file-posix.c index de2d3a2..117bbee 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -527,7 +527,6 @@ static int raw_open_common(BlockDriverState *bs, QDict *options, s->has_discard = true; s->has_write_zeroes = true; - bs->supported_zero_flags = BDRV_REQ_MAY_UNMAP; if ((bs->open_flags & BDRV_O_NOCACHE) != 0) { s->needs_alignment = true; } @@ -577,6 +576,11 @@ static int raw_open_common(BlockDriverState *bs, QDict *options, } #endif + bs->supported_zero_flags = BDRV_REQ_MAY_UNMAP; + if (s->has_write_zeroes || s->has_fallocate) { + bs->supported_zero_flags |= BDRV_REQ_ALLOCATE; + } + ret = 0; fail: if (filename && (bdrv_flags & BDRV_O_TEMPORARY)) { @@ -1390,6 +1394,9 @@ static ssize_t handle_aiocb_write_zeroes(RawPosixAIOData *aiocb) } #endif + if (!s->has_fallocate) { + aiocb->bs->supported_zero_flags &= ~BDRV_REQ_ALLOCATE; + } return -ENOTSUP; }