diff mbox series

ext4: kenel configuration of usage of ext3

Message ID 20180302122717.16914-1-david.gounaris@infinera.com
State Rejected, archived
Headers show
Series ext4: kenel configuration of usage of ext3 | expand

Commit Message

David Gounaris March 2, 2018, 12:27 p.m. UTC
The solution is equivalent to what is done to disable ext2.

This was done to avoid warning message after trying to mount as ext3.

Signed-off-by: David Gounaris <david.gounaris@infinera.com>
---
 fs/ext4/Kconfig | 11 +++++++++++
 fs/ext4/super.c | 11 ++++++++++-
 2 files changed, 21 insertions(+), 1 deletion(-)

Comments

Jan Kara March 6, 2018, 12:41 p.m. UTC | #1
On Fri 02-03-18 13:27:17, David Gounaris wrote:
> The solution is equivalent to what is done to disable ext2.
> 
> This was done to avoid warning message after trying to mount as ext3.
> 
> Signed-off-by: David Gounaris <david.gounaris@infinera.com>

Thanks for the patch. Eric has already fixed the warning differently in his
patch [1]. Also I somewhat fail to see how this change would avoid the
warning. You then disabled 'EXT4_USE_FOR_EXT3' in your kernel config? If
yes, that is just working around problems in userspace which apparently
changed recently and probes filesystem types in different order than it
used to.

								Honza

[1] https://www.spinics.net/lists/linux-ext4/msg59878.html

