Skip to content

Commit

Permalink
f2fs: truncate blocks in batch in __complete_revoke_list()
Browse files Browse the repository at this point in the history
Use f2fs_do_truncate_blocks() to truncate all blocks in-batch in
__complete_revoke_list().

Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
  • Loading branch information
chaseyu authored and Jaegeuk Kim committed Nov 28, 2022
1 parent 6208163 commit 78a99fe
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions fs/f2fs/segment.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,24 +262,19 @@ 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, start_index * PAGE_SIZE, false);
f2fs_do_truncate_blocks(inode, 0, false);
}

static int __f2fs_commit_atomic_write(struct inode *inode)
Expand Down

0 comments on commit 78a99fe

Please sign in to comment.