i_inline_size caches the total size of the inline data, it is always EXT4_MIN_INLINE_DATA_SIZE plus the size of the system.data xattr value. This avoids looking up for the entry again, which allows i_inline_off to be used to point directly to the inline data. Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@xxxxxxxxxx> --- fs/ext4/inline.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c index 0611a050668b..b49cfcadbd36 100644 --- a/fs/ext4/inline.c +++ b/fs/ext4/inline.c @@ -80,10 +80,8 @@ static int get_max_inline_xattr_value_size(struct inode *inode, ((void *)entry - (void *)IFIRST(header)) - sizeof(__u32); if (EXT4_I(inode)->i_inline_off) { - entry = (struct ext4_xattr_entry *) - ((void *)raw_inode + EXT4_I(inode)->i_inline_off); - - free += EXT4_XATTR_SIZE(le32_to_cpu(entry->e_value_size)); + free += EXT4_I(inode)->i_inline_size - + EXT4_MIN_INLINE_DATA_SIZE; goto out; } -- 2.34.1