Skip to contentSkip to conversation

mke2fs: Add revision to the is_before_linux_ver()

PATCH Applied Lukas Czerner 3 participants 6 messages Feb 24, 2014 – Jul 6, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 mke2fs: Add revision to the is_before_linux_ver()

---
 misc/mke2fs.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
misc/mke2fs.c +7 -5
index facbe4c..957b4b6 100644
@@ -177,7 +177,8 @@ static int parse_version_number(const char *s)
 	return KERNEL_VERSION(major, minor, rev);
 }
 
-static int is_before_linux_ver(unsigned int major, unsigned int minor)
+static int is_before_linux_ver(unsigned int major, unsigned int minor,
+			       unsigned int rev)
 {
 	struct		utsname ut;
 	static int	linux_version_code = -1;
@@ -191,10 +192,11 @@ static int is_before_linux_ver(unsigned int major, unsigned int minor)
 	if (linux_version_code == 0)
 		return 0;
 
-	return linux_version_code < KERNEL_VERSION(major, minor, 0);
+	return linux_version_code < KERNEL_VERSION(major, minor, rev);
 }
 #else
-static int is_before_linux_ver(unsigned int major, unsigned int minor)
+static int is_before_linux_ver(unsigned int major, unsigned int minor,
+			       unsigned int rev)
 {
 	return 0;
 }
@@ -1513,7 +1515,7 @@ profile_error:
 	memset(&fs_param, 0, sizeof(struct ext2_super_block));
 	fs_param.s_rev_level = 1;  /* Create revision 1 filesystems now */
 
-	if (is_before_linux_ver(2, 2))
+	if (is_before_linux_ver(2, 2, 0))
 		fs_param.s_rev_level = 0;
 
 	if (argc && *argv) {
@@ -1952,7 +1954,7 @@ profile_error:
 
 		if (use_bsize == -1) {
 			use_bsize = sys_page_size;
-			if (is_before_linux_ver(2, 6) && use_bsize > 4096)
+			if (is_before_linux_ver(2, 6, 0) && use_bsize > 4096)
 				use_bsize = 4096;
 		}
 		if (lsector_size && use_bsize < lsector_size)
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH 2/2 mke2fs: Enable lazy_itable_init on newer kernel by default

Currently is used did not specified lazy_itable_init option we rely on information from ext4 module exported via sysfs interface. However if the ext4 module is not loaded it will not be enabled even though kernel might support it.

With this commit we set the default according to the kernel version, however we still allow it to be set manually via extended option or be enabled in case that ext4 module advertise that it supports this feature.

---
 misc/mke2fs.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
misc/mke2fs.c +9 -1
index 957b4b6..e1c6d09 100644
@@ -2146,7 +2146,15 @@ profile_error:
 			blocksize, sys_page_size);
 	}
 
-	lazy_itable_init = 0;
+	/*
+	 * On newer kernels we do have lazy_itable_init support. So pick the
+	 * right default in case ext4 module is not loaded.
+	 */
+	if (is_before_linux_ver(2, 6, 37))
+		lazy_itable_init = 0;
+	else
+		lazy_itable_init = 1;
+
 	if (access("/sys/fs/ext4/features/lazy_itable_init", R_OK) == 0)
 		lazy_itable_init = 1;
 
Signature · 1 line
1.8.3.1
Reviewed-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] mke2fs: Enable lazy_itable_init on newer kernel by default

Quoted 1 line · Lukas Czerner

Currently is used did not specified lazy_itable_init option we rely on

s/is used did not specified/if user did not specify/ :)

Quoted 10 lines

information from ext4 module exported via sysfs interface. However if the ext4 module is not loaded it will not be enabled even though kernel might support it.

With this commit we set the default according to the kernel version, however we still allow it to be set manually via extended option or be enabled in case that ext4 module advertise that it supports this feature.

Thanks,

Quoted 26 lines
---
 misc/mke2fs.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
misc/mke2fs.c +9 -1
index 957b4b6..e1c6d09 100644
@@ -2146,7 +2146,15 @@ profile_error:
 			blocksize, sys_page_size);
 	}
 
-	lazy_itable_init = 0;
+	/*
+	 * On newer kernels we do have lazy_itable_init support. So pick the
+	 * right default in case ext4 module is not loaded.
+	 */
+	if (is_before_linux_ver(2, 6, 37))
+		lazy_itable_init = 0;
+	else
+		lazy_itable_init = 1;
+
 	if (access("/sys/fs/ext4/features/lazy_itable_init", R_OK) == 0)
 		lazy_itable_init = 1;
 
#3 lore raw

Re: [PATCH 2/2] mke2fs: Enable lazy_itable_init on newer kernel by default

Quoted 21 lines · Eric Sandeen

Date: Mon, 24 Feb 2014 11:43:21 -0600
From: Eric Sandeen <[email protected]>
To: Lukas Czerner <[email protected]>, [email protected]
Cc: [email protected]
Subject: Re: [PATCH 2/2] mke2fs: Enable lazy_itable_init on newer kernel by
default

Quoted 1 line · Lukas Czerner

Currently is used did not specified lazy_itable_init option we rely on

s/is used did not specified/if user did not specify/ :)

Quoted 9 lines

information from ext4 module exported via sysfs interface. However if the ext4 module is not loaded it will not be enabled even though kernel might support it.

With this commit we set the default according to the kernel version, however we still allow it to be set manually via extended option or be enabled in case that ext4 module advertise that it supports this feature.

Quoted 4 lines
Quoted 1 line

Thanks,

Hi Ted,

are you planning to take this in ?

Thanks!
-Lukas

Quoted 29 lines
Quoted 27 lines
---
 misc/mke2fs.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
misc/mke2fs.c +9 -1
index 957b4b6..e1c6d09 100644
@@ -2146,7 +2146,15 @@ profile_error:
 			blocksize, sys_page_size);
 	}
 
-	lazy_itable_init = 0;
+	/*
+	 * On newer kernels we do have lazy_itable_init support. So pick the
+	 * right default in case ext4 module is not loaded.
+	 */
+	if (is_before_linux_ver(2, 6, 37))
+		lazy_itable_init = 0;
+	else
+		lazy_itable_init = 1;
+
 	if (access("/sys/fs/ext4/features/lazy_itable_init", R_OK) == 0)
 		lazy_itable_init = 1;
 
#4 lore raw

Re: [PATCH 2/2] mke2fs: Enable lazy_itable_init on newer kernel by default

In reply to Lukas Czerner
Quoted 11 lines · Lukas Czerner

Currently is used did not specified lazy_itable_init option we rely on information from ext4 module exported via sysfs interface. However if the ext4 module is not loaded it will not be enabled even though kernel might support it.

With this commit we set the default according to the kernel version, however we still allow it to be set manually via extended option or be enabled in case that ext4 module advertise that it supports this feature.

Thanks, applied.

- Ted