From patchwork Mon Mar 12 10:16:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Nefedov X-Patchwork-Id: 10275909 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 F0E916038F for ; Mon, 12 Mar 2018 10:19:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 00E5A28CE3 for ; Mon, 12 Mar 2018 10:19:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E79AA28CE7; Mon, 12 Mar 2018 10:19:20 +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 A604528CE3 for ; Mon, 12 Mar 2018 10:19:19 +0000 (UTC) Received: from localhost ([::1]:57491 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evKY2-0002zo-Qn for patchwork-qemu-devel@patchwork.kernel.org; Mon, 12 Mar 2018 06:19:18 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33643) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evKWK-0002mt-Qy for qemu-devel@nongnu.org; Mon, 12 Mar 2018 06:17:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evKWG-0006mo-Jx for qemu-devel@nongnu.org; Mon, 12 Mar 2018 06:17:32 -0400 Received: from mail-eopbgr10122.outbound.protection.outlook.com ([40.107.1.122]:49387 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 ) id 1evKWG-0006gT-BX; Mon, 12 Mar 2018 06:17:28 -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=TuYPfy31LpFnKCTBagXVfIQ2AmtwX3iKmqaimCxvjPg=; b=DdJUk+jYO7250l4yq3yNHjl/LNHFdopa5cWKDQaPMZuzxxH8RW5Nqt7WMAw0j64hvU9UbTQSGfBteExQuEKEc7cQnFK2U4xRl2mG9ZhUtqJhCiH4uZQOT5hVUsv/SN6VC12MzsLnj2JSrAgwE9D1s2un1dhai0Qb+opw9RXt8DM= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=anton.nefedov@virtuozzo.com; Received: from xantnef-ws.sw.ru (195.214.232.6) by DB6PR0801MB1991.eurprd08.prod.outlook.com (2603:10a6:4:76::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.567.14; Mon, 12 Mar 2018 10:17:25 +0000 From: Anton Nefedov To: qemu-devel@nongnu.org Date: Mon, 12 Mar 2018 13:16:55 +0300 Message-Id: <1520849818-6915-7-git-send-email-anton.nefedov@virtuozzo.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1520849818-6915-1-git-send-email-anton.nefedov@virtuozzo.com> References: <1520849818-6915-1-git-send-email-anton.nefedov@virtuozzo.com> MIME-Version: 1.0 X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: HE1PR06CA0148.eurprd06.prod.outlook.com (2603:10a6:7:16::35) To DB6PR0801MB1991.eurprd08.prod.outlook.com (2603:10a6:4:76::8) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d16a01ae-235c-499f-80b2-08d588027438 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:DB6PR0801MB1991; X-Microsoft-Exchange-Diagnostics: 1; DB6PR0801MB1991; 3:CpwBd/+eQk9OetZfNMnnYmy/gs2VnWJ4vj0FvAkwt7pMH7l6+sg1w+0DUGxNkfSDJaGy58WNZXQDSQOTa+fIBDymFJ4zD9iuPwro9kaawiHj0beU75H0OThmP4nLt6j7lsHkOUN937yfbWfb7RcSjbx7NM5ZJRF1OjnBKBdPOhocaOjkG0celV1/C95ybQ+447BJtKbDbbbFSx/dc/XSS5i/tveFv7PveByYqaCpfwfX8n4mnViAphgqoieJmrf2; 25:BgwrKPVVFhvpR8mPKh1JjvA7XHF7g4w4UBfY/fsSgSXFt5za6wqLBTWrwlZBSqFuQsin+CguNoftN8QG9pLilWGUnJJ+lhzDCSkK5k1NnPtm76nNjxVXkEoB9zWQJRW1CR5IiPEylSkYavd84OboCb98rLvbPBVptOEjeAvD6qlxMo+0Ly5OELv25H8WMJZSjgv0ylpqqFqA1wC4DCSu9iVMm4ZlitT0Mh2MvrynjvDG+Q2XKRc2C5g3nUhFpQ0OtTPsfdtZtfxRRLRJjiOR2ZndmVUBQoG+6sSE/LMm/PVFmUFnE0AVLEGj5npdTdkigXtVd1FEzJaPjqdq3YPy7Q==; 31:3mJWDekQIK6stHYhnJfvFAtN/WhPk8Z3Y06uhFUyyeHiHwTTsa579Ye0qzNIMXPhxZv9oedAl71/7VwABh8p5lb50NKTScxu76GIczS/jgea2Wt6Db1PvK1Pa540nSrlqAQDX/txE4SBDgStdAFbFkq5hxANLzrgNv093hHoyy5O5fniG61g2wnxwUeqLOI9pxEW+ywjn1qjy7CI9flJJrefu3G7oKwBZEM6hfqca/E= X-MS-TrafficTypeDiagnostic: DB6PR0801MB1991: X-Microsoft-Exchange-Diagnostics: 1; DB6PR0801MB1991; 20:MQvroIUzvjyzm3RKUTY60ZbiueI/l3pFzuk66MF9x9LuEo/uSEDcOMC6RVxe5FoXcWAUaLyqphOZenWYEL3h13d0grXI6EhLMbIiY5zloZe6pZm4rf0ZDUhP6HEpYz2sC9QLL7KbifZUz+M7MXNPZ1E9/R6UV7MP4FxcFp9Hg4GYJTnOx5iF+MwHIsEZA7HSFCQAnCKMcgnVGpM2KgxsF6OYhr2HXrfIlmm2EGniRhuZ7d1s5FsKMbbzprnCNdBSnxcJCHDL92DAq7IgPw/Hk7ecnZrYIKuRUujWFGgmk2b5RM+EYFIj49RVocHm72I6H0ooUsa1aJkZTjI478y4d4a5SiKZeuCbVEjxWbzYMqLnARC+z8IFA+8aDBQsG0Wkru8ZGClh+Kisl/kZedPmP3Ww8fx+CkwY8BCXC3JJaqspntEovjL+UEtLYNUAl2g8Ev36cAljJJJGuQAbITzw1mRXdUEZv1alz+2kcsZcdWcAr5YU59QPDQnNRG19mprP; 4:NWAkC+IyTT667Xo8kr9QC3T2UpW9s3al/KN90mBx/IKoIoqdbkXznDzG3GSbUGjSiNdxNGN74m3wQfR/Ub7f+PdkPp3AXPy30o36cg97uJ3mJXpnDSNydAH9SB1/loS/6sXMFZEJBhB+nyxwGiOuNNVHusIqvEA/9T4Ne/SKSW+gJhM/qQ8yLD4BOdZ43cODm1WFIe4g1plg2bhEV9ZQKZb9FqzAQ+vdRb7TR0/9r1gUlAUhzoGaZlAkOdCFxwwpCRFojLs99sr/u8+vFC5NHg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(8121501046)(5005006)(3002001)(93006095)(93001095)(10201501046)(3231220)(944501244)(52105095)(6041310)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(20161123558120)(6072148)(201708071742011); SRVR:DB6PR0801MB1991; BCL:0; PCL:0; RULEID:; SRVR:DB6PR0801MB1991; X-Forefront-PRVS: 06098A2863 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(39840400004)(366004)(346002)(39380400002)(376002)(396003)(199004)(189003)(47776003)(106356001)(4326008)(81166006)(16586007)(107886003)(8676002)(69596002)(6116002)(68736007)(3846002)(105586002)(50226002)(386003)(6506007)(81156014)(8936002)(55236004)(2906002)(36756003)(478600001)(2351001)(2361001)(25786009)(316002)(59450400001)(6486002)(53416004)(76176011)(97736004)(52116002)(51416003)(66066001)(48376002)(50466002)(6916009)(6666003)(6512007)(2950100002)(5660300001)(26005)(86362001)(53936002)(16526019)(7736002)(186003)(305945005); DIR:OUT; SFP:1102; SCL:1; SRVR:DB6PR0801MB1991; 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; DB6PR0801MB1991; 23:TGDSCOJsPGApRwPrZegtpR+RkjQfzW/TELl0oTT?= =?us-ascii?Q?xM/oFGVmkm+QPKRWdLelVBSqdyfLDi3Knf11UUk1nf5EslEAW7xItp/A+QFW?= =?us-ascii?Q?hQ7AgvZmz24thPpUSgOQMadpnnn0AiMi5u7T04Pxxgs22ta8Mv5QDnEs12Ee?= =?us-ascii?Q?kFdPyP0fJWGvUoCUzftAF4wQ9GR6IvZMNSWC35AQ1h/AhgSMFSEqll7xwVSt?= =?us-ascii?Q?MBrQVGho8k8/5ntjOUscUGsHbWo4XnGPInKLYAL+kd9vcg7BrbfIpi0GC81y?= =?us-ascii?Q?UMH5JLM7HfTVKPDc6jQ9a70Vlzb7j0WNEeXOchDoN4/ZNV4ZNZXU6xQHzdq/?= =?us-ascii?Q?QOnyaWzUk6pTGH7gTm74rvAy1O1t1ZfHseaWyjJRelAmKHyIjjuQ9hQit/Xf?= =?us-ascii?Q?IpMv+dYN5eW2p7CYMO3ax/8+dGeAzoRRgNLAB20IsBZftJoVVdCjilGAm2EB?= =?us-ascii?Q?w6vD9n9Q9QQ4D5XifgqArs82Q4xGwotfIqUaCYICAO40qQpfRu2+56RDqHig?= =?us-ascii?Q?kLVX8xK8yqOjz4UBWaSFfT23FrOdUnPc3yvCoDus2zS/AVgk+7A/CmK/MhhE?= =?us-ascii?Q?ubZGzyB+h5BdykeQMk05hB6Mu2pmcHvWU2N07mS8NaSL13IO9HvZ+21z8BWh?= =?us-ascii?Q?C09LkX4uxBrSZKzwHIkPWgxZK/kB5T9HiGt1fA5t4OdUokXCp4OL5Ehj+C3T?= =?us-ascii?Q?rh2G/Tz1UtaNKa1wAfCB4K1XePU5GRNLi8BpC6pAJAKRvs296v42n8ds2tJ6?= =?us-ascii?Q?SfgvNWOXqfUlYu2+tbABkNmdX4Q4F8LnIStM9VYwOVitnN4sGUoZUROvyes3?= =?us-ascii?Q?kIGc8D+xHSZZmfFIQp/mCYYwND8qJbGrTW3MZZrgt6KHMASZi8B929jhCLAo?= =?us-ascii?Q?WWZQ9TNAiBihu3bj8hKMXtChbT/LWkAIJC73mElnBFATYTl9bzXkynlNoXec?= =?us-ascii?Q?8L1utV8YhXYz/Zs53RjrPPsJIyyGs08SgNSdNWJo15QUET9SV2q/B+xvB2Ey?= =?us-ascii?Q?zUOqUBxnziHqnDl4b+u3/BBzRLePz68s4ESHKpnSxCegb8XL09tGpTIRNrZc?= =?us-ascii?Q?u1/llR93mdtn2yisLddAjo0vVXsNstPi4Inp3sxDcrpq/AAcoFZrWqy21eNV?= =?us-ascii?Q?x7Eh1XRQGBheMCOwNg2cM96AxKqnUnF7lOMurQAF/elg5JPlK1Vaae4CEHXq?= =?us-ascii?Q?iJYlqv7Pm92x2uztsW/+BbINx/aNgd+/zkPwnrlvnWVleUsl04uO6j0po4FW?= =?us-ascii?Q?KznRAfg5+lYGHDk/D7lA=3D?= X-Microsoft-Antispam-Message-Info: lAe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DfORZBWAIZGrHnDI7gzawvJunOvOhQ8MlPe+Pv2Yy/eP7o8TYR1hZ8H+uireKgczdQSUYU SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DB6PR0801MB1991; 20:xVUyo40zA8SN13s6rHIPg/if5qshqCsleJvQ3mz+gsrrXQKM6WcBSQIbev8y2lDVwNjdryLmfYIvS3Dmu3pY6FN/8j7HPwp+PAYFw2Oh8JAaROcCGWyXPDdjfJcsxqbphXpv90iHnICqoAkluL4spQru69HsVzsuVDiI2gs3xqM= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Mar 2018 10:17:25.6308 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d16a01ae-235c-499f-80b2-08d588027438 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0801MB1991 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.1.122 Subject: [Qemu-devel] [PATCH v8 6/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 | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/block/file-posix.c b/block/file-posix.c index 7f2cc63..2136df9 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -560,7 +560,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 @@ -595,10 +598,11 @@ 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 - bs->supported_zero_flags = s->discard_zeroes ? BDRV_REQ_MAY_UNMAP : 0; + bs->supported_zero_flags |= s->discard_zeroes ? BDRV_REQ_MAY_UNMAP : 0; ret = 0; fail: if (filename && (bdrv_flags & BDRV_O_TEMPORARY)) { @@ -1416,6 +1420,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;