ext4: commit inline data during fast commit
authorHarshad Shirwadkar <harshadshirwadkar@gmail.com>
Fri, 15 Oct 2021 18:25:12 +0000 (11:25 -0700)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 4 Nov 2021 14:34:39 +0000 (10:34 -0400)
During the commit phase in fast commits if an inode with inline data
is being committed, also commit the inline data along with
inode. Since recovery code just blindly copies entire content found in
inode TLV, there is no change needed on the recovery path. Thus, this
change is backward compatiable.

Signed-off-by: Harshad Shirwadkar <harshadshirwadkar@gmail.com>
Link: https://lore.kernel.org/r/20211015182513.395917-1-harshads@google.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/ext4/fast_commit.c

index 8ea5a81e655489e48a1adbcdc27b7f653a88b3b4..744b000d9756f34d851261d6a59b2cc646f0109d 100644 (file)
@@ -819,7 +819,9 @@ static int ext4_fc_write_inode(struct inode *inode, u32 *crc)
        if (ret)
                return ret;
 
-       if (EXT4_INODE_SIZE(inode->i_sb) > EXT4_GOOD_OLD_INODE_SIZE)
+       if (ext4_test_inode_flag(inode, EXT4_INODE_INLINE_DATA))
+               inode_len = EXT4_INODE_SIZE(inode->i_sb);
+       else if (EXT4_INODE_SIZE(inode->i_sb) > EXT4_GOOD_OLD_INODE_SIZE)
                inode_len += ei->i_extra_isize;
 
        fc_inode.fc_ino = cpu_to_le32(inode->i_ino);