From patchwork Tue Aug 20 14:55:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chao Yu X-Patchwork-Id: 13770333 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 4E04EC54722 for ; Tue, 20 Aug 2024 14:55:37 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1sgQGm-00082C-4i; Tue, 20 Aug 2024 14:55:36 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1sgQGk-000824-W1 for linux-f2fs-devel@lists.sourceforge.net; Tue, 20 Aug 2024 14:55:35 +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=hJ395t/DI3f3KuV2Ba3nm6yeqnl7hQuZTauYfbbIJAw=; b=KA1c7dx2Z1wXJzcBqFEfjldwEf AT7sUneNtb4H2uGQBoqjg1uhFaCes/rynJW52D/GeB8wrjujzyFL/nDYNMVoaARnhIB6+XFYt/nuK iRAsz/TXSfa9liEK020+wMwFw+ZK7Y+295Bo261qRaGEjugJb6AHsh+KFmoBAEeTAKuk=; 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=hJ395t/DI3f3KuV2Ba3nm6yeqnl7hQuZTauYfbbIJAw=; b=FZN/23DnzKDq9GsXMzEdG41g3V s9kzcZ+sVqHqqFrdKVvUQsQv1kg/i4zSK6GWqegWEvru2umcgXRLu8iPEyLFkhJxSSMY3/lp4WdEU nMtBH5+HyW7aJgR7pP0XycT1w08h/w7cQ16K0142eKJPOLPhWwqlMI9n5Ohvfdp/M/ZI=; 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 1sgQGk-0003JA-Hd for linux-f2fs-devel@lists.sourceforge.net; Tue, 20 Aug 2024 14:55:35 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 3543360C87; Tue, 20 Aug 2024 14:55:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B38C9C4AF0F; Tue, 20 Aug 2024 14:55:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1724165724; bh=kI9JNrkqcWakqf9nzqIrzXTTjP9TFX7SUhwYCeGt3EY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ocMVQX4yvZXXOw7EB9CKyPfWAPT34+sT1q7W9pU+vK0pGK+Hauttq5icAxeX/NauH mHAc36H9eWAyroe0RN27R8a+xzt/pq0yAWx6HA20RTNdJwEUwr4r5wq+xpfF1zRkFh P9SGzliUI5/WLwoCwknMame3neclrreHFaC/YMN29CctYUQ6nA5DlC+IgtHNv2bi+c a7qM9aj2nlE/Qc0epWV6LWuMJkOH6ZzUErYB+0RQTzi3M7UZEWY7YLJnu5xElBYiOl Dg9lVUNg6bhJRIsyAEMdiaFOkVMjdTVppzhIzljhlCGI7RFS11VVOG/TywCpGxit9y yCKJOny9Hi97A== From: Chao Yu To: jaegeuk@kernel.org Date: Tue, 20 Aug 2024 22:55:03 +0800 Message-Id: <20240820145507.1372905-5-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: 1sgQGk-0003JA-Hd Subject: [f2fs-dev] [PATCH v3 5/9] f2fs: convert f2fs_do_write_data_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/data.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index e114d738b6b4..c57ddee2c7c5 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -2648,8 +2648,8 @@ static inline bool need_inplace_update(struct f2fs_io_info *fio) int f2fs_do_write_data_page(struct f2fs_io_info *fio) { - struct page *page = fio->page; - struct inode *inode = page->mapping->host; + struct folio *folio = page_folio(fio->page); + struct inode *inode = folio->mapping->host; struct dnode_of_data dn; struct node_info ni; bool ipu_force = false; @@ -2658,14 +2658,14 @@ int f2fs_do_write_data_page(struct f2fs_io_info *fio) /* Use COW inode to make dnode_of_data for atomic write */ atomic_commit = f2fs_is_atomic_file(inode) && - page_private_atomic(fio->page); + page_private_atomic(folio_page(folio, 0)); if (atomic_commit) set_new_dnode(&dn, F2FS_I(inode)->cow_inode, NULL, NULL, 0); else set_new_dnode(&dn, inode, NULL, NULL, 0); if (need_inplace_update(fio) && - f2fs_lookup_read_extent_cache_block(inode, page->index, + f2fs_lookup_read_extent_cache_block(inode, folio->index, &fio->old_blkaddr)) { if (!f2fs_is_valid_blkaddr(fio->sbi, fio->old_blkaddr, DATA_GENERIC_ENHANCE)) @@ -2680,7 +2680,7 @@ int f2fs_do_write_data_page(struct f2fs_io_info *fio) if (fio->need_lock == LOCK_REQ && !f2fs_trylock_op(fio->sbi)) return -EAGAIN; - err = f2fs_get_dnode_of_data(&dn, page->index, LOOKUP_NODE); + err = f2fs_get_dnode_of_data(&dn, folio->index, LOOKUP_NODE); if (err) goto out; @@ -2688,8 +2688,8 @@ int f2fs_do_write_data_page(struct f2fs_io_info *fio) /* This page is already truncated */ if (fio->old_blkaddr == NULL_ADDR) { - ClearPageUptodate(page); - clear_page_private_gcing(page); + folio_clear_uptodate(folio); + clear_page_private_gcing(folio_page(folio, 0)); goto out_writepage; } got_it: @@ -2715,7 +2715,7 @@ int f2fs_do_write_data_page(struct f2fs_io_info *fio) if (err) goto out_writepage; - set_page_writeback(page); + folio_start_writeback(folio); f2fs_put_dnode(&dn); if (fio->need_lock == LOCK_REQ) f2fs_unlock_op(fio->sbi); @@ -2723,11 +2723,11 @@ int f2fs_do_write_data_page(struct f2fs_io_info *fio) if (err) { if (fscrypt_inode_uses_fs_layer_crypto(inode)) fscrypt_finalize_bounce_page(&fio->encrypted_page); - end_page_writeback(page); + folio_end_writeback(folio); } else { set_inode_flag(inode, FI_UPDATE_WRITE); } - trace_f2fs_do_write_data_page(page_folio(page), IPU); + trace_f2fs_do_write_data_page(folio, IPU); return err; } @@ -2749,17 +2749,17 @@ int f2fs_do_write_data_page(struct f2fs_io_info *fio) if (err) goto out_writepage; - set_page_writeback(page); + folio_start_writeback(folio); if (fio->compr_blocks && fio->old_blkaddr == COMPRESS_ADDR) f2fs_i_compr_blocks_update(inode, fio->compr_blocks - 1, false); /* LFS mode write path */ f2fs_outplace_write_data(&dn, fio); - trace_f2fs_do_write_data_page(page_folio(page), OPU); + trace_f2fs_do_write_data_page(folio, OPU); set_inode_flag(inode, FI_APPEND_WRITE); if (atomic_commit) - clear_page_private_atomic(page); + clear_page_private_atomic(folio_page(folio, 0)); out_writepage: f2fs_put_dnode(&dn); out: