* [f2fs-dev] [PATCH] f2fs: Revert "f2fs: truncate blocks in batch in __complete_revoke_list()"
@ 2023-02-14 23:57 Jaegeuk Kim
2023-02-15 14:45 ` Chao Yu
2023-02-15 18:00 ` patchwork-bot+f2fs
0 siblings, 2 replies; 4+ messages in thread
From: Jaegeuk Kim @ 2023-02-14 23:57 UTC (permalink / raw)
To: linux-kernel, linux-f2fs-devel; +Cc: Jaegeuk Kim, stable
We should not truncate replaced blocks, and were supposed to truncate the first
part as well.
This reverts commit 78a99fe6254cad4be310cd84af39f6c46b668c72.
Cc: stable@vger.kernel.org
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
fs/f2fs/segment.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 719329c1808c..227e25836173 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -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)
--
2.39.1.581.gbfd45094c4-goog
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [f2fs-dev] [PATCH] f2fs: Revert "f2fs: truncate blocks in batch in __complete_revoke_list()"
2023-02-14 23:57 [f2fs-dev] [PATCH] f2fs: Revert "f2fs: truncate blocks in batch in __complete_revoke_list()" Jaegeuk Kim
@ 2023-02-15 14:45 ` Chao Yu
2023-02-15 18:00 ` patchwork-bot+f2fs
1 sibling, 0 replies; 4+ messages in thread
From: Chao Yu @ 2023-02-15 14:45 UTC (permalink / raw)
To: Jaegeuk Kim, linux-kernel, linux-f2fs-devel; +Cc: stable
On 2023/2/15 7:57, Jaegeuk Kim wrote:
> We should not truncate replaced blocks, and were supposed to truncate the first
> part as well.
>
> This reverts commit 78a99fe6254cad4be310cd84af39f6c46b668c72.
>
> Cc: stable@vger.kernel.org
> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Oh, my bad, thanks for fixing this.
Reviewed-by: Chao Yu <chao@kernel.org>
Thanks,
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [f2fs-dev] [PATCH] f2fs: Revert "f2fs: truncate blocks in batch in __complete_revoke_list()"
2023-02-14 23:57 [f2fs-dev] [PATCH] f2fs: Revert "f2fs: truncate blocks in batch in __complete_revoke_list()" Jaegeuk Kim
2023-02-15 14:45 ` Chao Yu
@ 2023-02-15 18:00 ` patchwork-bot+f2fs
1 sibling, 0 replies; 4+ messages in thread
From: patchwork-bot+f2fs @ 2023-02-15 18:00 UTC (permalink / raw)
To: Jaegeuk Kim; +Cc: linux-kernel, stable, linux-f2fs-devel
Hello:
This patch was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim <jaegeuk@kernel.org>:
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.
>
> Cc: stable@vger.kernel.org
> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
>
> [...]
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!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* [f2fs-dev] [PATCH] f2fs: Revert "f2fs: truncate blocks in batch in __complete_revoke_list()"
@ 2023-02-14 23:56 Jaegeuk Kim
0 siblings, 0 replies; 4+ messages in thread
From: Jaegeuk Kim @ 2023-02-14 23:56 UTC (permalink / raw)
To: linux-kernel, linux-f2fs-devel; +Cc: Jaegeuk Kim
We should not truncate replaced blocks, and were supposed to truncate the first
part as well.
This reverts commit 78a99fe6254cad4be310cd84af39f6c46b668c72.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
fs/f2fs/segment.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 719329c1808c..227e25836173 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -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)
--
2.39.1.581.gbfd45094c4-goog
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-02-15 18:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-14 23:57 [f2fs-dev] [PATCH] f2fs: Revert "f2fs: truncate blocks in batch in __complete_revoke_list()" Jaegeuk Kim
2023-02-15 14:45 ` Chao Yu
2023-02-15 18:00 ` patchwork-bot+f2fs
-- strict thread matches above, loose matches on Subject: below --
2023-02-14 23:56 Jaegeuk Kim
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).