From patchwork Mon Dec 3 10:14:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Nefedov X-Patchwork-Id: 1006772 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=virtuozzo.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="DPt5hy7i"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 437gr362DZz9sDF for ; Mon, 3 Dec 2018 21:16:03 +1100 (AEDT) Received: from localhost ([::1]:47750 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gTlGj-0002TF-9c for incoming@patchwork.ozlabs.org; Mon, 03 Dec 2018 05:16:01 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39249) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gTlFt-0002KG-Ro for qemu-devel@nongnu.org; Mon, 03 Dec 2018 05:15:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gTlFs-000509-0I for qemu-devel@nongnu.org; Mon, 03 Dec 2018 05:15:09 -0500 Received: from mail-eopbgr00107.outbound.protection.outlook.com ([40.107.0.107]:40233 helo=EUR02-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 1gTlFq-0004r0-7B; Mon, 03 Dec 2018 05:15:07 -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:X-MS-Exchange-SenderADCheck; bh=YGjizEy/GB3PF7s/S5Vc4NZWHXtHRI7KXMAxZnjO8NY=; b=DPt5hy7idnqdyZSNAJVp6Qc0r7HN9ZVywZVeEFQIXBMnQcQXm7hOBuuie/2VCW5IESkayOSKL+Y2D/hI7pU39ltQrgoOtInOW1u2bZVEdjMWobXoaCQyqCY5qbOmGcoBEZ6kKKb510KCPA7rRVdmS98BDHZRMDzu76Nt+C65G4E= Received: from AM0PR08MB3347.eurprd08.prod.outlook.com (52.134.94.148) by AM0PR08MB3875.eurprd08.prod.outlook.com (20.178.82.87) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1382.22; Mon, 3 Dec 2018 10:14:58 +0000 Received: from AM0PR08MB3347.eurprd08.prod.outlook.com ([fe80::a0bd:dda4:d9e4:1d01]) by AM0PR08MB3347.eurprd08.prod.outlook.com ([fe80::a0bd:dda4:d9e4:1d01%2]) with mapi id 15.20.1382.020; Mon, 3 Dec 2018 10:14:58 +0000 From: Anton Nefedov To: "qemu-devel@nongnu.org" Thread-Topic: [PATCH v10 6/9] file-posix: support BDRV_REQ_ALLOCATE Thread-Index: AQHUivELwkWpGqFhVEGjIAvGeleILw== Date: Mon, 3 Dec 2018 10:14:58 +0000 Message-ID: <20181203101429.88735-7-anton.nefedov@virtuozzo.com> References: <20181203101429.88735-1-anton.nefedov@virtuozzo.com> In-Reply-To: <20181203101429.88735-1-anton.nefedov@virtuozzo.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR0301CA0004.eurprd03.prod.outlook.com (2603:10a6:3:76::14) To AM0PR08MB3347.eurprd08.prod.outlook.com (2603:10a6:208:5f::20) authentication-results: spf=none (sender IP is ) smtp.mailfrom=anton.nefedov@virtuozzo.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [185.231.240.5] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM0PR08MB3875; 20:RXRmoI42VbKv3t3L8xsNCvTZ54Im5fMZtYVIAWIgakil0vu16KB/YkazWUdN6jVMDCVtEl12vwZn41LGU7ltFjRVN2j2k4O+22ygoiCVtUc2ipgKbTTLZf/bNbPcGHAAlsVPeOjH965aEUvA2gIsCWSNRcsaoX8Ugm5/rmWVa1E= x-ms-office365-filtering-correlation-id: b89fb5a2-1376-4611-ed22-08d659082d87 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:AM0PR08MB3875; x-ms-traffictypediagnostic: AM0PR08MB3875: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3231455)(999002)(944501493)(52105112)(3002001)(10201501046)(148016)(149066)(150057)(6041310)(20161123558120)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(201708071742011)(7699051)(76991095); SRVR:AM0PR08MB3875; BCL:0; PCL:0; RULEID:; SRVR:AM0PR08MB3875; x-forefront-prvs: 08756AC3C8 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39840400004)(376002)(136003)(396003)(346002)(366004)(199004)(189003)(305945005)(5660300001)(7736002)(106356001)(68736007)(2906002)(105586002)(256004)(14444005)(6436002)(2351001)(6486002)(71190400001)(71200400001)(6116002)(3846002)(4326008)(36756003)(6506007)(186003)(476003)(25786009)(102836004)(2616005)(478600001)(76176011)(14454004)(486006)(53936002)(86362001)(575784001)(44832011)(99286004)(5640700003)(26005)(107886003)(6512007)(386003)(66066001)(316002)(8676002)(54906003)(11346002)(446003)(81166006)(81156014)(8936002)(2501003)(6916009)(52116002)(97736004)(1076002); DIR:OUT; SFP:1102; SCL:1; SRVR:AM0PR08MB3875; H:AM0PR08MB3347.eurprd08.prod.outlook.com; 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-antispam-message-info: wBXoubnm0XOwvtdmIl/sEyo4nCzU9tCbTnsQboo/XEgpPy+oe5mT9v1IkW5a/EH02RSZT7UQ82qi9d14r/HRqEjQIZedzIUfe/AiFiGDl8bd6f+65AdBXLjNek4a3CLN0CcvS13B7wFOefb2pvH1s9VuMMpuGnlSGcRejfMDojzwTVI/+b33EUnCBTv74+tcG64G6+4Ht83ImcI35s5EnidgE4/fWeJv1K5NM8E7Vz2p/BIKoqoqWK8dmzhUhLawlpw/L1O3kgilHFZfFVAlAvDLEpMyGJ3rmQKkGhGApg6FYWEm/CCYrOetkdHI1Vpl05QBU1+Y0LGVGSWytYdz3fzSPh4UUOPeaieG3vSV6Xw= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: b89fb5a2-1376-4611-ed22-08d659082d87 X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Dec 2018 10:14:58.1089 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3875 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.0.107 Subject: [Qemu-devel] [PATCH v10 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" , Vladimir Sementsov-Ogievskiy , "berto@igalia.com" , Denis Lunev , "qemu-block@nongnu.org" , "mreitz@redhat.com" , Anton Nefedov Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Current write_zeroes implementation is good enough to satisfy this flag too Signed-off-by: Anton Nefedov Reviewed-by: Alberto Garcia --- block/file-posix.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/block/file-posix.c b/block/file-posix.c index 07bbdab953..b0b7ab0159 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -603,6 +603,7 @@ static int raw_open_common(BlockDriverState *bs, QDict *options, } else { s->discard_zeroes = true; s->has_fallocate = true; + bs->supported_zero_flags = BDRV_REQ_ALLOCATE; } } else { if (!(S_ISCHR(st.st_mode) || S_ISBLK(st.st_mode))) { @@ -646,10 +647,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 = BDRV_REQ_MAY_UNMAP; + bs->supported_zero_flags |= BDRV_REQ_MAY_UNMAP; ret = 0; fail: if (filename && (bdrv_flags & BDRV_O_TEMPORARY)) { @@ -1520,6 +1522,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;