> ---
>  fs/ext4/Kconfig | 11 +++++++++++
>  fs/ext4/super.c | 11 ++++++++++-
>  2 files changed, 21 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/ext4/Kconfig b/fs/ext4/Kconfig
> index e38039fd96ff..c901c9429949 100644
> --- a/fs/ext4/Kconfig
> +++ b/fs/ext4/Kconfig
> @@ -73,6 +73,17 @@ config EXT4_USE_FOR_EXT2
>  	  compiled kernel size by using one file system driver for
>  	  ext2, ext3, and ext4 file systems.
>  
> +config EXT4_USE_FOR_EXT3
> +	bool "Use ext4 for ext3 file systems"
> +	depends on EXT4_FS
> +	depends on EXT3_FS=n
> +	default y
> +	help
> +	  Allow the ext4 file system driver code to be used for ext3
> +	  file system mounts.  This allows users to reduce their
> +	  compiled kernel size by using one file system driver for
> +	  ext2, ext3, and ext4 file systems.
> +
>  config EXT4_FS_POSIX_ACL
>  	bool "Ext4 POSIX Access Control Lists"
>  	depends on EXT4_FS
> diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> index f29351c66610..c5a7258565e2 100644
> --- a/fs/ext4/super.c
> +++ b/fs/ext4/super.c
> @@ -129,6 +129,7 @@ MODULE_ALIAS("ext2");
>  #endif
>  
>  
> +#if !defined(CONFIG_EXT3_FS) && !defined(CONFIG_EXT3_FS_MODULE) && defined(CONFIG_EXT4_USE_FOR_EXT3)
>  static struct file_system_type ext3_fs_type = {
>  	.owner		= THIS_MODULE,
>  	.name		= "ext3",
> @@ -139,6 +140,9 @@ static struct file_system_type ext3_fs_type = {
>  MODULE_ALIAS_FS("ext3");
>  MODULE_ALIAS("ext3");
>  #define IS_EXT3_SB(sb) ((sb)->s_bdev->bd_holder == &ext3_fs_type)
> +#else
> +#define IS_EXT3_SB(sb) (0)
> +#endif
>  
>  static int ext4_verify_csum_type(struct super_block *sb,
>  				 struct ext4_super_block *es)
> @@ -5745,6 +5749,7 @@ static inline void unregister_as_ext2(void) { }
>  static inline int ext2_feature_set_ok(struct super_block *sb) { return 0; }
>  #endif
>  
> +#if !defined(CONFIG_EXT3_FS) && !defined(CONFIG_EXT3_FS_MODULE) && defined(CONFIG_EXT4_USE_FOR_EXT3)
>  static inline void register_as_ext3(void)
>  {
>  	int err = register_filesystem(&ext3_fs_type);
> @@ -5757,7 +5762,6 @@ static inline void unregister_as_ext3(void)
>  {
>  	unregister_filesystem(&ext3_fs_type);
>  }
> -
>  static inline int ext3_feature_set_ok(struct super_block *sb)
>  {
>  	if (ext4_has_unknown_ext3_incompat_features(sb))
> @@ -5771,6 +5775,11 @@ static inline int ext3_feature_set_ok(struct super_block *sb)
>  	return 1;
>  }
>  
> +#else
> +static inline void register_as_ext3(void) { }
> +static inline void unregister_as_ext3(void) { }
> +static inline int ext3_feature_set_ok(struct super_block *sb) { return 0; }
> +#endif
>  static struct file_system_type ext4_fs_type = {
>  	.owner		= THIS_MODULE,
>  	.name		= "ext4",
> -- 
> 2.13.6
>
diff mbox series

Patch

diff --git a/fs/ext4/Kconfig b/fs/ext4/Kconfig
index e38039fd96ff..c901c9429949 100644
--- a/fs/ext4/Kconfig
+++ b/fs/ext4/Kconfig
@@ -73,6 +73,17 @@  config EXT4_USE_FOR_EXT2
 	  compiled kernel size by using one file system driver for
 	  ext2, ext3, and ext4 file systems.
 
+config EXT4_USE_FOR_EXT3
+	bool "Use ext4 for ext3 file systems"
+	depends on EXT4_FS
+	depends on EXT3_FS=n
+	default y
+	help
+	  Allow the ext4 file system driver code to be used for ext3
+	  file system mounts.  This allows users to reduce their
+	  compiled kernel size by using one file system driver for
+	  ext2, ext3, and ext4 file systems.
+
 config EXT4_FS_POSIX_ACL
 	bool "Ext4 POSIX Access Control Lists"
 	depends on EXT4_FS
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index f29351c66610..c5a7258565e2 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -129,6 +129,7 @@  MODULE_ALIAS("ext2");
 #endif
 
 
+#if !defined(CONFIG_EXT3_FS) && !defined(CONFIG_EXT3_FS_MODULE) && defined(CONFIG_EXT4_USE_FOR_EXT3)
 static struct file_system_type ext3_fs_type = {
 	.owner		= THIS_MODULE,
 	.name		= "ext3",
@@ -139,6 +140,9 @@  static struct file_system_type ext3_fs_type = {
 MODULE_ALIAS_FS("ext3");
 MODULE_ALIAS("ext3");
 #define IS_EXT3_SB(sb) ((sb)->s_bdev->bd_holder == &ext3_fs_type)
+#else
+#define IS_EXT3_SB(sb) (0)
+#endif
 
 static int ext4_verify_csum_type(struct super_block *sb,
 				 struct ext4_super_block *es)
@@ -5745,6 +5749,7 @@  static inline void unregister_as_ext2(void) { }
 static inline int ext2_feature_set_ok(struct super_block *sb) { return 0; }
 #endif
 
+#if !defined(CONFIG_EXT3_FS) && !defined(CONFIG_EXT3_FS_MODULE) && defined(CONFIG_EXT4_USE_FOR_EXT3)
 static inline void register_as_ext3(void)
 {
 	int err = register_filesystem(&ext3_fs_type);
@@ -5757,7 +5762,6 @@  static inline void unregister_as_ext3(void)
 {
 	unregister_filesystem(&ext3_fs_type);
 }
-
 static inline int ext3_feature_set_ok(struct super_block *sb)
 {
 	if (ext4_has_unknown_ext3_incompat_features(sb))
@@ -5771,6 +5775,11 @@  static inline int ext3_feature_set_ok(struct super_block *sb)
 	return 1;
 }
 
+#else
+static inline void register_as_ext3(void) { }
+static inline void unregister_as_ext3(void) { }
+static inline int ext3_feature_set_ok(struct super_block *sb) { return 0; }
+#endif
 static struct file_system_type ext4_fs_type = {
 	.owner		= THIS_MODULE,
 	.name		= "ext4",