From patchwork Wed Jan 26 09:04:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 12724755 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E855DC63682 for ; Wed, 26 Jan 2022 09:04:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238738AbiAZJEK (ORCPT ); Wed, 26 Jan 2022 04:04:10 -0500 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:42199 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231286AbiAZJEJ (ORCPT ); Wed, 26 Jan 2022 04:04:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1643187849; x=1674723849; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=rouKWkkQcl8ZIGdzy28HeaX/ROOskNgeXm0BKf5wDOE=; b=CzQXr4QamOExjemmu/rDz7nt4LecWz/f6ADySmn5jsKFK/Xj5wCO/eHU /6gW/8M2N6ykwVprVZTXGGlM8zRrgTb4VvWeOdLtbO99FxFOnfHh9HJJR tl4cvsZTp9lGmmgh7HKLxP0k0Wr34GOLYXGHNop5pxw0hW7ohgsj+iyz1 7zW0HnyHWC6c6yfgliNOdLay3WkYZCsec6+8a1xT6nbTMAs1MIDaBZBRn 7uyhczpffqPv2spWLiu2Lz+pELiayEidMcZxiMsompbAIJWU32OaDsgaO M4yFpuppwhEnfP1z2l9ev2byg5vMYuV1zvHSI66obBpkkBiJwAwZEoMMF w==; X-IronPort-AV: E=Sophos;i="5.88,317,1635177600"; d="scan'208";a="190359871" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 26 Jan 2022 17:04:09 +0800 IronPort-SDR: Pe+PpOLVz9YZ8EFNdJGNb2BXWxnV5gMcCiLwAqgQa0HQKRtiRCNTZCdOwROZcOAflxVwgRIb6q 9arTXHFV2IvQbw157seH8LmFbXj2YhQfgaz89QJkGq1dYADN2bvb6GoIpt2vnsaT6Si8G2styO L40K/V2rkLsJ1Ldm4Ch/WbbwGDFtL0iDxo4u0if5GDb4jG38ocaUHQbxJSm2TdxdaYaw14YzQG N4xPeuJMFe5sz4QNn4OATl1efnQIrjMWgYnwzEdye3AFlwXTAzgmZsmvIcAw8B2FuPbwO6IjGv /VVthHicy+vh6dGlZXlOjMtA Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jan 2022 00:36:14 -0800 IronPort-SDR: b6o7RyzFnhUYFPtr06yBmAsdW570Q+AngvsuxMXHnzmrSjuYxvdIYRsjRBeOkXJQE6NeD8Lvfj 1y+KCwbnm47FeeYaf6ao2yeINBmoum+JOjm0MGgAYlocXSG3pA4AvD/N6gr6p85bmc+5h7w+TS eTnirfwAeNuHkuLNoOvA+pKvk2zfx1ffm/eYoO9QkEcRn+TMVm7vRuznWrGtQ0efDHkn9QGzmR Qo3Cii4nJP9BxqcanHuiu0IAyln3LIPkXBNTGO4JeysB5chz45HDDFoxdne2URG24BbrGbTqxi zIo= WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.72]) by uls-op-cesaip02.wdc.com with ESMTP; 26 Jan 2022 01:04:07 -0800 From: Johannes Thumshirn To: David Sterba Cc: Johannes Thumshirn , linux-btrfs@vger.kernel.org Subject: [PATCH 1/2] btrfs-progs: use profile_supported in mkfs as well Date: Wed, 26 Jan 2022 01:04:02 -0800 Message-Id: <20220126090403.57672-2-johannes.thumshirn@wdc.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220126090403.57672-1-johannes.thumshirn@wdc.com> References: <20220126090403.57672-1-johannes.thumshirn@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org Currently we have two places checking if a block-group profile is supported on a zoned device, one in mkfs/main.c and one in kernel-shared/zoned.c. Use the one from kernel-shared/zoned.c in mkfs as well, unifying all checks. Signed-off-by: Johannes Thumshirn --- kernel-shared/zoned.c | 2 +- kernel-shared/zoned.h | 1 + mkfs/main.c | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/kernel-shared/zoned.c b/kernel-shared/zoned.c index 776576bc6c77..e6fd4b31b9d6 100644 --- a/kernel-shared/zoned.c +++ b/kernel-shared/zoned.c @@ -808,7 +808,7 @@ out: return ret; } -static bool profile_supported(u64 flags) +bool profile_supported(u64 flags) { flags &= BTRFS_BLOCK_GROUP_PROFILE_MASK; diff --git a/kernel-shared/zoned.h b/kernel-shared/zoned.h index fbe9df8d9506..eedf20a79a6b 100644 --- a/kernel-shared/zoned.h +++ b/kernel-shared/zoned.h @@ -118,6 +118,7 @@ static inline bool btrfs_dev_is_empty_zone(struct btrfs_device *device, u64 pos) return zinfo->zones[zno].cond == BLK_ZONE_COND_EMPTY; } +bool profile_supported(u64 flags); int btrfs_reset_dev_zone(int fd, struct blk_zone *zone); u64 btrfs_find_allocatable_zones(struct btrfs_device *device, u64 hole_start, u64 hole_end, u64 num_bytes); diff --git a/mkfs/main.c b/mkfs/main.c index ce86a0dbdf42..78a5e8a0888f 100644 --- a/mkfs/main.c +++ b/mkfs/main.c @@ -1334,8 +1334,8 @@ int BOX_MAIN(mkfs)(int argc, char **argv) if (ret) goto error; - if (zoned && ((metadata_profile | data_profile) & - BTRFS_BLOCK_GROUP_PROFILE_MASK)) { + if (zoned && (!profile_supported(metadata_profile) || + !profile_supported(data_profile))) { error("zoned mode does not yet support RAID/DUP profiles, please specify '-d single -m single' manually"); goto error; } From patchwork Wed Jan 26 09:04:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 12724756 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A76F9C28CF5 for ; Wed, 26 Jan 2022 09:04:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238739AbiAZJEK (ORCPT ); Wed, 26 Jan 2022 04:04:10 -0500 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:42199 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238735AbiAZJEK (ORCPT ); Wed, 26 Jan 2022 04:04:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1643187849; x=1674723849; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=buyDLja0gBK2FizwtvRYNsG8yQHYxk4n0K99c+xIbl4=; b=dJNDUall10JgFlpeog7h1nXsfmwE/22pxl1r07mivBA+YdQfBD9S1OWr Kr+Jwykt2HJCZfvJC8C1TAkjL5iEaVnYihd0CZOOye26yhfxpKBv9DYCR elle4820aI4f7UJaNAfzueRejG7fYsBbZToI1zoA6O3cYTNdapAUh1PjF L+Lngeoif5i2oDQszO94KQaPYHyUUxcoxgEwJy68FLTl0fbqv8cy6+Sq/ 9iE/nzuZ6MEKftpoKq2KPi40DEXp1mk+fJl6HDzOmvVCeLh5fi2W5YEFU cXQ/eQsAV1dwBDkcYYWQnqjWMatz3GKvx1XwO1sKsrpveJYc+LgtTiB+r A==; X-IronPort-AV: E=Sophos;i="5.88,317,1635177600"; d="scan'208";a="190359872" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 26 Jan 2022 17:04:09 +0800 IronPort-SDR: MfEdpfWuG8+bs3YIup4UN1lIQY/PrUs5csf90GjLFMOUbYYqntbcMuHOcXTKUe2pTNshtL1cE3 8TM8VaBFUdiwp39P8FZcP3ZyXm9N/D55lGEMe9VvJCCiXLs76ykNgKKQGbLdmGjlwedyszjjJu 9C1RLSKaB74F8xIat4kPbu7LqR2hsxl0jqS3DgO/cVSW7n9KzPtuh/NrMrXlFxyXjgd0SdQNnf NLti+PRMoWZty8BTj0OlVHnUBrueWALVUGIWBzOIGL5CZ5AcsYwSwF3xBEcF3OQHziNmlA7CHb QVJP8pVO8qnxxvIbQKhLVTeV Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jan 2022 00:36:14 -0800 IronPort-SDR: oTiMdo2rNrOx7psKKrwqU1kgIjfP4DhwP3FGuY0Yf9y7LzLxBy/K2LIDLIRFAUgQnqUhIbVVh3 X4p+P5fNmXh7wjGjZalMgEaprQy4NKs29edJdV984poNAPlVZKLBkzrejtbrIB603+z9uRWNf4 MXED/37w2eXR6njWOBDeedCbqSC/OsGFhXlQ3hon+6bIq9xruXd7EsEOsRVX5NzQq4jbUFuBhS 5XRstin3aJi5Q9a4AFwrc+MFdBQCUI02EZObmFLri8B6AAvnWBY+Vet7gxj5hJVYo1TOeD9ywR sPk= WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.72]) by uls-op-cesaip02.wdc.com with ESMTP; 26 Jan 2022 01:04:09 -0800 From: Johannes Thumshirn To: David Sterba Cc: Johannes Thumshirn , linux-btrfs@vger.kernel.org Subject: [PATCH 2/2] btrfs-progs: zoned support DUP on metadata block groups Date: Wed, 26 Jan 2022 01:04:03 -0800 Message-Id: <20220126090403.57672-3-johannes.thumshirn@wdc.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220126090403.57672-1-johannes.thumshirn@wdc.com> References: <20220126090403.57672-1-johannes.thumshirn@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org Support using BTRFS_BLOCK_GROUP_DUP on metadata (and system) block groups. Signed-off-by: Johannes Thumshirn --- kernel-shared/zoned.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/kernel-shared/zoned.c b/kernel-shared/zoned.c index e6fd4b31b9d6..f9f55626115e 100644 --- a/kernel-shared/zoned.c +++ b/kernel-shared/zoned.c @@ -808,14 +808,20 @@ out: return ret; } -bool profile_supported(u64 flags) +bool profile_supported(u64 map_type) { - flags &= BTRFS_BLOCK_GROUP_PROFILE_MASK; + bool data = (map_type & BTRFS_BLOCK_GROUP_DATA); + u64 flags = (map_type & BTRFS_BLOCK_GROUP_PROFILE_MASK); /* SINGLE */ if (flags == 0) return true; - /* non-single profiles are not supported yet */ + + /* We can support DUP on meta-data */ + if (!data && (flags & BTRFS_BLOCK_GROUP_DUP)) + return true; + + /* All other profiles are not supported yet */ return false; }