aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2014-03-24 14:09:06 -0400
committerTheodore Ts'o <tytso@mit.edu>2014-03-24 14:09:06 -0400
commited3654eb981fd44694b4d2a636e13f998bc10e7f (patch)
tree133c6cd3044dc9aa628065550b873ba86d79c2f3
parentc4f65706056e9f0c2cf126b29c6920a179d91150 (diff)
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: "Theodore Ts'o" <tytso@mit.edu>
-rw-r--r--fs/ext4/ext4.h2
-rw-r--r--fs/ext4/inode.c9
-rw-r--r--fs/ext4/super.c10
3 files changed, 15 insertions, 6 deletions
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index f4f889e6df83..e01135d791ca 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -1001,6 +1001,8 @@ struct ext4_inode_info {
1001#define EXT4_MOUNT2_STD_GROUP_SIZE 0x00000002 /* We have standard group 1001#define EXT4_MOUNT2_STD_GROUP_SIZE 0x00000002 /* We have standard group
1002 size of blocksize * 8 1002 size of blocksize * 8
1003 blocks */ 1003 blocks */
1004#define EXT4_MOUNT2_HURD_COMPAT 0x00000004 /* Support HURD-castrated
1005 file systems */
1004 1006
1005#define clear_opt(sb, opt) EXT4_SB(sb)->s_mount_opt &= \ 1007#define clear_opt(sb, opt) EXT4_SB(sb)->s_mount_opt &= \
1006 ~EXT4_MOUNT_##opt 1008 ~EXT4_MOUNT_##opt
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index ed2c13a7f293..b5e182acf9b9 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)
4168 EXT4_INODE_GET_XTIME(i_atime, inode, raw_inode); 4168 EXT4_INODE_GET_XTIME(i_atime, inode, raw_inode);
4169 EXT4_EINODE_GET_XTIME(i_crtime, ei, raw_inode); 4169 EXT4_EINODE_GET_XTIME(i_crtime, ei, raw_inode);
4170 4170
4171 if (EXT4_SB(inode->i_sb)->s_es->s_creator_os != 4171 if (likely(!test_opt2(inode->i_sb, HURD_COMPAT))) {
4172 cpu_to_le32(EXT4_OS_HURD)) {
4173 inode->i_version = le32_to_cpu(raw_inode->i_disk_version); 4172 inode->i_version = le32_to_cpu(raw_inode->i_disk_version);
4174 if (EXT4_INODE_SIZE(inode->i_sb) > EXT4_GOOD_OLD_INODE_SIZE) { 4173 if (EXT4_INODE_SIZE(inode->i_sb) > EXT4_GOOD_OLD_INODE_SIZE) {
4175 if (EXT4_FITS_IN_INODE(raw_inode, ei, i_version_hi)) 4174 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 goto out_brelse; 4344 goto out_brelse;
4346 raw_inode->i_dtime = cpu_to_le32(ei->i_dtime); 4345 raw_inode->i_dtime = cpu_to_le32(ei->i_dtime);
4347 raw_inode->i_flags = cpu_to_le32(ei->i_flags & 0xFFFFFFFF); 4346 raw_inode->i_flags = cpu_to_le32(ei->i_flags & 0xFFFFFFFF);
4348 if (EXT4_SB(inode->i_sb)->s_es->s_creator_os != 4347 if (likely(!test_opt2(inode->i_sb, HURD_COMPAT)))
4349 cpu_to_le32(EXT4_OS_HURD))
4350 raw_inode->i_file_acl_high = 4348 raw_inode->i_file_acl_high =
4351 cpu_to_le16(ei->i_file_acl >> 32); 4349 cpu_to_le16(ei->i_file_acl >> 32);
4352 raw_inode->i_file_acl_lo = cpu_to_le32(ei->i_file_acl); 4350 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 raw_inode->i_block[block] = ei->i_data[block]; 4389 raw_inode->i_block[block] = ei->i_data[block];
4392 } 4390 }
4393 4391
4394 if (EXT4_SB(inode->i_sb)->s_es->s_creator_os != 4392 if (likely(!test_opt2(inode->i_sb, HURD_COMPAT))) {
4395 cpu_to_le32(EXT4_OS_HURD)) {
4396 raw_inode->i_disk_version = cpu_to_le32(inode->i_version); 4393 raw_inode->i_disk_version = cpu_to_le32(inode->i_version);
4397 if (ei->i_extra_isize) { 4394 if (ei->i_extra_isize) {
4398 if (EXT4_FITS_IN_INODE(raw_inode, ei, i_version_hi)) 4395 if (EXT4_FITS_IN_INODE(raw_inode, ei, i_version_hi))
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 5a51af7d0335..f3c667091618 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)
3580 "feature flags set on rev 0 fs, " 3580 "feature flags set on rev 0 fs, "
3581 "running e2fsck is recommended"); 3581 "running e2fsck is recommended");
3582 3582
3583 if (es->s_creator_os == cpu_to_le32(EXT4_OS_HURD)) {
3584 set_opt2(sb, HURD_COMPAT);
3585 if (EXT4_HAS_INCOMPAT_FEATURE(sb,
3586 EXT4_FEATURE_INCOMPAT_64BIT)) {
3587 ext4_msg(sb, KERN_ERR,
3588 "The Hurd can't support 64-bit file systems");
3589 goto failed_mount;
3590 }
3591 }
3592
3583 if (IS_EXT2_SB(sb)) { 3593 if (IS_EXT2_SB(sb)) {
3584 if (ext2_feature_set_ok(sb)) 3594 if (ext2_feature_set_ok(sb))
3585 ext4_msg(sb, KERN_INFO, "mounting ext2 file system " 3595 ext4_msg(sb, KERN_INFO, "mounting ext2 file system "