diff mbox series

btrfs: sysfs: advertise experimental features only if CONFIG_BTRFS_EXPERIMENTAL=y

Message ID c7b550091f427a79ec5a9aa6c5ac6b5efbdb4e8f.1731605782.git.fdmanana@suse.com (mailing list archive)
State New
Headers show
Series btrfs: sysfs: advertise experimental features only if CONFIG_BTRFS_EXPERIMENTAL=y | expand

Commit Message

Filipe Manana Nov. 14, 2024, 5:37 p.m. UTC
From: Filipe Manana <fdmanana@suse.com>

We are advertising experimental features through sysfs if
CONFIG_BTRFS_DEBUG is set, without looking if CONFIG_BTRFS_EXPERIMENTAL
is set. This is wrong as it will result in reporting experimental
features as supported when CONFIG_BTRFS_EXPERIMENTAL is not set but
CONFIG_BTRFS_DEBUG is set.

Fix this by checking for CONFIG_BTRFS_EXPERIMENTAL instead of
CONFIG_BTRFS_DEBUG.

Fixes: 67cd3f221769 ("btrfs: split out CONFIG_BTRFS_EXPERIMENTAL from CONFIG_BTRFS_DEBUG")
Signed-off-by: Filipe Manana <fdmanana@suse.com>
---
 fs/btrfs/sysfs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Neal Gompa Nov. 14, 2024, 6:38 p.m. UTC | #1
