From patchwork Mon Mar 31 20:11:35 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthew Wilcox (Oracle)" X-Patchwork-Id: 14033958 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 lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D208FC369A8 for ; Mon, 31 Mar 2025 20:13:27 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1tzLVe-0000zM-Lr; Mon, 31 Mar 2025 20:13:27 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1tzLVc-0000w7-1l for linux-f2fs-devel@lists.sourceforge.net; Mon, 31 Mar 2025 20:13:24 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=vQuti0SaeWaOVQc/vdG7gHGYzIy+/EOSeli3KgBSe80=; b=krqK8yKxM3WzbINCgXfGw/Wqtc u9r8qqKtCkIQckakekswsal4y3S+QF6Gpm2/eYlKcUx3AhEr/zZUmikH//6cvAgMpi0kMXkzYrYb6 MyDfQnHSI0G4mpmQxMM6mpZl3jqjsiWWAKDzUbtYb6Ze5Oeol/uwrVPEZ6UvHWM1SZG4=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=vQuti0SaeWaOVQc/vdG7gHGYzIy+/EOSeli3KgBSe80=; b=J9VetMtL03UH4ji7zRYedB++VJ 7Ry+2X5CS6Hfss6BGtkktIeWGDAqDoQXHixWsUdjTAuC2G53uZWMrXaCdZuiuLIuNU2TwVK7fARCL inSJt1+OqSWIbPp87KThxo1TAFU9xDoRuilqu/fbfONH3VRMDAjkUWnzfAkJIrsw2zRc=; Received: from casper.infradead.org ([90.155.50.34]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1tzLVc-0003cA-1J for linux-f2fs-devel@lists.sourceforge.net; Mon, 31 Mar 2025 20:13:24 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=vQuti0SaeWaOVQc/vdG7gHGYzIy+/EOSeli3KgBSe80=; b=PfwfGKrRjWG9HKs5C9o0NhjtlZ KekDAec3chuEZiLCkDtfNtNgtmrdp7b/1nx2Zl8SFqKCggIj+GO+YbkN0QF+zBsC+gKNFJkt1TW12 tg7osXGRCHqyIwAr2zo8fEk2mGKDWMCbMEYSzINH+r243BdY2MweTD27tr3AzXzPVvSou2zL0dnP8 6gaXcVsrZACXsVMW6FKTSYV63ltnJCeGcrTTOOOkcWqxTi08+YzDq71k3ue3icGsb/AACiqCSVCao uqSHMBoI1s9Z6Nkka61sXZRm/YjQCHsHu/c7G2tvyGWLvWDlTtURkN+ldIC7yTmYKw3EAnxiJEFDI T6UCZM5A==; Received: from willy by casper.infradead.org with local (Exim 4.98.1 #2 (Red Hat Linux)) id 1tzLVQ-00000004RwB-2w5S; Mon, 31 Mar 2025 20:13:12 +0000 From: "Matthew Wilcox (Oracle)" To: Jaegeuk Kim , Chao Yu Date: Mon, 31 Mar 2025 21:11:35 +0100 Message-ID: <20250331201256.1057782-76-willy@infradead.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250331201256.1057782-1-willy@infradead.org> References: <20250331201256.1057782-1-willy@infradead.org> MIME-Version: 1.0 X-Headers-End: 1tzLVc-0003cA-1J Subject: [f2fs-dev] [PATCH 075/153] f2fs: Use a folio in truncate_node() X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Matthew Wilcox \(Oracle\)" , linux-f2fs-devel@lists.sourceforge.net Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net Remove two calls to compound_head() Signed-off-by: Matthew Wilcox (Oracle) --- fs/f2fs/node.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index 1c6eeed110c9..8a94bae2ab78 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c @@ -948,35 +948,35 @@ static int truncate_node(struct dnode_of_data *dn) static int truncate_dnode(struct dnode_of_data *dn) { struct f2fs_sb_info *sbi = F2FS_I_SB(dn->inode); - struct page *page; + struct folio *folio; int err; if (dn->nid == 0) return 1; /* get direct node */ - page = f2fs_get_node_page(sbi, dn->nid); - if (PTR_ERR(page) == -ENOENT) + folio = f2fs_get_node_folio(sbi, dn->nid); + if (PTR_ERR(folio) == -ENOENT) return 1; - else if (IS_ERR(page)) - return PTR_ERR(page); + else if (IS_ERR(folio)) + return PTR_ERR(folio); - if (IS_INODE(page) || ino_of_node(page) != dn->inode->i_ino) { + if (IS_INODE(&folio->page) || ino_of_node(&folio->page) != dn->inode->i_ino) { f2fs_err(sbi, "incorrect node reference, ino: %lu, nid: %u, ino_of_node: %u", - dn->inode->i_ino, dn->nid, ino_of_node(page)); + dn->inode->i_ino, dn->nid, ino_of_node(&folio->page)); set_sbi_flag(sbi, SBI_NEED_FSCK); f2fs_handle_error(sbi, ERROR_INVALID_NODE_REFERENCE); - f2fs_put_page(page, 1); + f2fs_folio_put(folio, true); return -EFSCORRUPTED; } /* Make dnode_of_data for parameter */ - dn->node_page = page; + dn->node_page = &folio->page; dn->ofs_in_node = 0; f2fs_truncate_data_blocks_range(dn, ADDRS_PER_BLOCK(dn->inode)); err = truncate_node(dn); if (err) { - f2fs_put_page(page, 1); + f2fs_folio_put(folio, true); return err; }