All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Thumshirn <johannes.thumshirn@wdc.com>
To: David Sterba <dsterba@suse.com>
Cc: Johannes Thumshirn <johannes.thumshirn@wdc.com>,
	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	[thread overview]
Message-ID: <20220126090403.57672-2-johannes.thumshirn@wdc.com> (raw)
In-Reply-To: <20220126090403.57672-1-johannes.thumshirn@wdc.com>

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 <johannes.thumshirn@wdc.com>
---
 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;
 	}
-- 
2.31.1


  reply	other threads:[~2022-01-26  9:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-26  9:04 [PATCH 0/2] btrfs-progs: support DUP on metadata for zoned Johannes Thumshirn
2022-01-26  9:04 ` Johannes Thumshirn [this message]
2022-02-01 16:33   ` [PATCH 1/2] btrfs-progs: use profile_supported in mkfs as well David Sterba
2022-01-26  9:04 ` [PATCH 2/2] btrfs-progs: zoned support DUP on metadata block groups Johannes Thumshirn
2022-02-01 16:51 ` [PATCH 0/2] btrfs-progs: support DUP on metadata for zoned David Sterba

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=20220126090403.57672-2-johannes.thumshirn@wdc.com \
    --to=johannes.thumshirn@wdc.com \
    --cc=dsterba@suse.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.