From patchwork Tue May 8 14:58:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Nefedov X-Patchwork-Id: 10386321 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 C673D6037F for ; Tue, 8 May 2018 15:04:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B2E8E28793 for ; Tue, 8 May 2018 15:04:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A768A28E74; Tue, 8 May 2018 15:04:28 +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=-7.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, MAILING_LIST_MULTI, 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 7164128793 for ; Tue, 8 May 2018 15:04:27 +0000 (UTC) Received: from localhost ([::1]:51660 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fG4AE-0004ZA-Go for patchwork-qemu-devel@patchwork.kernel.org; Tue, 08 May 2018 11:04:26 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47855) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fG44j-0000Fj-7j for qemu-devel@nongnu.org; Tue, 08 May 2018 10:58:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fG44f-0001Wt-2m for qemu-devel@nongnu.org; Tue, 08 May 2018 10:58:45 -0400 Received: from mail-db5eur01on0131.outbound.protection.outlook.com ([104.47.2.131]:52409 helo=EUR01-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 1fG44e-0001Vh-Op; Tue, 08 May 2018 10:58:41 -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=Ehh60Q70L/A0ILdH36kapKAGFRGNvBi+BTLFX8+Tk+8=; b=Tini+DBE0Fin5QbBNPELUDWcaldxOcp3+KXZyH4xgViWX2F2CCGPc7NtcaYXpggOkZ2EKrGjfoG4alDTjjXTsZ2QTaVyABVDkOkwOSP1hlqUkTz2S10tOlQgq8Hd1uCFMf5qEM1lWNt1VjnqZMr0fH9Vb0RD5ab3id0vX53XMCc= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=anton.nefedov@virtuozzo.com; Received: from xantnef-ws.sw.ru (195.214.232.6) by AM0PR08MB3347.eurprd08.prod.outlook.com (2603:10a6:208:5f::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.755.16; Tue, 8 May 2018 14:58:37 +0000 From: Anton Nefedov To: qemu-devel@nongnu.org Date: Tue, 8 May 2018 17:58:10 +0300 Message-Id: <1525791496-125188-4-git-send-email-anton.nefedov@virtuozzo.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1525791496-125188-1-git-send-email-anton.nefedov@virtuozzo.com> References: <1525791496-125188-1-git-send-email-anton.nefedov@virtuozzo.com> MIME-Version: 1.0 X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: DB6PR07CA0020.eurprd07.prod.outlook.com (2603:10a6:6:2d::30) To AM0PR08MB3347.eurprd08.prod.outlook.com (2603:10a6:208:5f::20) X-MS-PublicTrafficType: Email X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(5600026)(2017052603328)(7153060)(7193020); SRVR:AM0PR08MB3347; X-Microsoft-Exchange-Diagnostics: 1; AM0PR08MB3347; 3:sgNlifN39KuSSdfeU9sm+cLOrH3cE/odI0dUU2vBbaIhTJq+lKoRrxZngm4irTuGNGfXGam7Wxex0jErB0VwiJJfO2p85WxPQ/5PL36WhkcqZYD3XesR+Ji1CPZFji9HwnCK6LWDLy2EiVcWIq2a1f0SNRGbJ/1R2j/em3/NJMpUt92C8aUkkvNwSURc9nvj82KYM4+yqg4ll7UiGHNlyx/3ptRtWMneH6hOSanTW2978l4jI/8P+VObwGocJxYP; 25:7+5pyzIkHW66OKzRUggg8JNJeDXR0ZXIUxqGByW2JzQuLukPnT38pbpnsnHIeESIVFhc4csQZsKagab03SaYm2rTsfd794LpfTr/iQt+R01BRtKg4ftBkEggaPVbF7FpQnrfG90KpZrhj8TVcRcF5XUsOPrYkWhSb6iKz8hIppBdEmd5kuz9gIll3eJLbrfxrz3cCNdx2hvINi+Wbq/WekVaeCTfGhOr3OIoPqm63wElDdEEykJzh5y3To51783rVUE0qbsKAhTJ9xIMClRFkGyPiSJte9nPM3acohJrPN4FFqthQ11ijl3pk7KMd1GBRv6z/3PPqBBtomFHWYKcTw==; 31:mAoQhC7SOOSDQNoqX3CMq/iuOcyGP+SqRgpuStaUyIcZ9mqMYNFXPvMiES3DbVs+Gws6KNFrf6ZC+Xp4S/I8yBqguQVSfgVeYDe2yMvrTybybkRA1ekZqmLuVaCWG+930fjGWZA2smD39/tT+ys89dulGs4tfxFelywBDUAvy3RE6tgMxHnbm8Wp7agxFhxFaBIFVNHZ8mBES9PlFkcrcbsx/RDgkKzywJht5kHS5yw= X-MS-TrafficTypeDiagnostic: AM0PR08MB3347: X-Microsoft-Exchange-Diagnostics: 1; AM0PR08MB3347; 20:GQsnKUqvn6bMKk09aYaiAG5rPxyZfFhtWwMQKUyhgsIX0FR1JYgDVKySCweJOj9VOawLJOBah8NSa+K9WAdThejS+LImqc/sJoLGcS+DrG1yUYSDlbJ9IOie6bFZVrzl5/1NmfGaShxoZoLAaPEKOULKzEtpra/eJYP+KHvRdpknw91AezJGoy4JDRsBShfWPQX+0HV/qrwK0yanN6K4tlyi+rqwfC+0Am1I+/F7ebLDgrKygQJE9rfsM4UEAb6FARGSEIbEK3GGYFMmDlPzOtxjwH+0yByYGvLzT416rj7zSQRdkgoe5GCib85uBBePMW9/eBf8ezzpUY2YXf3PYKpm1vrxQfxlhN5IVwO2/bVdcWSEoP0CyiWN4ztWlxiqe9dTpr5Pw7N28g7DLZ/Z6vuFo01R9/JGNRoXSE97s8HdFpZD0ZG8v7cXIngYq3/Gyh4hwaD9voNBxmHNNjVmh4u3JKx1stU7zJEbNclG7iXbPKQ+v97nf3sh47Yr0Q8f; 4:wnmZi9jqCzgfjf/IOkU/W5rCcFp4AztulvemzC03odAyJO1l1xcPDkkLXjKyuEYtdZTU0VD6Wddwnvgh7+0UVcKdO3x1mL2u3Nfmhn6+iKEea6HfrnEt+W0KknbEwlLGkJNyQk6lucd3MIudixzEcv/QzJme/yN50+KN9FKN3l7ksWP2v9BiKQl4kVP9CoS1qOHdL1pQE5cOQ1Fwvb0Bs7gj00a87WNiPOrvwyUR5PBbqjgPqdhhWgs0abjPVHmLxgXJedxmrplcDLJXqe3v7g== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(5005006)(8121501046)(10201501046)(93006095)(93001095)(3231254)(944501410)(52105095)(3002001)(149027)(150027)(6041310)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123564045)(20161123558120)(6072148)(201708071742011); SRVR:AM0PR08MB3347; BCL:0; PCL:0; RULEID:; SRVR:AM0PR08MB3347; X-Forefront-PRVS: 0666E15D35 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(39850400004)(366004)(376002)(396003)(346002)(39380400002)(199004)(189003)(5660300001)(6486002)(81156014)(8676002)(81166006)(97736004)(2361001)(6116002)(3846002)(2351001)(446003)(2616005)(44832011)(16586007)(956004)(486006)(316002)(305945005)(476003)(86362001)(11346002)(25786009)(68736007)(6916009)(6666003)(36756003)(69596002)(51416003)(66066001)(47776003)(386003)(6506007)(52116002)(8936002)(26005)(53416004)(55236004)(76176011)(105586002)(186003)(106356001)(16526019)(107886003)(53936002)(4326008)(7736002)(50226002)(50466002)(48376002)(478600001)(6512007)(2906002); DIR:OUT; SFP:1102; SCL:1; SRVR:AM0PR08MB3347; H:xantnef-ws.sw.ru; 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-Exchange-Diagnostics: =?us-ascii?Q?1; AM0PR08MB3347; 23:j8QoSZ1JzlBhvcH6Zve5tturuRE03OV/umOlC9mXm?= =?us-ascii?Q?1TlZDxZvBq/Xfa+I86DFa7jUywpHHgB83NccVQbUCSS9yUUAUFFKt3y0LDV2?= =?us-ascii?Q?NU8EJlgVi9fTt+C0Xg1nQ0ymHXy/6mG2VaWaXLvHflEvPzAivVBAbbezh9CE?= =?us-ascii?Q?DTjLXTi+LkuBsir5yt2i0i3MnBkZmOf6jzDJfVTOUUv6/rYTywvdqmXSfAuU?= =?us-ascii?Q?96hKW73boGcQ9mawDq57NSER1dITETsJRSAOwnB2kgFxzFjkaGJ0XM1pZeV3?= =?us-ascii?Q?scA6Ry9As0qb6gEIrsOi82TLQsw3xjpv/XIQF++7KduYiNdIrpKNJVQ7nLyH?= =?us-ascii?Q?rszimoUqsMqPhyKwgKlmjAHmbORvgpLALEFLQ2omoHXsuAT95XdnEMzZIhq3?= =?us-ascii?Q?iav5oyceK5qVo4gcJSVzKJqoLu6SgDQVEb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h7FKz2Oo/YyDkEWlKC8sA=3D?= X-Microsoft-Antispam-Message-Info: 3QbrHgFNwtbRpEhSRL+jbpNEfQrRbuRynaxvc+igYd4t/uHlWCmyneexq+MPTB6N95GFVP2V0nvLmVuufvMLjMTsJLeyvFA9ctw1ELRi/maaUygxZ/vQx1BysThNdDNSXavwLg6oV0KdzMYaykvGlEs+DybjvM+qJPUWwZxP31dAWHlxhR6ob3s3zKhvnQKb X-Microsoft-Exchange-Diagnostics: 1; AM0PR08MB3347; 6:iEXmS1i1fyZINggpBtJpZ8jWhvEcTKT2X97F+WDHhyLDnEx1ubqdJWp5htzmqOpb7qf3VkK6a8WPuC7VbIEug6/3JGJmAYtNpiu7+99HFzLs3UJf7XpFnx5qjacTp280XVMlw2405tMGpzoN3/IYVyPmCZLtycalmMvgjXMqZyPKOujnDpmB7J0RVOGXl5TLdu9iR5ARwIIpEW/AANSvl+1lVfuyjBrawEiR7DJMqFXUEO5RiF59rcQhiqlqWNdhl7e7yfefogQUTbw57Tvx1SMB/wsT5Z9d+u0YTT9OX5NZ1+31SnMjq98LCj9wPYzd9H1XYzGVxBhLWF8KfE0fjckHHhBZTUFNkq9WWgLyVveg4TEJpMCqsm+RJf+EYCZCoEXaoUyk/BeTkXprnj24J1Mo8FOt7Tc6qftvsYFPjECeVg5DIII5toTJCnHgwehlU7by6p4VxwaOJjUr5+wiLw==; 5:bk78V+GTIhzm5JsO4A5WX9lHx62T0y7Lo8wMNIq2Zi34vkGDnjZqjjXbdf1nUfCfFMsVlRic4p4HrkbfmBGZqsmd5VmhprWQmkJzzJQ7rqeJ/1KCXW57MNsR4DAuTTTQArXl0joFeG8JE35W1WHdB2TW1cYCbi6mu5+fYQBfGk0=; 24:uvLTiET6vdw9J98h1H/MS8L+bi+ovz7LVTLvwSX9wO1TkniDSEz1E97fOrmxG/xPMlIRReTgUYrs2MJYagVxrVGEtCcduINRgxS0N16gR1g= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM0PR08MB3347; 7:3ZSPx+xQlyr3bNoHf80vffdVi/SE+hiC3mDe77ngWauIYQjapua0+WtoUtAvryMRcEffTGlgzFsdIVXuRXPN0D1su60NnLclusurOnTCEFM6qqjoYNRODGZ9ACyr8VRVyxc3cBgtFbSwMz51wdQNuBG55TGTI3+/mPJwGdTjsilZN33gLktlo/hDct6NfKSkr2ORs3BLJQSyAS7gvo64UcXSfpkGBjZWxEyEA8kzdcIkF4TARWOVvfsDLMLTUImv; 20:VKERQNACf5Q/Mw+/w/mW80QlUg9XiOZz9Hz2b84/G4NSFQ6ugKsaaZmBlNWyp/zqgjUIDt9Vo0a2PAtGLaZp7izIvkss58NFtvAZZs9MZ2VxBC/rUahDG7GXnWVVzzkMctuA7JnYaeuCRrJtdoRzlnBq6uDip9JPlfGKgyzkfbc= X-MS-Office365-Filtering-Correlation-Id: f3de9b61-75e6-41a7-1b6d-08d5b4f42e62 X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 May 2018 14:58:37.8182 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f3de9b61-75e6-41a7-1b6d-08d5b4f42e62 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3347 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.2.131 Subject: [Qemu-devel] [PATCH v9 3/9] quorum: set supported write/zero flags 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 Signed-off-by: Anton Nefedov Reviewed-by: Alberto Garcia Reviewed-by: Eric Blake --- block/quorum.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/block/quorum.c b/block/quorum.c index a5051da..26e7d78 100644 --- a/block/quorum.c +++ b/block/quorum.c @@ -867,6 +867,20 @@ static QemuOptsList quorum_runtime_opts = { }, }; +static void quorum_set_supported_flags(BlockDriverState *bs) +{ + BDRVQuorumState *s = bs->opaque; + int i; + + bs->supported_write_flags = BDRV_REQ_FUA; + bs->supported_zero_flags = BDRV_REQ_FUA | BDRV_REQ_MAY_UNMAP; + + for (i = 0; i < s->num_children; i++) { + bs->supported_write_flags &= s->children[i]->bs->supported_write_flags; + bs->supported_zero_flags &= s->children[i]->bs->supported_zero_flags; + } +} + static int quorum_open(BlockDriverState *bs, QDict *options, int flags, Error **errp) { @@ -961,6 +975,8 @@ static int quorum_open(BlockDriverState *bs, QDict *options, int flags, } s->next_child_index = s->num_children; + quorum_set_supported_flags(bs); + g_free(opened); goto exit; @@ -1029,6 +1045,8 @@ static void quorum_add_child(BlockDriverState *bs, BlockDriverState *child_bs, s->children = g_renew(BdrvChild *, s->children, s->num_children + 1); s->children[s->num_children++] = child; + quorum_set_supported_flags(bs); + out: bdrv_drained_end(bs); } @@ -1064,6 +1082,8 @@ static void quorum_del_child(BlockDriverState *bs, BdrvChild *child, bdrv_unref_child(bs, child); bdrv_drained_end(bs); + + quorum_set_supported_flags(bs); } static void quorum_refresh_filename(BlockDriverState *bs, QDict *options)