From patchwork Thu Jan 18 17:49:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Nefedov X-Patchwork-Id: 10173773 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 18B53602DC for ; Thu, 18 Jan 2018 17:56:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0671328382 for ; Thu, 18 Jan 2018 17:56:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EF6E0283C3; Thu, 18 Jan 2018 17:56:19 +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 8508628382 for ; Thu, 18 Jan 2018 17:56:19 +0000 (UTC) Received: from localhost ([::1]:44621 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ecEQE-00022R-RQ for patchwork-qemu-devel@patchwork.kernel.org; Thu, 18 Jan 2018 12:56:18 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52275) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ecEJg-0004Mm-IP for qemu-devel@nongnu.org; Thu, 18 Jan 2018 12:49:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ecEJd-0004Id-SU for qemu-devel@nongnu.org; Thu, 18 Jan 2018 12:49:32 -0500 Received: from mail-am5eur03on0716.outbound.protection.outlook.com ([2a01:111:f400:fe08::716]:42208 helo=EUR03-AM5-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 1ecEJd-0004Ce-Le; Thu, 18 Jan 2018 12:49: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=3AbMClhLwnoHBt0Mhec5U7i/+zH9R4XFw+hObujukmo=; b=iprzFWxJCTOoO8hcFUuRDhnLVlRxi17ot33Is8ws5+vNzBC79mya4K52m1FFgv8yNX6UsSrcxX7YIltXMxefIAWwwuBYlIPCOmm1qZD6rbHizHcjUTswhcZ6dKplCEUGre5TyPFU+yuqicbRcNEKuq5cWxEGOka4qOtDvOLAAmo= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=anton.nefedov@virtuozzo.com; Received: from xantnef-ws.sw.ru (195.214.232.6) by HE1PR0801MB1995.eurprd08.prod.outlook.com (2603:10a6:3:50::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.407.7; Thu, 18 Jan 2018 17:49:25 +0000 From: Anton Nefedov To: qemu-devel@nongnu.org Date: Thu, 18 Jan 2018 20:49:03 +0300 Message-Id: <1516297747-107232-6-git-send-email-anton.nefedov@virtuozzo.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516297747-107232-1-git-send-email-anton.nefedov@virtuozzo.com> References: <1516297747-107232-1-git-send-email-anton.nefedov@virtuozzo.com> MIME-Version: 1.0 X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: HE1PR05CA0132.eurprd05.prod.outlook.com (2603:10a6:7:28::19) To HE1PR0801MB1995.eurprd08.prod.outlook.com (2603:10a6:3:50::8) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6119d610-c959-469e-d01e-08d55e9bd089 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:HE1PR0801MB1995; X-Microsoft-Exchange-Diagnostics: 1; HE1PR0801MB1995; 3:V7p0vcFdCsNBqVwYKYGwmwEW79Gm7bSucNaOdUqlv0bl6PW9sz0vWRugG+og+xnIUA6oeg0JI4z/h/fiTy45LCsiEzP3h7VC6CsDAhX0G14JDsV0HKwjXqDhRP9PvvqEVQKKQPNzktUUEeTdM3c48ycPJTxcfAFJkVIxZp9QyOqy4TOQVx7TUjJvRVVTSTcH7zfW7jXzabnv0z4Pmj5W532VYvC3KhckThRzyi4ne6HwJMtAqOQ1rNeUCtBY3705; 25:LGfgVUxZlq/kNQQVyI4/SX7Sf6duHOTu7x9l3bNy0CvR0JQkj7x6vraoyv7zR+d7u8BzOQSnGV8guVipLHa4Yi+BP0T2hmO9C1qom8Ur+1B4+dXuKiFucbXA5bx6kodZjRL++gOa5w0e8QYcCtVfqYH5ZVkF9kXOCaXh3D2n6e3Id6nrF0QpCIezwD9qxnO8IiZQxxxnofe7FaMTZn40hAE8yYnd/7Bkgugp9Yjl4sDDFLlOCwRgGgfmvU89Mg6SeO5eg0cEhwZTgVBs9Uwc6Va2sVszdFRbNugPkpN66AXe1YcXOfzv/K3WwpUIXcL5knb27c2AS15bgjU23CqrWw==; 31:WvvuDNZ5yyeXn4QbNsFlj68G26Zjs3ShBjUlm3oImDvwwPYSYCTagVQENvbvysLSeNO4nvDYlmlCgLGZJ+4si5PsmyacP5de2MDppEsLTw52YOhmKclutr5ZkWMZNO+YwpZa8SrPdZ9aFIMgWbjERC3cj2VjT7aK5P5Sr7nXofq5iVup6iNPIR7or5opu1JMT6vNJaSp02c8xuqQiZ/wxHUu23HEQuU6FnHfpZz6e88= X-MS-TrafficTypeDiagnostic: HE1PR0801MB1995: X-Microsoft-Exchange-Diagnostics: 1; HE1PR0801MB1995; 20:iXUBjYuHea1gvE4Ka8aGBiCVYRiqaDsx2R0vJ9nP1cKJoZK+otE8wo2JvYnsOy+6LexYqaqIIyBzIYce+oQqDI0Ex+DYvihvIdtvY2OizD99AAJrqmb8zyhPpm+FHyjRjRC4kb29I0HdgwErKh4dVOGESJ5zTicerf3Y1TO6GmF5wZ/5PKj15EcT9yZyVsNIdRUJ8xNhmsLhLEChwW17EZ8a8Z/jn1IsiGJ5KaBtY7VPT4cFcsGWsz3LlbDv4vZR4YxjsMsHcpkLEpqg4V7tp5/dCKppTY8mw1aH7muUDcitYyqTcW/d1j4CuNYslGBt6/fBuQQ10O13wcQ0JXVyE93wxATUYQeCJufGr5UkyQ1s8pvD0j2Q8O9CYFzX49uGt/7jPoGMHK3SPj2wjY0H6Bh3EVcabPRoUvQPcJ+B2jU=; 4:IVaIJ8KEQtECd4v+49U1uQOOXIBO3mkN9jnAzVZdmSa4UWtNI3ayCLDwJ2JCFcJIvhAIm/mEGr5z3TgXGvL3jHcNy24z7W02yVFzK2kqx33E+ynBXHe1up8TODNyb04AaAWP6804j7OaRCfJq44sGTk/5EVus3U1+C4a9odPhvfW9d+6gw81aqVezIl21ril4PloTvXzwYTXIBFU6qSty4pudziPOVOGj5FsP5gBJrBArWSHkQWlKCX4gxHarSbn1f9qYLt6wxwPa/B1bVtaBQ== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040495)(2401047)(8121501046)(5005006)(10201501046)(3231023)(2400065)(944501161)(3002001)(93006095)(93001095)(6041282)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123558120)(20161123560045)(20161123562045)(6072148)(201708071742011); SRVR:HE1PR0801MB1995; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:HE1PR0801MB1995; X-Forefront-PRVS: 05568D1FF7 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(346002)(39850400004)(376002)(396003)(39380400002)(366004)(199004)(189003)(50226002)(6512007)(16586007)(316002)(2906002)(16526018)(53936002)(2351001)(6666003)(5660300001)(66066001)(51416003)(6916009)(69596002)(7736002)(2950100002)(86362001)(2361001)(76176011)(478600001)(97736004)(107886003)(105586002)(50466002)(6116002)(47776003)(68736007)(52116002)(26005)(8676002)(6506007)(305945005)(3846002)(386003)(36756003)(81166006)(81156014)(53416004)(6486002)(8936002)(25786009)(106356001)(4326008)(48376002); DIR:OUT; SFP:1102; SCL:1; SRVR:HE1PR0801MB1995; H:xantnef-ws.sw.ru; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX: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; HE1PR0801MB1995; 23:/LFiMYqUDNL5XKYeEqcAmNkmmcqdRrIDJWcj9bT?= =?us-ascii?Q?5n0XK45Zgvjl8I58AH+8uc9SssiXXAyFIfXtDlfPAYHSvuZe33836cZZViCX?= =?us-ascii?Q?gp9Lgg2MlvCaVKjSqWMrlYbM22B/mf5Hwbb+0KX+M8zXxgQ5NHdIea+N70TW?= =?us-ascii?Q?50JeZRCbCDxeeqCrr4WYjLgQ0dU6oq7W1IWnQKJzI4/85E4R5cslEkkxjUVF?= =?us-ascii?Q?vk+EPPcDgvMrQsniFj1M9z6tNffZFqVCyQ5GetDIucc80Vd/Gm75bzge5Qkt?= =?us-ascii?Q?mYWn95Pm9qnG0Q9Q/04XT0vK4xccobtZInafpJjWeN+3LxmI9pElgHfoZtgl?= =?us-ascii?Q?ZF6wLq5olNIrNkatuSqikoMPFOyrKrU6Nmp4A1/+Nxq9W/RmhI92iUChb5XA?= =?us-ascii?Q?THPxM4Tu/4S/gB4gIye1Y7mEyfUE0mm82DuTbMMgnTwyUkEeTxNIJvhbQQHZ?= =?us-ascii?Q?kx7GQR3lsQW0U3vwn3AmhUPF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VlO1BJ18j0PQNpYm5myNpxrh7hcxKJkw2M8Vs4Miej1quxted3/lBme3KFypxu+K6ZCP9zB15uDhTBTiCxl70Naec6263AgLl9IS+UG4tmz4zummadQ+EA4l1OAPYvnBuDc9BblK5M+wWTQsgFqXTCy8ASF6mmYsPtz8dhLbnBc6xZknb7Riv64xNiuP406PgbGBFNoxUKqjKY3TLgCLESzuim+Pg=; 5:IQNJ27v8APsKn8cPeReSDXCbW2D5Mufgff2ELDbGgQAl3sLhP9rAi7dQqltt4Xtqd+cH89onHQ3d+qpPeJkBjqW0jH/aGlowkrYXQu516xjI8qMj91RnHG37pc5LbNOFhUVo/hkhMh607bNo1o5vuXNgnL9IdWTYrrrBsq4rnms=; 24:iqVxSsrU8GuA3SsuPBAsn4P7t8KARJ8d8n6c6sRhfbJ/6ANuhDKj+FkCJrUn4DRPQbPF1a4Nw/ZJ4IYMaOmR2wQLtKbm0PZqp+2+8kQrxxM=; 7:dqtFiRDlBAeKByyuNnfguFPeVk9u4uX3KM6pk+gBEaRur0UI1qPFRtzUHAvGxYh3C/H0HBAchEClbWZpF0HcOpduR1/qE/0rGlY8CKxdbzh18Vhu0oS355C95A/4ZUbCxV686f5ZsnMCMTWZt+y6mLjzScnrlr/zGyQum5jQZzv7h5bbkvUcuPrMEDX+CzClYSF3qkLSNBuao2QPubg75m0ADtcpeIVZOWWgBCkxy2qVuDIHc/dZ44KBdUAxqypi SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; HE1PR0801MB1995; 20:wBHecVCESkjX5XIqUVsWY54q6CgYOLYKl/QXiABVxzcyqDjuM5+XdhTpC4eGn95eVBAjZha39QcHGlPx6ylx/0rHv4oGE+3H4PoTButD6+jxRnNYSdO6FNgNmvk0uGAJyaabyf0kz9y3SOpntvJeUD1xQcLShvXMQk+CZdTeCdk= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jan 2018 17:49:25.1615 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6119d610-c959-469e-d01e-08d55e9bd089 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0801MB1995 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 2a01:111:f400:fe08::716 Subject: [Qemu-devel] [PATCH v7 5/9] 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 , berto@igalia.com, den@virtuozzo.com, qemu-block@nongnu.org, 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 Reviewed-by: Alberto Garcia Reviewed-by: Max Reitz --- block/file-posix.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/block/file-posix.c b/block/file-posix.c index 36ee89e..c36e156 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -558,7 +558,10 @@ static int raw_open_common(BlockDriverState *bs, QDict *options, } if (S_ISREG(st.st_mode)) { s->discard_zeroes = true; +#ifdef CONFIG_FALLOCATE s->has_fallocate = true; + bs->supported_zero_flags |= BDRV_REQ_ALLOCATE; +#endif } if (S_ISBLK(st.st_mode)) { #ifdef BLKDISCARDZEROES @@ -593,6 +596,7 @@ static int raw_open_common(BlockDriverState *bs, QDict *options, #ifdef CONFIG_XFS if (platform_test_xfs_fd(s->fd)) { s->is_xfs = true; + bs->supported_zero_flags |= BDRV_REQ_ALLOCATE; } #endif @@ -1413,6 +1417,10 @@ static ssize_t handle_aiocb_write_zeroes(RawPosixAIOData *aiocb) } s->has_fallocate = false; } + + if (!s->has_fallocate) { + aiocb->bs->supported_zero_flags &= ~BDRV_REQ_ALLOCATE; + } #endif return -ENOTSUP;