]> git.baikalelectronics.ru Git - kernel.git/commitdiff
ext4: move where set the MAY_INLINE_DATA flag is set
authorYe Bin <yebin10@huawei.com>
Tue, 7 Mar 2023 01:52:52 +0000 (09:52 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 17 Mar 2023 07:50:16 +0000 (08:50 +0100)
commit 675ec4a426f2360174a632ccdb7a883bc59b04d6 upstream.

The only caller of ext4_find_inline_data_nolock() that needs setting of
EXT4_STATE_MAY_INLINE_DATA flag is ext4_iget_extra_inode().  In
ext4_write_inline_data_end() we just need to update inode->i_inline_off.
Since we are going to add one more caller that does not need to set
EXT4_STATE_MAY_INLINE_DATA, just move setting of EXT4_STATE_MAY_INLINE_DATA
out to ext4_iget_extra_inode().

Signed-off-by: Ye Bin <yebin10@huawei.com>
Cc: stable@kernel.org
Reviewed-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20230307015253.2232062-2-yebin@huaweicloud.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/ext4/inline.c
fs/ext4/inode.c

index a4fbe825694b10bc0d477fbc897813b523d0cf2e..c4475a74c7626ad6db0e6f09950f828a1852e037 100644 (file)
@@ -159,7 +159,6 @@ int ext4_find_inline_data_nolock(struct inode *inode)
                                        (void *)ext4_raw_inode(&is.iloc));
                EXT4_I(inode)->i_inline_size = EXT4_MIN_INLINE_DATA_SIZE +
                                le32_to_cpu(is.s.here->e_value_size);
-               ext4_set_inode_state(inode, EXT4_STATE_MAY_INLINE_DATA);
        }
 out:
        brelse(is.iloc.bh);
index 283afda26d9cb6ca390ad313fccb039b2586adc2..34c87fcfd0617634394b59c3f821f20a12d1eea9 100644 (file)
@@ -4727,8 +4727,13 @@ static inline int ext4_iget_extra_inode(struct inode *inode,
 
        if (EXT4_INODE_HAS_XATTR_SPACE(inode)  &&
            *magic == cpu_to_le32(EXT4_XATTR_MAGIC)) {
+               int err;
+
                ext4_set_inode_state(inode, EXT4_STATE_XATTR);
-               return ext4_find_inline_data_nolock(inode);
+               err = ext4_find_inline_data_nolock(inode);
+               if (!err && ext4_has_inline_data(inode))
+                       ext4_set_inode_state(inode, EXT4_STATE_MAY_INLINE_DATA);
+               return err;
        } else
                EXT4_I(inode)->i_inline_off = 0;
        return 0;