Bug#738758: [PATCH] ext4: optimize Hurd tests when reading/writing inodes

2015-07-15 Thread Gabriele Giacone
From #hurd@freenode:

00:01  gnu_srs gg0: I wrote to Ted Tso about the ext4 bug and he
replied: Huh?  This patch (ext4: kill i_version support for
Hurd-castrated file
00:01  gnu_srs systems) landed upstream over a year ago, in Linux
3.15.  It is git commit c4f65706056e9f0c.

Just tested reproducer at https://bugs.debian.org/738758#5 with Jessie
3.16 kernel, fsck doesn't detect unexpected inconsistency anymore.

Has ext4: optimize Hurd tests when reading/writing inodes patch at
https://bugs.debian.org/738758#57 been applied too?
Any reason to keep it open?


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#738758: [PATCH] ext4: optimize Hurd tests when reading/writing inodes

2014-03-24 Thread Theodore Ts'o
Set a in-memory superblock flag to indicate whether the file system is
designed to support the Hurd.

Also, add a sanity check to make sure the 64-bit feature is not set
for Hurd file systems, since i_file_acl_high conflicts with a
Hurd-specific field.

Signed-off-by: Theodore Ts'o ty...@mit.edu
---
 fs/ext4/ext4.h  |  2 ++
 fs/ext4/inode.c |  9 +++--
 fs/ext4/super.c | 10 ++
 3 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index f4f889e..e01135d 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -1001,6 +1001,8 @@ struct ext4_inode_info {
 #define EXT4_MOUNT2_STD_GROUP_SIZE 0x0002 /* We have standard group
  size of blocksize * 8
  blocks */
+#define EXT4_MOUNT2_HURD_COMPAT0x0004 /* Support 
HURD-castrated
+ file systems */
 
 #define clear_opt(sb, opt) EXT4_SB(sb)-s_mount_opt = \
~EXT4_MOUNT_##opt
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index ed2c13a..b5e182a 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -4168,8 +4168,7 @@ struct inode *ext4_iget(struct super_block *sb, unsigned 
long ino)
EXT4_INODE_GET_XTIME(i_atime, inode, raw_inode);
EXT4_EINODE_GET_XTIME(i_crtime, ei, raw_inode);
 
-   if (EXT4_SB(inode-i_sb)-s_es-s_creator_os !=
-   cpu_to_le32(EXT4_OS_HURD)) {
+   if (likely(!test_opt2(inode-i_sb, HURD_COMPAT))) {
inode-i_version = le32_to_cpu(raw_inode-i_disk_version);
if (EXT4_INODE_SIZE(inode-i_sb)  EXT4_GOOD_OLD_INODE_SIZE) {
if (EXT4_FITS_IN_INODE(raw_inode, ei, i_version_hi))
@@ -4345,8 +4344,7 @@ static int ext4_do_update_inode(handle_t *handle,
goto out_brelse;
raw_inode-i_dtime = cpu_to_le32(ei-i_dtime);
raw_inode-i_flags = cpu_to_le32(ei-i_flags  0x);
-   if (EXT4_SB(inode-i_sb)-s_es-s_creator_os !=
-   cpu_to_le32(EXT4_OS_HURD))
+   if (likely(!test_opt2(inode-i_sb, HURD_COMPAT)))
raw_inode-i_file_acl_high =
cpu_to_le16(ei-i_file_acl  32);
raw_inode-i_file_acl_lo = cpu_to_le32(ei-i_file_acl);
@@ -4391,8 +4389,7 @@ static int ext4_do_update_inode(handle_t *handle,
raw_inode-i_block[block] = ei-i_data[block];
}
 
-   if (EXT4_SB(inode-i_sb)-s_es-s_creator_os !=
-   cpu_to_le32(EXT4_OS_HURD)) {
+   if (likely(!test_opt2(inode-i_sb, HURD_COMPAT))) {
raw_inode-i_disk_version = cpu_to_le32(inode-i_version);
if (ei-i_extra_isize) {
if (EXT4_FITS_IN_INODE(raw_inode, ei, i_version_hi))
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 3c9eadf..6adee9a 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -3580,6 +3580,16 @@ static int ext4_fill_super(struct super_block *sb, void 
*data, int silent)
   feature flags set on rev 0 fs, 
   running e2fsck is recommended);
 
+   if (es-s_creator_os == cpu_to_le32(EXT4_OS_HURD)) {
+   set_opt2(sb, HURD_COMPAT);
+   if (EXT4_HAS_INCOMPAT_FEATURE(sb,
+ EXT4_FEATURE_INCOMPAT_64BIT)) {
+   ext4_msg(sb, KERN_ERR,
+The Hurd can't support 64-bit file systems);
+   goto failed_mount;
+   }
+   }
+
if (IS_EXT2_SB(sb)) {
if (ext2_feature_set_ok(sb))
ext4_msg(sb, KERN_INFO, mounting ext2 file system 
-- 
1.9.0


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#738758: [PATCH] ext4: optimize Hurd tests when reading/writing inodes

2014-03-21 Thread Theodore Ts'o
Set a in-memory superblock flag to indicate whether the file system is
designed to support the Hurd.

Also, add a sanity check to make sure the 64-bit feature is not set
for Hurd file systems, since i_file_acl_high conflicts with a
Hurd-specific field.  This is not a big deal, since Hurd doesn't
support file systems larger than 1GB[1] anyway.

[1] http://walfield.org/pub/people/neal/papers/hurd-faq/FAQ.en.html#q2-6

Signed-off-by: Theodore Ts'o ty...@mit.edu
---
 fs/ext4/ext4.h  |  2 ++
 fs/ext4/inode.c |  9 +++--
 fs/ext4/super.c | 10 ++
 3 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index f4f889e..e01135d 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -1001,6 +1001,8 @@ struct ext4_inode_info {
 #define EXT4_MOUNT2_STD_GROUP_SIZE 0x0002 /* We have standard group
  size of blocksize * 8
  blocks */
+#define EXT4_MOUNT2_HURD_COMPAT0x0004 /* Support 
HURD-castrated
+ file systems */
 
 #define clear_opt(sb, opt) EXT4_SB(sb)-s_mount_opt = \
~EXT4_MOUNT_##opt
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index ed2c13a..a3a5eb3 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -4168,8 +4168,7 @@ struct inode *ext4_iget(struct super_block *sb, unsigned 
long ino)
EXT4_INODE_GET_XTIME(i_atime, inode, raw_inode);
EXT4_EINODE_GET_XTIME(i_crtime, ei, raw_inode);
 
-   if (EXT4_SB(inode-i_sb)-s_es-s_creator_os !=
-   cpu_to_le32(EXT4_OS_HURD)) {
+   if (!test_opt2(inode-i_sb, HURD_COMPAT)) {
inode-i_version = le32_to_cpu(raw_inode-i_disk_version);
if (EXT4_INODE_SIZE(inode-i_sb)  EXT4_GOOD_OLD_INODE_SIZE) {
if (EXT4_FITS_IN_INODE(raw_inode, ei, i_version_hi))
@@ -4345,8 +4344,7 @@ static int ext4_do_update_inode(handle_t *handle,
goto out_brelse;
raw_inode-i_dtime = cpu_to_le32(ei-i_dtime);
raw_inode-i_flags = cpu_to_le32(ei-i_flags  0x);
-   if (EXT4_SB(inode-i_sb)-s_es-s_creator_os !=
-   cpu_to_le32(EXT4_OS_HURD))
+   if (!test_opt2(inode-i_sb, HURD_COMPAT))
raw_inode-i_file_acl_high =
cpu_to_le16(ei-i_file_acl  32);
raw_inode-i_file_acl_lo = cpu_to_le32(ei-i_file_acl);
@@ -4391,8 +4389,7 @@ static int ext4_do_update_inode(handle_t *handle,
raw_inode-i_block[block] = ei-i_data[block];
}
 
-   if (EXT4_SB(inode-i_sb)-s_es-s_creator_os !=
-   cpu_to_le32(EXT4_OS_HURD)) {
+   if (!test_opt2(inode-i_sb, HURD_COMPAT)) {
raw_inode-i_disk_version = cpu_to_le32(inode-i_version);
if (ei-i_extra_isize) {
if (EXT4_FITS_IN_INODE(raw_inode, ei, i_version_hi))
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 3c9eadf..6adee9a 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -3580,6 +3580,16 @@ static int ext4_fill_super(struct super_block *sb, void 
*data, int silent)
   feature flags set on rev 0 fs, 
   running e2fsck is recommended);
 
+   if (es-s_creator_os == cpu_to_le32(EXT4_OS_HURD)) {
+   set_opt2(sb, HURD_COMPAT);
+   if (EXT4_HAS_INCOMPAT_FEATURE(sb,
+ EXT4_FEATURE_INCOMPAT_64BIT)) {
+   ext4_msg(sb, KERN_ERR,
+The Hurd can't support 64-bit file systems);
+   goto failed_mount;
+   }
+   }
+
if (IS_EXT2_SB(sb)) {
if (ext2_feature_set_ok(sb))
ext4_msg(sb, KERN_INFO, mounting ext2 file system 
-- 
1.9.0


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#738758: [PATCH] ext4: optimize Hurd tests when reading/writing inodes

2014-03-21 Thread Samuel Thibault
Theodore Ts'o, le Fri 21 Mar 2014 12:48:53 -0400, a écrit :
 Also, add a sanity check to make sure the 64-bit feature is not set
 for Hurd file systems, since i_file_acl_high conflicts with a
 Hurd-specific field. This is not a big deal, since Hurd doesn't
 support file systems larger than 1GB[1] anyway.

Err, it does. We regularly use volumes with dozens of GiB.

 [1] http://walfield.org/pub/people/neal/papers/hurd-faq/FAQ.en.html#q2-6

That faq is very largely outdated.  See the official faq on 

http://www.gnu.org/software/hurd/faq.html

Samuel


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org