diff mbox series

btrfs: avoid repetitive define BTRFS_FEATURE_INCOMPAT_SUPP

Message ID ab23cf2ea306080a7d2be5e67bd22b6f7a9105d7.1678091761.git.anand.jain@oracle.com (mailing list archive)
State New, archived
Headers show
Series btrfs: avoid repetitive define BTRFS_FEATURE_INCOMPAT_SUPP | expand

Commit Message

Anand Jain March 6, 2023, 1:28 p.m. UTC
BTRFS_FEATURE_INCOMPAT_SUPP is defined twice, once under
CONFIG_BTRFS_DEBUG and once without it, resulting in repetitive code. The
reason for this is to add experimental features under CONFIG_BTRFS_DEBUG.

To avoid repetitive code, add a common list BTRFS_FEATURE_INCOMPAT_SUPP_STABLE,
and append experimental features only under CONFIG_BTRFS_DEBUG.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
Also,
Would it be advisable to add a new Kconfig define labeled as EXPERIMENTAL?
I don't believe it is, since if no new features are introduced, removing
the Kconfig would not be a viable option.

 fs/btrfs/fs.h | 36 +++++++++++++++---------------------
 1 file changed, 15 insertions(+), 21 deletions(-)

Comments

David Sterba March 6, 2023, 6:53 p.m. UTC | #1
On Mon, Mar 06, 2023 at 09:28:09PM +0800, Anand Jain wrote:
> BTRFS_FEATURE_INCOMPAT_SUPP is defined twice, once under
> CONFIG_BTRFS_DEBUG and once without it, resulting in repetitive code. The
> reason for this is to add experimental features under CONFIG_BTRFS_DEBUG.
> 
> To avoid repetitive code, add a common list BTRFS_FEATURE_INCOMPAT_SUPP_STABLE,
> and append experimental features only under CONFIG_BTRFS_DEBUG.
> 
> Signed-off-by: Anand Jain <anand.jain@oracle.com>

Added to misc-next, thanks.
> ---
> Also,
> Would it be advisable to add a new Kconfig define labeled as EXPERIMENTAL?
> I don't believe it is, since if no new features are introduced, removing
> the Kconfig would not be a viable option.

I don't think we need another config option for that, that it's required
to have debug should be sufficient. Each config option increases the
number of possible configurations.  In case some experimental feature
would be too intrusive even for the debug build then we could add a
separate one.
diff mbox series

Patch

diff --git a/fs/btrfs/fs.h b/fs/btrfs/fs.h
index 4c477eae6891..b7c815bb7fdf 100644
--- a/fs/btrfs/fs.h
+++ b/fs/btrfs/fs.h
@@ -196,27 +196,7 @@  enum {
 #define BTRFS_FEATURE_COMPAT_RO_SAFE_SET	0ULL
 #define BTRFS_FEATURE_COMPAT_RO_SAFE_CLEAR	0ULL
 
-#ifdef CONFIG_BTRFS_DEBUG
-/*
- * Extent tree v2 supported only with CONFIG_BTRFS_DEBUG
- */
-#define BTRFS_FEATURE_INCOMPAT_SUPP			\
-	(BTRFS_FEATURE_INCOMPAT_MIXED_BACKREF |		\
-	 BTRFS_FEATURE_INCOMPAT_DEFAULT_SUBVOL |	\
-	 BTRFS_FEATURE_INCOMPAT_MIXED_GROUPS |		\
-	 BTRFS_FEATURE_INCOMPAT_BIG_METADATA |		\
-	 BTRFS_FEATURE_INCOMPAT_COMPRESS_LZO |		\
-	 BTRFS_FEATURE_INCOMPAT_COMPRESS_ZSTD |		\
-	 BTRFS_FEATURE_INCOMPAT_RAID56 |		\
-	 BTRFS_FEATURE_INCOMPAT_EXTENDED_IREF |		\
-	 BTRFS_FEATURE_INCOMPAT_SKINNY_METADATA |	\
-	 BTRFS_FEATURE_INCOMPAT_NO_HOLES	|	\
-	 BTRFS_FEATURE_INCOMPAT_METADATA_UUID	|	\
-	 BTRFS_FEATURE_INCOMPAT_RAID1C34	|	\
-	 BTRFS_FEATURE_INCOMPAT_ZONED		|	\
-	 BTRFS_FEATURE_INCOMPAT_EXTENT_TREE_V2)
-#else
-#define BTRFS_FEATURE_INCOMPAT_SUPP			\
+#define BTRFS_FEATURE_INCOMPAT_SUPP_STABLE		\
 	(BTRFS_FEATURE_INCOMPAT_MIXED_BACKREF |		\
 	 BTRFS_FEATURE_INCOMPAT_DEFAULT_SUBVOL |	\
 	 BTRFS_FEATURE_INCOMPAT_MIXED_GROUPS |		\
@@ -230,6 +210,20 @@  enum {
 	 BTRFS_FEATURE_INCOMPAT_METADATA_UUID	|	\
 	 BTRFS_FEATURE_INCOMPAT_RAID1C34	|	\
 	 BTRFS_FEATURE_INCOMPAT_ZONED)
+
+#ifdef CONFIG_BTRFS_DEBUG
+	/*
+	 * Developing features like
+	 * 	Extent tree v2 support
+	 * is enabled only under CONFIG_BTRFS_DEBUG
+	 */
+	#define BTRFS_FEATURE_INCOMPAT_SUPP		\
+		(BTRFS_FEATURE_INCOMPAT_SUPP_STABLE |	\
+		 BTRFS_FEATURE_INCOMPAT_EXTENT_TREE_V2)
+
+#else
+	#define BTRFS_FEATURE_INCOMPAT_SUPP		\
+		(BTRFS_FEATURE_INCOMPAT_SUPP_STABLE)
 #endif
 
 #define BTRFS_FEATURE_INCOMPAT_SAFE_SET			\