Skip to contentSkip to conversation

f2fs: Revert "f2fs: truncate blocks in batch in __complete_revoke_list()"

PATCH Applied Jaegeuk Kim 3 participants 3 messages Feb 14, 2023 – Feb 15, 2023

Subsystems (2)
lore
Share & tools
lore

Jaegeuk Kim

author maintainer
#0 lore raw

PATCH 1/1 f2fs: Revert "f2fs: truncate blocks in batch in __complete_revoke_list()"

We should not truncate replaced blocks, and were supposed to truncate the first part as well.

This reverts commit 78a99fe6254cad4be310cd84af39f6c46b668c72.

---
 fs/f2fs/segment.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
fs/f2fs/segment.c +7 -2
index 719329c1808c..227e25836173 100644
@@ -265,19 +265,24 @@ static void __complete_revoke_list(struct inode *inode, struct list_head *head,
 					bool revoke)
 {
 	struct revoke_entry *cur, *tmp;
+	pgoff_t start_index = 0;
 	bool truncate = is_inode_flag_set(inode, FI_ATOMIC_REPLACE);
 
 	list_for_each_entry_safe(cur, tmp, head, list) {
-		if (revoke)
+		if (revoke) {
 			__replace_atomic_write_block(inode, cur->index,
 						cur->old_addr, NULL, true);
+		} else if (truncate) {
+			f2fs_truncate_hole(inode, start_index, cur->index);
+			start_index = cur->index + 1;
+		}
 
 		list_del(&cur->list);
 		kmem_cache_free(revoke_entry_slab, cur);
 	}
 
 	if (!revoke && truncate)
-		f2fs_do_truncate_blocks(inode, 0, false);
+		f2fs_do_truncate_blocks(inode, start_index * PAGE_SIZE, false);
 }
 
 static int __f2fs_commit_atomic_write(struct inode *inode)
Signature · 8 lines
2.39.1.581.gbfd45094c4-goog



_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
#2 lore raw
In reply to Jaegeuk Kim
This patch was applied to jaegeuk/f2fs.git (dev) by Jaegeuk Kim <[email protected]>:

Hello:

This patch was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim <[email protected]>:

Quoted 9 lines · On Tue, 14 Feb 2023 15:57:19 -0800 you wrote:

We should not truncate replaced blocks, and were supposed to truncate the first part as well.

This reverts commit 78a99fe6254cad4be310cd84af39f6c46b668c72.

[...]

Here is the summary with links:
- [f2fs-dev] f2fs: Revert "f2fs: truncate blocks in batch in __complete_revoke_list()"

    https://git.kernel.org/jaegeuk/f2fs/c/c7dbc0668829

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html