Skip to contentSkip to conversation

ext4: commit inline data during fast commit

PATCH Applied Harshad Shirwadkar 2 participants 3 messages Oct 15, 2021 – Nov 4, 2021 ext4 file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 ext4: commit inline data during fast commit

From: Harshad Shirwadkar <[email protected]>

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.

---
 fs/ext4/fast_commit.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
fs/ext4/fast_commit.c +3 -1
index 8ea5a81e6554..744b000d9756 100644
@@ -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);
Signature · 1 line
2.33.0.882.g93a45727a2-goog
#1 lore raw

PATCH 2/2 ext4: inline data inode fast commit replay fixes

From: Harshad Shirwadkar <[email protected]>

Since there are no blocks in an inline data inode, there's no point in fixing iblocks field in fast commit replay path for this inode. Similarly, there's no point in fixing any block bitmaps / global block counters with respect to such an inode. Just bail out from these functions if an inline data inode is encountered.

---
 fs/ext4/extents.c     | 3 +++
 fs/ext4/fast_commit.c | 7 ++++++-
 2 files changed, 9 insertions(+), 1 deletion(-)
fs/ext4/extents.c +3 -0
index 09f56e04f4b2..0ecf819bf189 100644
@@ -6071,6 +6071,9 @@ int ext4_ext_clear_bb(struct inode *inode)
 	int j, ret = 0;
 	struct ext4_map_blocks map;
 
+	if (ext4_test_inode_flag(inode, EXT4_INODE_INLINE_DATA))
+		return 0;
+
 	/* Determin the size of the file first */
 	path = ext4_find_extent(inode, EXT_MAX_BLOCKS - 1, NULL,
 					EXT4_EX_NOCACHE);
fs/ext4/fast_commit.c +6 -1
index 744b000d9756..0f32b445582a 100644
@@ -1526,7 +1526,8 @@ static int ext4_fc_replay_inode(struct super_block *sb, struct ext4_fc_tl *tl,
 	 * crashing. This should be fixed but until then, we calculate
 	 * the number of blocks the inode.
 	 */
-	ext4_ext_replay_set_iblocks(inode);
+	if (!ext4_test_inode_flag(inode, EXT4_INODE_INLINE_DATA))
+		ext4_ext_replay_set_iblocks(inode);
 
 	inode->i_generation = le32_to_cpu(ext4_raw_inode(&iloc)->i_generation);
 	ext4_reset_inode_seed(inode);
@@ -1844,6 +1845,10 @@ static void ext4_fc_set_bitmaps_and_counters(struct super_block *sb)
 		}
 		cur = 0;
 		end = EXT_MAX_BLOCKS;
+		if (ext4_test_inode_flag(inode, EXT4_INODE_INLINE_DATA)) {
+			iput(inode);
+			continue;
+		}
 		while (cur < end) {
 			map.m_lblk = cur;
 			map.m_len = end - cur;
Signature · 1 line
2.33.0.882.g93a45727a2-goog
maintainer Applied
#2 lore raw
In reply to Harshad Shirwadkar
Quoted 9 lines · Harshad Shirwadkar

From: Harshad Shirwadkar <[email protected]>

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.

[...]

Applied, thanks!

[1/2] ext4: commit inline data during fast commit

      commit: 6c31a689b2e9e1dee5cbe16b773648a2d84dfb02
[2/2] ext4: inline data inode fast commit replay fixes
      commit: 1ebf21784b19d5bc269f39a5d1eedb7f29a7d152

Best regards,

Signature · 1 line
Theodore Ts'o <[email protected]>