Skip to content

Commit 152a7b0

Browse files
taoma-tmtytso
authored andcommitted
ext4: move extra inode read to a new function
Currently, in ext4_iget we do a simple check to see whether there does exist some information starting from the end of i_extra_size. With inline data added, this procedure is more complicated. So move it to a new function named ext4_iget_extra_inode. Signed-off-by: Tao Ma <[email protected]> Signed-off-by: "Theodore Ts'o" <[email protected]>
1 parent aeb1e5d commit 152a7b0

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

fs/ext4/inode.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3700,6 +3700,16 @@ static blkcnt_t ext4_inode_blocks(struct ext4_inode *raw_inode,
37003700
}
37013701
}
37023702

3703+
static inline void ext4_iget_extra_inode(struct inode *inode,
3704+
struct ext4_inode *raw_inode,
3705+
struct ext4_inode_info *ei)
3706+
{
3707+
__le32 *magic = (void *)raw_inode +
3708+
EXT4_GOOD_OLD_INODE_SIZE + ei->i_extra_isize;
3709+
if (*magic == cpu_to_le32(EXT4_XATTR_MAGIC))
3710+
ext4_set_inode_state(inode, EXT4_STATE_XATTR);
3711+
}
3712+
37033713
struct inode *ext4_iget(struct super_block *sb, unsigned long ino)
37043714
{
37053715
struct ext4_iloc iloc;
@@ -3842,11 +3852,7 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino)
38423852
ei->i_extra_isize = sizeof(struct ext4_inode) -
38433853
EXT4_GOOD_OLD_INODE_SIZE;
38443854
} else {
3845-
__le32 *magic = (void *)raw_inode +
3846-
EXT4_GOOD_OLD_INODE_SIZE +
3847-
ei->i_extra_isize;
3848-
if (*magic == cpu_to_le32(EXT4_XATTR_MAGIC))
3849-
ext4_set_inode_state(inode, EXT4_STATE_XATTR);
3855+
ext4_iget_extra_inode(inode, raw_inode, ei);
38503856
}
38513857
}
38523858

0 commit comments

Comments
 (0)