On Thu, Nov 14, 2024 at 12:37 PM <fdmanana@kernel.org> wrote:
>
> From: Filipe Manana <fdmanana@suse.com>
>
> We are advertising experimental features through sysfs if
> CONFIG_BTRFS_DEBUG is set, without looking if CONFIG_BTRFS_EXPERIMENTAL
> is set. This is wrong as it will result in reporting experimental
> features as supported when CONFIG_BTRFS_EXPERIMENTAL is not set but
> CONFIG_BTRFS_DEBUG is set.
>
> Fix this by checking for CONFIG_BTRFS_EXPERIMENTAL instead of
> CONFIG_BTRFS_DEBUG.
>
> Fixes: 67cd3f221769 ("btrfs: split out CONFIG_BTRFS_EXPERIMENTAL from CONFIG_BTRFS_DEBUG")
> Signed-off-by: Filipe Manana <fdmanana@suse.com>
> ---
>  fs/btrfs/sysfs.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
> index b843308e2bc6..fdcbf650ac31 100644
> --- a/fs/btrfs/sysfs.c
> +++ b/fs/btrfs/sysfs.c
> @@ -295,7 +295,7 @@ BTRFS_FEAT_ATTR_INCOMPAT(simple_quota, SIMPLE_QUOTA);
>  #ifdef CONFIG_BLK_DEV_ZONED
>  BTRFS_FEAT_ATTR_INCOMPAT(zoned, ZONED);
>  #endif
> -#ifdef CONFIG_BTRFS_DEBUG
> +#ifdef CONFIG_BTRFS_EXPERIMENTAL
>  /* Remove once support for extent tree v2 is feature complete */
>  BTRFS_FEAT_ATTR_INCOMPAT(extent_tree_v2, EXTENT_TREE_V2);
>  /* Remove once support for raid stripe tree is feature complete. */
> @@ -329,7 +329,7 @@ static struct attribute *btrfs_supported_feature_attrs[] = {
>  #ifdef CONFIG_BLK_DEV_ZONED
>         BTRFS_FEAT_ATTR_PTR(zoned),
>  #endif
> -#ifdef CONFIG_BTRFS_DEBUG
> +#ifdef CONFIG_BTRFS_EXPERIMENTAL
>         BTRFS_FEAT_ATTR_PTR(extent_tree_v2),
>         BTRFS_FEAT_ATTR_PTR(raid_stripe_tree),
>  #endif
> --
> 2.45.2
>

LGTM.

Reviewed-by: Neal Gompa <neal@gompa.dev>
Qu Wenruo Nov. 14, 2024, 8:12 p.m. UTC | #2
在 2024/11/15 04:07, fdmanana@kernel.org 写道:
> From: Filipe Manana <fdmanana@suse.com>
>
> We are advertising experimental features through sysfs if
> CONFIG_BTRFS_DEBUG is set, without looking if CONFIG_BTRFS_EXPERIMENTAL
> is set. This is wrong as it will result in reporting experimental
> features as supported when CONFIG_BTRFS_EXPERIMENTAL is not set but
> CONFIG_BTRFS_DEBUG is set.
>
> Fix this by checking for CONFIG_BTRFS_EXPERIMENTAL instead of
> CONFIG_BTRFS_DEBUG.
>
> Fixes: 67cd3f221769 ("btrfs: split out CONFIG_BTRFS_EXPERIMENTAL from CONFIG_BTRFS_DEBUG")
> Signed-off-by: Filipe Manana <fdmanana@suse.com>

Reviewed-by: Qu Wenruo <wqu@suse.com>

My bad, thanks for fixing it.
Qu

> ---
>   fs/btrfs/sysfs.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
> index b843308e2bc6..fdcbf650ac31 100644
> --- a/fs/btrfs/sysfs.c
> +++ b/fs/btrfs/sysfs.c
> @@ -295,7 +295,7 @@ BTRFS_FEAT_ATTR_INCOMPAT(simple_quota, SIMPLE_QUOTA);
>   #ifdef CONFIG_BLK_DEV_ZONED
>   BTRFS_FEAT_ATTR_INCOMPAT(zoned, ZONED);
>   #endif
> -#ifdef CONFIG_BTRFS_DEBUG
> +#ifdef CONFIG_BTRFS_EXPERIMENTAL
>   /* Remove once support for extent tree v2 is feature complete */
>   BTRFS_FEAT_ATTR_INCOMPAT(extent_tree_v2, EXTENT_TREE_V2);
>   /* Remove once support for raid stripe tree is feature complete. */
> @@ -329,7 +329,7 @@ static struct attribute *btrfs_supported_feature_attrs[] = {
>   #ifdef CONFIG_BLK_DEV_ZONED
>   	BTRFS_FEAT_ATTR_PTR(zoned),
>   #endif
> -#ifdef CONFIG_BTRFS_DEBUG
> +#ifdef CONFIG_BTRFS_EXPERIMENTAL
>   	BTRFS_FEAT_ATTR_PTR(extent_tree_v2),
>   	BTRFS_FEAT_ATTR_PTR(raid_stripe_tree),
>   #endif
Johannes Thumshirn Nov. 15, 2024, 6:15 a.m. UTC | #3
Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
diff mbox series

Patch

diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
index b843308e2bc6..fdcbf650ac31 100644
--- a/fs/btrfs/sysfs.c
+++ b/fs/btrfs/sysfs.c
@@ -295,7 +295,7 @@  BTRFS_FEAT_ATTR_INCOMPAT(simple_quota, SIMPLE_QUOTA);
 #ifdef CONFIG_BLK_DEV_ZONED
 BTRFS_FEAT_ATTR_INCOMPAT(zoned, ZONED);
 #endif
-#ifdef CONFIG_BTRFS_DEBUG
+#ifdef CONFIG_BTRFS_EXPERIMENTAL
 /* Remove once support for extent tree v2 is feature complete */
 BTRFS_FEAT_ATTR_INCOMPAT(extent_tree_v2, EXTENT_TREE_V2);
 /* Remove once support for raid stripe tree is feature complete. */
@@ -329,7 +329,7 @@  static struct attribute *btrfs_supported_feature_attrs[] = {
 #ifdef CONFIG_BLK_DEV_ZONED
 	BTRFS_FEAT_ATTR_PTR(zoned),
 #endif
-#ifdef CONFIG_BTRFS_DEBUG
+#ifdef CONFIG_BTRFS_EXPERIMENTAL
 	BTRFS_FEAT_ATTR_PTR(extent_tree_v2),
 	BTRFS_FEAT_ATTR_PTR(raid_stripe_tree),
 #endif