Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DF44DC05027 for ; Tue, 14 Feb 2023 23:56:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232081AbjBNX4Z (ORCPT ); Tue, 14 Feb 2023 18:56:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231859AbjBNX4X (ORCPT ); Tue, 14 Feb 2023 18:56:23 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91B66298EB for ; Tue, 14 Feb 2023 15:56:19 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0AEBF61926 for ; Tue, 14 Feb 2023 23:56:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6192EC433D2; Tue, 14 Feb 2023 23:56:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1676418978; bh=CDOdJeZlCWxqbV99sTba14WZbJVfBaY7nL6v9btB62Q=; h=From:To:Cc:Subject:Date:From; b=QNSvXlcqymGkSg9lCm72m1uWqSuaw0vKQJnBMpQXGKlv0v071Dx9MGVm9NmPilNTh EiS6Y36GSgSdd4WSYwR8u5Zwvml0sq2I3kqYokDz8fbpwWgUjYSOtpheQgCoX/+8H7 ffbN0SO1ztQDbCSDGEfEklcJTg8u5aDBRvtoiCF3Fh7+R6aPBm2It0VxvX0uj6CnGG NIS0IOTabZzYnx5ysuB+dFX6DJSHLr988SQasCA4fQ0vb4IVyemfwjZrsVskJvzDKY gqtVi1gcoCTH+uqKPjoK3sO6IxGcx/Hd4Ot0d/zFTIMjQquRD+yZtzdLyDX2xJe4GR zhRfUR5ew66Ug== From: Jaegeuk Kim To: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Cc: Jaegeuk Kim Subject: [PATCH] f2fs: Revert "f2fs: truncate blocks in batch in __complete_revoke_list()" Date: Tue, 14 Feb 2023 15:56:16 -0800 Message-Id: <20230214235616.799235-1-jaegeuk@kernel.org> X-Mailer: git-send-email 2.39.1.581.gbfd45094c4-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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