* [PATCH] btrfs-progs: fix btrfs_group_profile_str regression
@ 2021-10-30 14:36 Wang Yugui
2021-11-02 10:42 ` Qu Wenruo
2021-11-02 17:06 ` David Sterba
0 siblings, 2 replies; 3+ messages in thread
From: Wang Yugui @ 2021-10-30 14:36 UTC (permalink / raw)
To: linux-btrfs; +Cc: Wang Yugui
dad03fac3bb8 ("btrfs-progs: switch btrfs_group_profile_str to use raid table")
introduced a regression that raid profile of GlobalReserve will be output
as 'unknown'.
$ btrfs filesystem df /mnt/test
Data, single: total=5.02TiB, used=4.98TiB
System, single: total=4.00MiB, used=624.00KiB
Metadata, single: total=11.01GiB, used=6.94GiB
GlobalReserve, unknown: total=512.00MiB, used=0.00B
fix it by
- add the process of BTRFS_BLOCK_GROUP_RESERVED
- fix the define of BTRFS_BLOCK_GROUP_RESERVED too.
Fixes: dad03fac3bb8 ("btrfs-progs: switch btrfs_group_profile_str to use raid table")
Signed-off-by: Wang Yugui <wangyugui@e16-tech.com>
---
common/utils.c | 2 +-
kernel-shared/ctree.h | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/common/utils.c b/common/utils.c
index aee0eedc..e8744199 100644
--- a/common/utils.c
+++ b/common/utils.c
@@ -1030,7 +1030,7 @@ const char* btrfs_group_profile_str(u64 flag)
{
int index;
- flag &= ~BTRFS_BLOCK_GROUP_TYPE_MASK;
+ flag &= ~(BTRFS_BLOCK_GROUP_TYPE_MASK | BTRFS_BLOCK_GROUP_RESERVED);
if (flag & ~BTRFS_BLOCK_GROUP_PROFILE_MASK)
return "unknown";
diff --git a/kernel-shared/ctree.h b/kernel-shared/ctree.h
index 563ea50b..99ebc3ad 100644
--- a/kernel-shared/ctree.h
+++ b/kernel-shared/ctree.h
@@ -972,7 +972,8 @@ struct btrfs_csum_item {
#define BTRFS_BLOCK_GROUP_RAID6 (1ULL << 8)
#define BTRFS_BLOCK_GROUP_RAID1C3 (1ULL << 9)
#define BTRFS_BLOCK_GROUP_RAID1C4 (1ULL << 10)
-#define BTRFS_BLOCK_GROUP_RESERVED BTRFS_AVAIL_ALLOC_BIT_SINGLE
+#define BTRFS_BLOCK_GROUP_RESERVED (BTRFS_AVAIL_ALLOC_BIT_SINGLE | \
+ BTRFS_SPACE_INFO_GLOBAL_RSV)
enum btrfs_raid_types {
BTRFS_RAID_RAID10,
--
2.32.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] btrfs-progs: fix btrfs_group_profile_str regression
2021-10-30 14:36 [PATCH] btrfs-progs: fix btrfs_group_profile_str regression Wang Yugui
@ 2021-11-02 10:42 ` Qu Wenruo
2021-11-02 17:06 ` David Sterba
1 sibling, 0 replies; 3+ messages in thread
From: Qu Wenruo @ 2021-11-02 10:42 UTC (permalink / raw)
To: Wang Yugui, linux-btrfs
On 2021/10/30 22:36, Wang Yugui wrote:
> dad03fac3bb8 ("btrfs-progs: switch btrfs_group_profile_str to use raid table")
> introduced a regression that raid profile of GlobalReserve will be output
> as 'unknown'.
>
> $ btrfs filesystem df /mnt/test
> Data, single: total=5.02TiB, used=4.98TiB
> System, single: total=4.00MiB, used=624.00KiB
> Metadata, single: total=11.01GiB, used=6.94GiB
> GlobalReserve, unknown: total=512.00MiB, used=0.00B
>
> fix it by
> - add the process of BTRFS_BLOCK_GROUP_RESERVED
> - fix the define of BTRFS_BLOCK_GROUP_RESERVED too.
That also unified kernel uapi and progs headers' definition of
BTRFS_BLOCK_GROUP_RESERVED.
>
> Fixes: dad03fac3bb8 ("btrfs-progs: switch btrfs_group_profile_str to use raid table")
> Signed-off-by: Wang Yugui <wangyugui@e16-tech.com>
Revewed-by: Qu Wenruo <wqu@suse.com>
Thanks,
Qu
>
> ---
> common/utils.c | 2 +-
> kernel-shared/ctree.h | 3 ++-
> 2 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/common/utils.c b/common/utils.c
> index aee0eedc..e8744199 100644
> --- a/common/utils.c
> +++ b/common/utils.c
> @@ -1030,7 +1030,7 @@ const char* btrfs_group_profile_str(u64 flag)
> {
> int index;
>
> - flag &= ~BTRFS_BLOCK_GROUP_TYPE_MASK;
> + flag &= ~(BTRFS_BLOCK_GROUP_TYPE_MASK | BTRFS_BLOCK_GROUP_RESERVED);
> if (flag & ~BTRFS_BLOCK_GROUP_PROFILE_MASK)
> return "unknown";
>
> diff --git a/kernel-shared/ctree.h b/kernel-shared/ctree.h
> index 563ea50b..99ebc3ad 100644
> --- a/kernel-shared/ctree.h
> +++ b/kernel-shared/ctree.h
> @@ -972,7 +972,8 @@ struct btrfs_csum_item {
> #define BTRFS_BLOCK_GROUP_RAID6 (1ULL << 8)
> #define BTRFS_BLOCK_GROUP_RAID1C3 (1ULL << 9)
> #define BTRFS_BLOCK_GROUP_RAID1C4 (1ULL << 10)
> -#define BTRFS_BLOCK_GROUP_RESERVED BTRFS_AVAIL_ALLOC_BIT_SINGLE
> +#define BTRFS_BLOCK_GROUP_RESERVED (BTRFS_AVAIL_ALLOC_BIT_SINGLE | \
> + BTRFS_SPACE_INFO_GLOBAL_RSV)
>
> enum btrfs_raid_types {
> BTRFS_RAID_RAID10,
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] btrfs-progs: fix btrfs_group_profile_str regression
2021-10-30 14:36 [PATCH] btrfs-progs: fix btrfs_group_profile_str regression Wang Yugui
2021-11-02 10:42 ` Qu Wenruo
@ 2021-11-02 17:06 ` David Sterba
1 sibling, 0 replies; 3+ messages in thread
From: David Sterba @ 2021-11-02 17:06 UTC (permalink / raw)
To: Wang Yugui; +Cc: linux-btrfs
On Sat, Oct 30, 2021 at 10:36:58PM +0800, Wang Yugui wrote:
> dad03fac3bb8 ("btrfs-progs: switch btrfs_group_profile_str to use raid table")
> introduced a regression that raid profile of GlobalReserve will be output
> as 'unknown'.
>
> $ btrfs filesystem df /mnt/test
> Data, single: total=5.02TiB, used=4.98TiB
> System, single: total=4.00MiB, used=624.00KiB
> Metadata, single: total=11.01GiB, used=6.94GiB
> GlobalReserve, unknown: total=512.00MiB, used=0.00B
>
> fix it by
> - add the process of BTRFS_BLOCK_GROUP_RESERVED
> - fix the define of BTRFS_BLOCK_GROUP_RESERVED too.
>
> Fixes: dad03fac3bb8 ("btrfs-progs: switch btrfs_group_profile_str to use raid table")
> Signed-off-by: Wang Yugui <wangyugui@e16-tech.com>
Added to devel, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-11-02 17:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-30 14:36 [PATCH] btrfs-progs: fix btrfs_group_profile_str regression Wang Yugui
2021-11-02 10:42 ` Qu Wenruo
2021-11-02 17:06 ` 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.