Commit ed3654eb authored by Theodore Ts'o's avatar Theodore Ts'o

ext4: optimize Hurd tests when reading/writing inodes

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: default avatar"Theodore Ts'o" <tytso@mit.edu>
parent c4f65706
...@@ -1001,6 +1001,8 @@ struct ext4_inode_info { ...@@ -1001,6 +1001,8 @@ struct ext4_inode_info {
#define EXT4_MOUNT2_STD_GROUP_SIZE 0x00000002 /* We have standard group #define EXT4_MOUNT2_STD_GROUP_SIZE 0x00000002 /* We have standard group
size of blocksize * 8 size of blocksize * 8
blocks */ blocks */
#define EXT4_MOUNT2_HURD_COMPAT 0x00000004 /* Support HURD-castrated
file systems */
#define clear_opt(sb, opt) EXT4_SB(sb)->s_mount_opt &= \ #define clear_opt(sb, opt) EXT4_SB(sb)->s_mount_opt &= \
~EXT4_MOUNT_##opt ~EXT4_MOUNT_##opt
......
...@@ -4168,8 +4168,7 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino) ...@@ -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_INODE_GET_XTIME(i_atime, inode, raw_inode);
EXT4_EINODE_GET_XTIME(i_crtime, ei, raw_inode); EXT4_EINODE_GET_XTIME(i_crtime, ei, raw_inode);
if (EXT4_SB(inode->i_sb)->s_es->s_creator_os != if (likely(!test_opt2(inode->i_sb, HURD_COMPAT))) {
cpu_to_le32(EXT4_OS_HURD)) {
inode->i_version = le32_to_cpu(raw_inode->i_disk_version); 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_INODE_SIZE(inode->i_sb) > EXT4_GOOD_OLD_INODE_SIZE) {
if (EXT4_FITS_IN_INODE(raw_inode, ei, i_version_hi)) if (EXT4_FITS_IN_INODE(raw_inode, ei, i_version_hi))
...@@ -4345,8 +4344,7 @@ static int ext4_do_update_inode(handle_t *handle, ...@@ -4345,8 +4344,7 @@ static int ext4_do_update_inode(handle_t *handle,
goto out_brelse; goto out_brelse;
raw_inode->i_dtime = cpu_to_le32(ei->i_dtime); raw_inode->i_dtime = cpu_to_le32(ei->i_dtime);
raw_inode->i_flags = cpu_to_le32(ei->i_flags & 0xFFFFFFFF); raw_inode->i_flags = cpu_to_le32(ei->i_flags & 0xFFFFFFFF);
if (EXT4_SB(inode->i_sb)->s_es->s_creator_os != if (likely(!test_opt2(inode->i_sb, HURD_COMPAT)))
cpu_to_le32(EXT4_OS_HURD))
raw_inode->i_file_acl_high = raw_inode->i_file_acl_high =
cpu_to_le16(ei->i_file_acl >> 32); cpu_to_le16(ei->i_file_acl >> 32);
raw_inode->i_file_acl_lo = cpu_to_le32(ei->i_file_acl); 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, ...@@ -4391,8 +4389,7 @@ static int ext4_do_update_inode(handle_t *handle,
raw_inode->i_block[block] = ei->i_data[block]; raw_inode->i_block[block] = ei->i_data[block];
} }
if (EXT4_SB(inode->i_sb)->s_es->s_creator_os != if (likely(!test_opt2(inode->i_sb, HURD_COMPAT))) {
cpu_to_le32(EXT4_OS_HURD)) {
raw_inode->i_disk_version = cpu_to_le32(inode->i_version); raw_inode->i_disk_version = cpu_to_le32(inode->i_version);
if (ei->i_extra_isize) { if (ei->i_extra_isize) {
if (EXT4_FITS_IN_INODE(raw_inode, ei, i_version_hi)) if (EXT4_FITS_IN_INODE(raw_inode, ei, i_version_hi))
......
...@@ -3580,6 +3580,16 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) ...@@ -3580,6 +3580,16 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
"feature flags set on rev 0 fs, " "feature flags set on rev 0 fs, "
"running e2fsck is recommended"); "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 (IS_EXT2_SB(sb)) {
if (ext2_feature_set_ok(sb)) if (ext2_feature_set_ok(sb))
ext4_msg(sb, KERN_INFO, "mounting ext2 file system " ext4_msg(sb, KERN_INFO, "mounting ext2 file system "
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment