From patchwork Tue Aug 20 14:55:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chao Yu X-Patchwork-Id: 13770337 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 6D0B9C531DF for ; Tue, 20 Aug 2024 14:55:41 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1sgQGr-0005yU-3b; Tue, 20 Aug 2024 14:55:41 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1sgQGo-0005yF-QG for linux-f2fs-devel@lists.sourceforge.net; Tue, 20 Aug 2024 14:55:38 +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=loFIPCariodcezIm7vURmikq8qlYJs1bGmAvOLs/g68=; b=DhyBQVb7qZ6Ma+RPVQ3vIN307S 4p53JqQ1y9RVaSwF/t5Z7/3QCtvPGiAv+ctcqfg0nBPqrWZt57RaUmBnQC+S/6rQf3Ad9Vlc/XExG gWm0j0cx21cF+19Dq4UUlIr4K32+90GlznznIy/YizzvSls8C+nv2mqNtOHuISQtAxRQ=; 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=loFIPCariodcezIm7vURmikq8qlYJs1bGmAvOLs/g68=; b=VogrXVqcmwy3GBoZUJlELzbacd +HmcH5QV4oxJXciIwqMz5xdkUkGa4ea17F/TWLe8PyUx/4a5Nve3dSRA9JmDfne4s86fLzyFtd76e CJCGj5YAQdL7FXrUDBgunYxh8YnrLELWg2i471OueRI/J91qr2i9lUNou6/u7I5zFV+k=; Received: from dfw.source.kernel.org ([139.178.84.217]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1sgQGo-0003JN-3Q for linux-f2fs-devel@lists.sourceforge.net; Tue, 20 Aug 2024 14:55:38 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id B1A1260E04; Tue, 20 Aug 2024 14:55:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3EB95C4AF0C; Tue, 20 Aug 2024 14:55:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1724165727; bh=kXH69VauKPWX1aj+cT6JMgD13fkLJ9/JjHzU17y6Nko=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hN4P0Ef4pPnjn9ejoENvDu9FM0V+enTyCspFPJWLIT4LKUb3GcpxjsAYw3QgCqThA +nX4KS1qmKRzcE0CHHxtb3PiiSqh9A8op00Ds2q2chD8XiLCDRZLRT/dunXFXwbVKA 9oYaAuQcRbba7Fvv+W68f0ujunEQiI9m6ikedBxRaYM0hOw1RYEh8WCxNVuxWU7AHf ds/U9HR8WcF4wwqiay3iGJSmhG+v5oxQ79UQmvJpvrraQ1L9fY9WUJN9VazP9IlBkB vnEMxAABWw9PqHEnIlzYoV4iromWWUSypEtAQnsbTYxYPOM1XsvqxT/kwphd9nEMT+ RMTvffIDcOMGA== From: Chao Yu To: jaegeuk@kernel.org Date: Tue, 20 Aug 2024 22:55:05 +0800 Message-Id: <20240820145507.1372905-7-chao@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240820145507.1372905-1-chao@kernel.org> References: <20240820145507.1372905-1-chao@kernel.org> MIME-Version: 1.0 X-Headers-End: 1sgQGo-0003JN-3Q Subject: [f2fs-dev] [PATCH v3 7/9] f2fs: convert __write_node_page() to use folio 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: linux-kernel@vger.kernel.org, Matthew Wilcox , linux-f2fs-devel@lists.sourceforge.net Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net Convert to use folio, so that we can get rid of 'page->index' to prepare for removal of 'index' field in structure page [1]. [1] https://lore.kernel.org/all/Zp8fgUSIBGQ1TN0D@casper.infradead.org/ Cc: Matthew Wilcox Signed-off-by: Chao Yu --- fs/f2fs/node.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index 7beaa3690e03..aeda3eecc9e2 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c @@ -1608,6 +1608,7 @@ static int __write_node_page(struct page *page, bool atomic, bool *submitted, enum iostat_type io_type, unsigned int *seq_id) { struct f2fs_sb_info *sbi = F2FS_P_SB(page); + struct folio *folio = page_folio(page); nid_t nid; struct node_info ni; struct f2fs_io_info fio = { @@ -1624,15 +1625,15 @@ static int __write_node_page(struct page *page, bool atomic, bool *submitted, }; unsigned int seq; - trace_f2fs_writepage(page_folio(page), NODE); + trace_f2fs_writepage(folio, NODE); if (unlikely(f2fs_cp_error(sbi))) { /* keep node pages in remount-ro mode */ if (F2FS_OPTION(sbi).errors == MOUNT_ERRORS_READONLY) goto redirty_out; - ClearPageUptodate(page); + folio_clear_uptodate(folio); dec_page_count(sbi, F2FS_DIRTY_NODES); - unlock_page(page); + folio_unlock(folio); return 0; } @@ -1646,7 +1647,7 @@ static int __write_node_page(struct page *page, bool atomic, bool *submitted, /* get old block addr of this node page */ nid = nid_of_node(page); - f2fs_bug_on(sbi, page->index != nid); + f2fs_bug_on(sbi, folio->index != nid); if (f2fs_get_node_info(sbi, nid, &ni, !do_balance)) goto redirty_out; @@ -1660,10 +1661,10 @@ static int __write_node_page(struct page *page, bool atomic, bool *submitted, /* This page is already truncated */ if (unlikely(ni.blk_addr == NULL_ADDR)) { - ClearPageUptodate(page); + folio_clear_uptodate(folio); dec_page_count(sbi, F2FS_DIRTY_NODES); f2fs_up_read(&sbi->node_write); - unlock_page(page); + folio_unlock(folio); return 0; } @@ -1684,7 +1685,7 @@ static int __write_node_page(struct page *page, bool atomic, bool *submitted, *seq_id = seq; } - set_page_writeback(page); + folio_start_writeback(folio); fio.old_blkaddr = ni.blk_addr; f2fs_do_write_node_page(nid, &fio); @@ -1697,7 +1698,7 @@ static int __write_node_page(struct page *page, bool atomic, bool *submitted, submitted = NULL; } - unlock_page(page); + folio_unlock(folio); if (unlikely(f2fs_cp_error(sbi))) { f2fs_submit_merged_write(sbi, NODE); @@ -1711,7 +1712,7 @@ static int __write_node_page(struct page *page, bool atomic, bool *submitted, return 0; redirty_out: - redirty_page_for_writepage(wbc, page); + folio_redirty_for_writepage(wbc, folio); return AOP_WRITEPAGE_ACTIVATE; }