All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] btrfs-progs: support DUP on metadata for zoned
@ 2022-01-26  9:04 Johannes Thumshirn
  2022-01-26  9:04 ` [PATCH 1/2] btrfs-progs: use profile_supported in mkfs as well Johannes Thumshirn
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Johannes Thumshirn @ 2022-01-26  9:04 UTC (permalink / raw)
  To: David Sterba; +Cc: Johannes Thumshirn, linux-btrfs

This is the userspace part for supporting BTRFS_BLOCK_GROUP_DUP on zoned
devices for metadata block groups.

Johannes Thumshirn (2):
  btrfs-progs: use profile_supported in mkfs as well
  btrfs-progs: zoned support DUP on metadata block groups

 kernel-shared/zoned.c | 12 +++++++++---
 kernel-shared/zoned.h |  1 +
 mkfs/main.c           |  4 ++--
 3 files changed, 12 insertions(+), 5 deletions(-)

-- 
2.31.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] btrfs-progs: use profile_supported in mkfs as well
  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
  2022-02-01 16:33   ` 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
  2 siblings, 1 reply; 5+ messages in thread
From: Johannes Thumshirn @ 2022-01-26  9:04 UTC (permalink / raw)
  To: David Sterba; +Cc: Johannes Thumshirn, linux-btrfs

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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] btrfs-progs: zoned support DUP on metadata block groups
  2022-01-26  9:04 [PATCH 0/2] btrfs-progs: support DUP on metadata for zoned Johannes Thumshirn
  2022-01-26  9:04 ` [PATCH 1/2] btrfs-progs: use profile_supported in mkfs as well Johannes Thumshirn
@ 2022-01-26  9:04 ` Johannes Thumshirn
  2022-02-01 16:51 ` [PATCH 0/2] btrfs-progs: support DUP on metadata for zoned David Sterba
  2 siblings, 0 replies; 5+ messages in thread
From: Johannes Thumshirn @ 2022-01-26  9:04 UTC (permalink / raw)
  To: David Sterba; +Cc: Johannes Thumshirn, linux-btrfs

Support using BTRFS_BLOCK_GROUP_DUP on metadata (and system) block groups.

Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
---
 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;
 }
 
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] btrfs-progs: use profile_supported in mkfs as well
  2022-01-26  9:04 ` [PATCH 1/2] btrfs-progs: use profile_supported in mkfs as well Johannes Thumshirn
@ 2022-02-01 16:33   ` David Sterba
  0 siblings, 0 replies; 5+ messages in thread
From: David Sterba @ 2022-02-01 16:33 UTC (permalink / raw)
  To: Johannes Thumshirn; +Cc: David Sterba, linux-btrfs

On Wed, Jan 26, 2022 at 01:04:02AM -0800, Johannes Thumshirn wrote:
> 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)

Making a function part of public APIs should go with a rename adding a
prefix, here it's supported profiles for zoned mode, but it's used
without any other context in mkfs so at last "zoned_profile_supported"
would be good. I'll update it.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/2] btrfs-progs: support DUP on metadata for zoned
  2022-01-26  9:04 [PATCH 0/2] btrfs-progs: support DUP on metadata for zoned Johannes Thumshirn
  2022-01-26  9:04 ` [PATCH 1/2] btrfs-progs: use profile_supported in mkfs as well Johannes Thumshirn
  2022-01-26  9:04 ` [PATCH 2/2] btrfs-progs: zoned support DUP on metadata block groups Johannes Thumshirn
@ 2022-02-01 16:51 ` David Sterba
  2 siblings, 0 replies; 5+ messages in thread
From: David Sterba @ 2022-02-01 16:51 UTC (permalink / raw)
  To: Johannes Thumshirn; +Cc: David Sterba, linux-btrfs

On Wed, Jan 26, 2022 at 01:04:01AM -0800, Johannes Thumshirn wrote:
> This is the userspace part for supporting BTRFS_BLOCK_GROUP_DUP on zoned
> devices for metadata block groups.

mkfs with DUP on metadata works, I also tried it on -d dup and it
crashes inside btrfs_add_block_group (kernel-shared/extent-tree.c:2781:)
due to missing error handling. Can you please also have a look? It
should at least exit with a normal error, so we can throw zoned devices
into more tests eventually.

> Johannes Thumshirn (2):
>   btrfs-progs: use profile_supported in mkfs as well
>   btrfs-progs: zoned support DUP on metadata block groups

Added to devel, thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-02-01 16:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-26  9:04 [PATCH 0/2] btrfs-progs: support DUP on metadata for zoned Johannes Thumshirn
2022-01-26  9:04 ` [PATCH 1/2] btrfs-progs: use profile_supported in mkfs as well Johannes Thumshirn
2022-02-01 16:33   ` 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

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.