Patchwork mke2fs: check extents feature when bigalloc feature is enabled

login
register
mail settings
Submitter Zheng Liu
Date Jan. 6, 2013, 12:25 p.m.
Message ID <1357475117-5095-1-git-send-email-wenqing.lz@taobao.com>
Download mbox | patch
Permalink /patch/209747/
State Accepted
Headers show

Comments

Zheng Liu - Jan. 6, 2013, 12:25 p.m.
From: Zheng Liu <wenqing.lz@taobao.com>

When bigalloc feature is enabled in mkfs, extents feature also needs to be
enabled.  But now when bigalloc feature is enabled without extents feature,
users will not get any warning messages until they try to mount this file
system.

Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
---
 misc/mke2fs.c | 9 +++++++++
 1 file changed, 9 insertions(+)
Theodore Ts'o - Jan. 8, 2013, 3:36 p.m.
On Sun, Jan 06, 2013 at 08:25:17PM +0800, Zheng Liu wrote:
> From: Zheng Liu <wenqing.lz@taobao.com>
> 
> When bigalloc feature is enabled in mkfs, extents feature also needs to be
> enabled.  But now when bigalloc feature is enabled without extents feature,
> users will not get any warning messages until they try to mount this file
> system.
> 
> Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>

Thanks, applied.

					- Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/misc/mke2fs.c b/misc/mke2fs.c
index a288147..713eb21 100644
--- a/misc/mke2fs.c
+++ b/misc/mke2fs.c
@@ -1988,6 +1988,15 @@  profile_error:
 		fs_param.s_feature_ro_compat &=
 				~EXT4_FEATURE_RO_COMPAT_GDT_CSUM;
 
+	/* Can't support bigalloc feature without extents feature */
+	if ((fs_param.s_feature_ro_compat & EXT4_FEATURE_RO_COMPAT_BIGALLOC) &&
+	    !(fs_param.s_feature_incompat & EXT3_FEATURE_INCOMPAT_EXTENTS)) {
+		com_err(program_name, 0,
+			_("Can't support bigalloc feature without "
+			  "extents feature"));
+		exit(1);
+	}
+
 	/* Since sparse_super is the default, we would only have a problem
 	 * here if it was explicitly disabled.
 	 */