From patchwork Tue Dec 18 07:57:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Nefedov X-Patchwork-Id: 1015112 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="hAogNuEy"; 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 43Jr4z5xgKz9sBZ for ; Tue, 18 Dec 2018 18:58:59 +1100 (AEDT) Received: from localhost ([::1]:52356 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZAHJ-0007AX-E6 for incoming@patchwork.ozlabs.org; Tue, 18 Dec 2018 02:58:57 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47621) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZAGE-0006Uc-2G for qemu-devel@nongnu.org; Tue, 18 Dec 2018 02:57:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZAG9-0003j0-Qp for qemu-devel@nongnu.org; Tue, 18 Dec 2018 02:57:49 -0500 Received: from mail-eopbgr140100.outbound.protection.outlook.com ([40.107.14.100]:48750 helo=EUR01-VE1-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 1gZAG9-0003hI-CJ; Tue, 18 Dec 2018 02:57:45 -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=8kfLkwCBXcrR83664LT4qnS8U2O5hor0dgtJhUZP0Jg=; b=hAogNuEyx2Tgj+kbfXQU3qTv4i8TBTDtm9hEBhmT8A45fDvyBkxuZonqsHH7iu44OPLUPAWg/me6w0NKEy3NsVWpHuPdDwrIVmyPCzc/P8wK86C9e5/rLC+qwD+49kKS1IP5liISkeqUfRwjTM8u4RkLplaysn5N4F2H30LwgPo= Received: from AM0PR08MB3347.eurprd08.prod.outlook.com (52.134.94.148) by AM0PR08MB4289.eurprd08.prod.outlook.com (20.179.33.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1425.22; Tue, 18 Dec 2018 07:57:42 +0000 Received: from AM0PR08MB3347.eurprd08.prod.outlook.com ([fe80::cceb:42e9:4742:393]) by AM0PR08MB3347.eurprd08.prod.outlook.com ([fe80::cceb:42e9:4742:393%2]) with mapi id 15.20.1425.023; Tue, 18 Dec 2018 07:57:42 +0000 From: Anton Nefedov To: "qemu-devel@nongnu.org" Thread-Topic: [PATCH v11 07/10] file-posix: support BDRV_REQ_ALLOCATE Thread-Index: AQHUlqdahHcZCREVxUusJk+nQCMLSQ== Date: Tue, 18 Dec 2018 07:57:41 +0000 Message-ID: <20181218075707.12006-8-anton.nefedov@virtuozzo.com> References: <20181218075707.12006-1-anton.nefedov@virtuozzo.com> In-Reply-To: <20181218075707.12006-1-anton.nefedov@virtuozzo.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1P191CA0007.EURP191.PROD.OUTLOOK.COM (2603:10a6:3:cf::17) 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; AM0PR08MB4289; 20:Jrjo0VcFIfkAiOnYR2dBtC3mXyy7E2zUllg+feXcwk3P2TqCYIEksaE52qoowXvj+PXbXVixZa4vYdvlFCuwIjqmLNiv1sQi76vikAz1yE5m5PYiMiwIR4qjUaM1AiMUqkUNAHY0+cc3jFTEeg6qi0mRbNvwznRva/OgNplhC8A= x-ms-office365-filtering-correlation-id: 88eb6799-42df-4863-c91a-08d664be7ca5 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:AM0PR08MB4289; x-ms-traffictypediagnostic: AM0PR08MB4289: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(3230021)(999002)(6040522)(2401047)(8121501046)(5005006)(3002001)(3231475)(944501520)(52105112)(93006095)(93001095)(10201501046)(148016)(149066)(150057)(6041310)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123564045)(20161123560045)(201708071742011)(7699051)(76991095); SRVR:AM0PR08MB4289; BCL:0; PCL:0; RULEID:; SRVR:AM0PR08MB4289; x-forefront-prvs: 08902E536D x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(136003)(366004)(39850400004)(376002)(346002)(396003)(189003)(199004)(5640700003)(6486002)(25786009)(53936002)(68736007)(97736004)(2616005)(6512007)(476003)(446003)(99286004)(4326008)(2906002)(71190400001)(76176011)(305945005)(186003)(1076003)(11346002)(7736002)(486006)(71200400001)(3846002)(86362001)(6436002)(478600001)(81166006)(54906003)(386003)(6506007)(81156014)(14454004)(105586002)(256004)(102836004)(2351001)(316002)(6916009)(6116002)(26005)(14444005)(106356001)(107886003)(8676002)(2501003)(52116002)(44832011)(36756003)(5660300001)(8936002)(66066001); DIR:OUT; SFP:1102; SCL:1; SRVR:AM0PR08MB4289; H:AM0PR08MB3347.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: HXosbFSD3WqobXumuL9vtS92Ay7WL9kOeRCfuoYePMUwAArPkho++oH8v61SfEH38ZfWRFwv2tQPhzLMVryT4zO2cDVx23xXw1bbaZGlylEUd4rYlPt/CpbO1ICPapnRfPoVQVN54va6JTQUb9qFwWy/z5vOvDCI5iE3PsyvlaiBGJBHbTdsbK97sOyEjE2j07KMJMCHnaemthwmV5C+8j/olAC3+YlL7LXddeSHTlIbS2afnAzuYJbqILgoICdhOAQ+9b/ybh7AL3pxPdSjdTs9q/2WAAGUC0q5jXQdi3PmkPwftu/e8rVRi8UdQivh spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 88eb6799-42df-4863-c91a-08d664be7ca5 X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Dec 2018 07:57:42.0432 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB4289 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.14.100 Subject: [Qemu-devel] [PATCH v11 07/10] 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: Vladimir Sementsov-Ogievskiy 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 a65e464cbc..c3fbf53853 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -607,6 +607,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))) { @@ -650,10 +651,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)) { @@ -1552,6 +1554,10 @@ static int handle_aiocb_write_zeroes(void *opaque) s->has_fallocate = false; #endif + if (!s->has_fallocate) { + aiocb->bs->supported_zero_flags &= ~BDRV_REQ_ALLOCATE; + } + return -ENOTSUP; }