All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Thumshirn <johannes.thumshirn@wdc.com>
To: linux-btrfs@vger.kernel.org
Cc: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Subject: [RFC ONLY 4/6] btrfs-progs: allow zoned RAID1
Date: Wed, 18 May 2022 02:17:14 -0700	[thread overview]
Message-ID: <20220518091716.786452-5-johannes.thumshirn@wdc.com> (raw)
In-Reply-To: <20220518091716.786452-1-johannes.thumshirn@wdc.com>

Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
---
 kernel-shared/zoned.c | 20 +++++++++++++++-----
 kernel-shared/zoned.h |  4 ++--
 mkfs/main.c           |  4 ++--
 3 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/kernel-shared/zoned.c b/kernel-shared/zoned.c
index 396b74f0d906..7d6f4357ea9a 100644
--- a/kernel-shared/zoned.c
+++ b/kernel-shared/zoned.c
@@ -775,7 +775,7 @@ out:
 	return ret;
 }
 
-bool zoned_profile_supported(u64 map_type)
+bool zoned_profile_supported(u64 map_type, bool rst)
 {
 	bool data = (map_type & BTRFS_BLOCK_GROUP_DATA);
 	u64 flags = (map_type & BTRFS_BLOCK_GROUP_PROFILE_MASK);
@@ -784,9 +784,18 @@ bool zoned_profile_supported(u64 map_type)
 	if (flags == 0)
 		return true;
 
-	/* We can support DUP on metadata */
-	if (!data && (flags & BTRFS_BLOCK_GROUP_DUP))
-		return true;
+	if (data) {
+		/* Data RAID1 needs a raid-stripe-tree */
+		if ((flags & BTRFS_BLOCK_GROUP_RAID1_MASK) && rst)
+			return true;
+	} else {
+		/* We can support DUP on metadata/system */
+		if (flags & BTRFS_BLOCK_GROUP_DUP)
+			return true;
+		/* We can support RAID1 on metadata/system */
+		if (flags & BTRFS_BLOCK_GROUP_RAID1_MASK)
+			return true;
+	}
 
 	/* All other profiles are not supported yet */
 	return false;
@@ -903,7 +912,8 @@ int btrfs_load_block_group_zone_info(struct btrfs_fs_info *fs_info,
 		}
 	}
 
-	if (!zoned_profile_supported(map->type)) {
+	// XXX: not sure how to do yet
+	if (!zoned_profile_supported(map->type, true)) {
 		error("zoned: profile %s not yet supported",
 		      btrfs_group_profile_str(map->type));
 		ret = -EINVAL;
diff --git a/kernel-shared/zoned.h b/kernel-shared/zoned.h
index cc0d6b6f166d..c56788bcf07b 100644
--- a/kernel-shared/zoned.h
+++ b/kernel-shared/zoned.h
@@ -132,7 +132,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 zoned_profile_supported(u64 map_type);
+bool zoned_profile_supported(u64 map_type, bool rst);
 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);
@@ -213,7 +213,7 @@ static inline int btrfs_wipe_temporary_sb(struct btrfs_fs_devices *fs_devices)
 	return 0;
 }
 
-static inline bool zoned_profile_supported(u64 map_type)
+static inline bool zoned_profile_supported(u64 map_type, bool rst)
 {
 	return false;
 }
diff --git a/mkfs/main.c b/mkfs/main.c
index a603ec5896f3..46dbc4c0c363 100644
--- a/mkfs/main.c
+++ b/mkfs/main.c
@@ -1424,8 +1424,8 @@ int BOX_MAIN(mkfs)(int argc, char **argv)
 	if (ret)
 		goto error;
 
-	if (zoned && (!zoned_profile_supported(BTRFS_BLOCK_GROUP_METADATA | metadata_profile) ||
-		      !zoned_profile_supported(BTRFS_BLOCK_GROUP_DATA | data_profile))) {
+	if (zoned && (!zoned_profile_supported(BTRFS_BLOCK_GROUP_METADATA | metadata_profile, runtime_features & BTRFS_RUNTIME_FEATURE_RAID_STRIPE_TREE) ||
+		      !zoned_profile_supported(BTRFS_BLOCK_GROUP_DATA | data_profile, runtime_features & BTRFS_RUNTIME_FEATURE_RAID_STRIPE_TREE))) {
 		error("zoned mode does not yet support RAID/DUP profiles, please specify '-d single -m single' manually");
 		goto error;
 	}
-- 
2.35.3


  parent reply	other threads:[~2022-05-18  9:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-18  9:17 [RFC ONLY 0/6] btrfs-progs: raid-stripe-tree support for progs Johannes Thumshirn
2022-05-18  9:17 ` [RFC ONLY 1/6] btrfs-progs: add raid-stripe-tree definitions Johannes Thumshirn
2022-05-18  9:17 ` [RFC ONLY 2/6] btrfs-progs: read fs with stripe tree from disk Johannes Thumshirn
2022-05-18  9:17 ` [RFC ONLY 3/6] btrfs-progs: add dump tree support for the raid stripe tree Johannes Thumshirn
2022-05-18  9:17 ` Johannes Thumshirn [this message]
2022-05-18  9:17 ` [RFC ONLY 5/6] btrfs-progs: add raid-stripe-tree to mkfs runtime features Johannes Thumshirn
2022-05-18  9:17 ` [RFC ONLY 6/6] btrfs-progs: load zone info for all zoned devices Johannes Thumshirn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220518091716.786452-5-johannes.thumshirn@wdc.com \
    --to=johannes.thumshirn@wdc.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.