From patchwork Tue Aug 13 14:13:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chao Yu X-Patchwork-Id: 13762099 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 60504C531DC for ; Tue, 13 Aug 2024 14:13:56 +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 1sdsHb-0002Q5-6E; Tue, 13 Aug 2024 14:13:55 +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 1sdsHY-0002Pr-92 for linux-f2fs-devel@lists.sourceforge.net; Tue, 13 Aug 2024 14:13:53 +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: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:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=Wfvz5qTTiWunLLAk2zw1fdxIKf4Wx0FuQF9mRRY1TNg=; b=UkOz0YlYKbqZu4+bz/jKyUp7mU oKGvLFd+Vy7DTpUYxCTYqwRk5FQdF8ZsrXIQJa6yuFbaU2A5B6g2LrcnQhnXe+qXClgPn5YcdRTMa JhMXdoVrxqyAL0S8vU/JBznydMlICGtlr27++nCZZfs8EH9GRy5B4jbd949hkT1PjwHU=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version: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:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=Wfvz5qTTiWunLLAk2zw1fdxIKf4Wx0FuQF9mRRY1TNg=; b=U ma91Pxpotzfxm2EvEAHp6v1NQx5J0uKM67n9skSD4JAmykvjvMMXSEkHHhVtumwNreN6CWsPXOoW/ WT3O8yrUkNb5W1giQI4LhqfSeqA1UnJHkl4vriSh+SAJe4XK+0Ev6rNdU5zhmEFADyfxI7lmvTDyp 7mMsclwdLyiBuzxI=; Received: from sin.source.kernel.org ([145.40.73.55]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1sdsHX-0001CE-Vd for linux-f2fs-devel@lists.sourceforge.net; Tue, 13 Aug 2024 14:13:52 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 4B343CE0159; Tue, 13 Aug 2024 14:13:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0BAC5C4AF09; Tue, 13 Aug 2024 14:13:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1723558424; bh=jeYWkLahC30q53zidZWoDYe1mT2rCQxgLl7pKbyzKME=; h=From:To:Cc:Subject:Date:From; b=NIEL4rarQPF1QG53mUNGMO2jwW4INcHFzUNCt5FbTPQp8KEi872+saZe00PI7+uBC 8WRmt+aA8qsT9tRUntGU5Sn2FOuDb/gyFWNQhQ0y6WQhpVjriOSOT8ydOfiAnCiXOp z7RhRhDxZTjonxzOwGn4hq9+ySnFI5NIa5XA0sOIlB5JmyWu4zwfuYRdy7XK1oF1Jk M9KULFWYRbYeNPR6bPd9nB+rdVWvX1r8Bfe2EJLBswo3TVjPdsx6aOq3RvBn5zxviI DTFsFg6BTMBaaBCm9LlpAYik4TjrNIA6HoiiSpCU26nFtrQR9/KhpAJ+8wVDeAkRpw yH+eChcSlm4Ow== From: Chao Yu To: jaegeuk@kernel.org Date: Tue, 13 Aug 2024 22:13:23 +0800 Message-Id: <20240813141331.417067-1-chao@kernel.org> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-Headers-End: 1sdsHX-0001CE-Vd Subject: [f2fs-dev] [PATCH 1/9] f2fs: convert f2fs_compress_ctx_add_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 onvert 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/compress.c | 14 +++++++------- fs/f2fs/data.c | 4 ++-- fs/f2fs/f2fs.h | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c index 990b93689b46..eb5cd1457ffc 100644 --- a/fs/f2fs/compress.c +++ b/fs/f2fs/compress.c @@ -160,17 +160,17 @@ void f2fs_destroy_compress_ctx(struct compress_ctx *cc, bool reuse) cc->cluster_idx = NULL_CLUSTER; } -void f2fs_compress_ctx_add_page(struct compress_ctx *cc, struct page *page) +void f2fs_compress_ctx_add_page(struct compress_ctx *cc, struct folio *folio) { unsigned int cluster_ofs; - if (!f2fs_cluster_can_merge_page(cc, page->index)) + if (!f2fs_cluster_can_merge_page(cc, folio->index)) f2fs_bug_on(F2FS_I_SB(cc->inode), 1); - cluster_ofs = offset_in_cluster(cc, page->index); - cc->rpages[cluster_ofs] = page; + cluster_ofs = offset_in_cluster(cc, folio->index); + cc->rpages[cluster_ofs] = folio_page(folio, 0); cc->nr_rpages++; - cc->cluster_idx = cluster_idx(cc, page->index); + cc->cluster_idx = cluster_idx(cc, folio->index); } #ifdef CONFIG_F2FS_FS_LZO @@ -1093,7 +1093,7 @@ static int prepare_compress_overwrite(struct compress_ctx *cc, if (PageUptodate(page)) f2fs_put_page(page, 1); else - f2fs_compress_ctx_add_page(cc, page); + f2fs_compress_ctx_add_page(cc, page_folio(page)); } if (!f2fs_cluster_is_empty(cc)) { @@ -1123,7 +1123,7 @@ static int prepare_compress_overwrite(struct compress_ctx *cc, } f2fs_wait_on_page_writeback(page, DATA, true, true); - f2fs_compress_ctx_add_page(cc, page); + f2fs_compress_ctx_add_page(cc, page_folio(page)); if (!PageUptodate(page)) { release_and_retry: diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index e9570f4e0f21..100b6526717f 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -2429,7 +2429,7 @@ static int f2fs_mpage_readpages(struct inode *inode, if (ret) goto set_error_page; - f2fs_compress_ctx_add_page(&cc, &folio->page); + f2fs_compress_ctx_add_page(&cc, folio); goto next_page; read_single_page: @@ -3161,7 +3161,7 @@ static int f2fs_write_cache_pages(struct address_space *mapping, #ifdef CONFIG_F2FS_FS_COMPRESSION if (f2fs_compressed_file(inode)) { folio_get(folio); - f2fs_compress_ctx_add_page(&cc, &folio->page); + f2fs_compress_ctx_add_page(&cc, folio); continue; } #endif diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index 51fd5063a69c..df436dd3aac1 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -4322,7 +4322,7 @@ bool f2fs_cluster_can_merge_page(struct compress_ctx *cc, pgoff_t index); bool f2fs_all_cluster_page_ready(struct compress_ctx *cc, struct page **pages, int index, int nr_pages, bool uptodate); bool f2fs_sanity_check_cluster(struct dnode_of_data *dn); -void f2fs_compress_ctx_add_page(struct compress_ctx *cc, struct page *page); +void f2fs_compress_ctx_add_page(struct compress_ctx *cc, struct folio *folio); int f2fs_write_multi_pages(struct compress_ctx *cc, int *submitted, struct writeback_control *wbc, From patchwork Tue Aug 13 14:13:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chao Yu X-Patchwork-Id: 13762098 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 4E2EBC52D7C for ; Tue, 13 Aug 2024 14:13:56 +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 1sdsHa-0008EI-Nf; Tue, 13 Aug 2024 14:13:54 +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 1sdsHY-0008EC-Rp for linux-f2fs-devel@lists.sourceforge.net; Tue, 13 Aug 2024 14:13:52 +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=CgUI+2tXv2m0nVzqIL76WrwoGRP9ACYfDzKtSiw9BfM=; b=e/8T0eg0KnP68rQNOQ/KmSK9og ycA7bcIKZiMtkvYiEyki27/7aAxJYOQBLX0ZPOkDq+yJUz8YB+3EPOtQ969XzH+KpFkjq9WEQePIF 4nOz6ezCYNehBlRtYIY1nFEr8BOVE5nu6WKtXloxlrdk+Z/BiylfJ4BqaoVAX/qpU7ZQ=; 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=CgUI+2tXv2m0nVzqIL76WrwoGRP9ACYfDzKtSiw9BfM=; b=SVmwaK6aJkKecQ6+y89FZt4mGL H9dWIgjAlLJMahGja1q355M2z+AwVdGOYRU8y34wWuQOyGCKUK5gbVOtLATisHxv+dHkngfqeLAy6 xashyqOnO91fj7fy8Sv7uOpVu8vuAwJNp9aR04LM4X2V7kvAqh7zOssd1hJx1TUp02NM=; 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 1sdsHY-0001CJ-3l for linux-f2fs-devel@lists.sourceforge.net; Tue, 13 Aug 2024 14:13:52 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id BD9446170E; Tue, 13 Aug 2024 14:13:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 04FC6C4AF0B; Tue, 13 Aug 2024 14:13:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1723558426; bh=r8VUUyyyojUjPoAkVdjtfFrqOLyTXjXWxZ3MOiPSYtc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q7Ws6BEUshWrGSkJ6u4ewdjywioZy237bBmdMqh1qJUIyGgigcirqLDjCC+IxTknZ 5fVyXQ+QUcBwqUiDQPBEDOHzeBk2KuzDq1Tl9sTJuVSCL45d+EQi9sPHGJz0fgzm2Z 6pKbzAhXdL2RLzcYIJKnPM1yjoNxsvq/oP2NUu0LmuIGrZe1YuS2Y11rcXC7bALDQw XzD2mqp2kfacqv9pyuCySGeuwzcU499UfsiQnAB1aeNC4Kg+CPs226Hd/thhKUW+f0 0quITyLHUZZS5mLINWSNJqMiiDrczFepJXA2q6+N6aOviZT2opgDepR2f9Sb+fxePA aTO8Aq0m3Vtzg== From: Chao Yu To: jaegeuk@kernel.org Date: Tue, 13 Aug 2024 22:13:24 +0800 Message-Id: <20240813141331.417067-2-chao@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240813141331.417067-1-chao@kernel.org> References: <20240813141331.417067-1-chao@kernel.org> MIME-Version: 1.0 X-Headers-End: 1sdsHY-0001CJ-3l Subject: [f2fs-dev] [PATCH 2/9] f2fs: convert f2fs_vm_page_mkwrite() 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/file.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 8d2f4160a8eb..3c73da7bb05a 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -53,7 +53,7 @@ static vm_fault_t f2fs_filemap_fault(struct vm_fault *vmf) static vm_fault_t f2fs_vm_page_mkwrite(struct vm_fault *vmf) { - struct page *page = vmf->page; + struct folio *folio = page_folio(vmf->page); struct inode *inode = file_inode(vmf->vma->vm_file); struct f2fs_sb_info *sbi = F2FS_I_SB(inode); struct dnode_of_data dn; @@ -85,7 +85,7 @@ static vm_fault_t f2fs_vm_page_mkwrite(struct vm_fault *vmf) #ifdef CONFIG_F2FS_FS_COMPRESSION if (f2fs_compressed_file(inode)) { - int ret = f2fs_is_compressed_cluster(inode, page->index); + int ret = f2fs_is_compressed_cluster(inode, folio->index); if (ret < 0) { err = ret; @@ -105,11 +105,11 @@ static vm_fault_t f2fs_vm_page_mkwrite(struct vm_fault *vmf) file_update_time(vmf->vma->vm_file); filemap_invalidate_lock_shared(inode->i_mapping); - lock_page(page); - if (unlikely(page->mapping != inode->i_mapping || - page_offset(page) > i_size_read(inode) || - !PageUptodate(page))) { - unlock_page(page); + folio_lock(folio); + if (unlikely(folio->mapping != inode->i_mapping || + folio_pos(folio) > i_size_read(inode) || + !folio_test_uptodate(folio))) { + folio_unlock(folio); err = -EFAULT; goto out_sem; } @@ -117,9 +117,9 @@ static vm_fault_t f2fs_vm_page_mkwrite(struct vm_fault *vmf) set_new_dnode(&dn, inode, NULL, NULL, 0); if (need_alloc) { /* block allocation */ - err = f2fs_get_block_locked(&dn, page->index); + err = f2fs_get_block_locked(&dn, folio->index); } else { - err = f2fs_get_dnode_of_data(&dn, page->index, LOOKUP_NODE); + err = f2fs_get_dnode_of_data(&dn, folio->index, LOOKUP_NODE); f2fs_put_dnode(&dn); if (f2fs_is_pinned_file(inode) && !__is_valid_data_blkaddr(dn.data_blkaddr)) @@ -127,11 +127,11 @@ static vm_fault_t f2fs_vm_page_mkwrite(struct vm_fault *vmf) } if (err) { - unlock_page(page); + folio_unlock(folio); goto out_sem; } - f2fs_wait_on_page_writeback(page, DATA, false, true); + f2fs_wait_on_page_writeback(folio_page(folio, 0), DATA, false, true); /* wait for GCed page writeback via META_MAPPING */ f2fs_wait_on_block_writeback(inode, dn.data_blkaddr); @@ -139,18 +139,18 @@ static vm_fault_t f2fs_vm_page_mkwrite(struct vm_fault *vmf) /* * check to see if the page is mapped already (no holes) */ - if (PageMappedToDisk(page)) + if (folio_test_mappedtodisk(folio)) goto out_sem; /* page is wholly or partially inside EOF */ - if (((loff_t)(page->index + 1) << PAGE_SHIFT) > + if (((loff_t)(folio->index + 1) << PAGE_SHIFT) > i_size_read(inode)) { loff_t offset; offset = i_size_read(inode) & ~PAGE_MASK; - zero_user_segment(page, offset, PAGE_SIZE); + folio_zero_segment(folio, offset, folio_size(folio)); } - set_page_dirty(page); + folio_mark_dirty(folio); f2fs_update_iostat(sbi, inode, APP_MAPPED_IO, F2FS_BLKSIZE); f2fs_update_time(sbi, REQ_TIME); @@ -162,7 +162,7 @@ static vm_fault_t f2fs_vm_page_mkwrite(struct vm_fault *vmf) out: ret = vmf_fs_error(err); - trace_f2fs_vm_page_mkwrite(inode, page->index, vmf->vma->vm_flags, ret); + trace_f2fs_vm_page_mkwrite(inode, folio->index, vmf->vma->vm_flags, ret); return ret; } From patchwork Tue Aug 13 14:13:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chao Yu X-Patchwork-Id: 13762101 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 842AFC52D7C for ; Tue, 13 Aug 2024 14:14:04 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-3.v29.lw.sourceforge.com) by sfs-ml-3.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1sdsHk-0007JG-NO; Tue, 13 Aug 2024 14:14:04 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-3.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1sdsHi-0007J5-L2 for linux-f2fs-devel@lists.sourceforge.net; Tue, 13 Aug 2024 14:14:02 +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=Nu4q/nFZYYBYeYZkY4mJDO7VXvwLTIoN1gM1xC/rvio=; b=RdjMcmyMb09EthTXgjO0eRyeod RsRVIetihcoyxKeC5OWnyfhSV4g1rU/LYsiyudVNqVK8CJdfUq+oTDe3/EftsI2AxhWfjIDitVvAj J19Sl/bZY8IMDpuiP6pbiiE7IwXn7t7Y74jrknqqcq1PKyK46hdZOo8HiWgGEFtIQ6nc=; 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=Nu4q/nFZYYBYeYZkY4mJDO7VXvwLTIoN1gM1xC/rvio=; b=MJeEEqo/vlHefjg2bkluEDHywu CMQ2hAhdRQAngkYZMGgHgabBRJ4y2BJRw7riu+54HnxBun3vsknuIN6AN/STaJsIC/0SV65Q7TfxP SxId1LDpVchB2PsZyOUtMyLCsBe/4UeKojVp+r0UsY/BBhTh1KliTGPeTj3F3y75DHbI=; Received: from sin.source.kernel.org ([145.40.73.55]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1sdsHg-0001Cs-U4 for linux-f2fs-devel@lists.sourceforge.net; Tue, 13 Aug 2024 14:14:01 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 3E5ACCE13CA; Tue, 13 Aug 2024 14:13:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F278BC4AF09; Tue, 13 Aug 2024 14:13:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1723558428; bh=eWtrXzMhJKS5xOWZigySRTMy/cUMuJ5/xx/SVnO/CfE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=deSS6dQWX6MhyUkHKOW35OnUJXdbXGhjTAED2iUx20cNK7aJallgy3rIyQ1jlXP23 o58u1wZSlop3de6DqDEwwyRCEY9DF85+1eNYjfKxMNLXfXvfLhAFNDW6KnvbZa6Ss5 RxtFQfYz2MCMpny54vB2qv81YayXky0y9l0rIsT6zQbLnzj32w0uf3+IRYPFJI7gN/ aWmhxuwul5XvIW5LukXURj9dqVIy9fJ0iNNJwzLZPjYVrDuTdCAM8eymv1NbfoJzzw z7haXumUHWmdZTrXHy8lDCs95z/GBNzJUn4ROcm5UFNIR/lnFGWTpZXTym3tPNEM+9 m49vf8yl4rPpg== From: Chao Yu To: jaegeuk@kernel.org Date: Tue, 13 Aug 2024 22:13:25 +0800 Message-Id: <20240813141331.417067-3-chao@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240813141331.417067-1-chao@kernel.org> References: <20240813141331.417067-1-chao@kernel.org> MIME-Version: 1.0 X-Headers-End: 1sdsHg-0001Cs-U4 Subject: [f2fs-dev] [PATCH 3/9] f2fs: convert f2fs_clear_page_cache_dirty_tag() 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 | 3 +-- fs/f2fs/dir.c | 2 +- fs/f2fs/f2fs.h | 2 +- fs/f2fs/inline.c | 2 +- fs/f2fs/node.c | 2 +- 5 files changed, 5 insertions(+), 6 deletions(-) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 100b6526717f..0df5a0c66ede 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -4117,9 +4117,8 @@ const struct address_space_operations f2fs_dblock_aops = { .swap_deactivate = f2fs_swap_deactivate, }; -void f2fs_clear_page_cache_dirty_tag(struct page *page) +void f2fs_clear_page_cache_dirty_tag(struct folio *folio) { - struct folio *folio = page_folio(page); struct address_space *mapping = folio->mapping; unsigned long flags; diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c index 14900ca8a9ff..5fcc952107e9 100644 --- a/fs/f2fs/dir.c +++ b/fs/f2fs/dir.c @@ -868,7 +868,7 @@ void f2fs_delete_entry(struct f2fs_dir_entry *dentry, struct page *page, if (bit_pos == NR_DENTRY_IN_BLOCK && !f2fs_truncate_hole(dir, page->index, page->index + 1)) { - f2fs_clear_page_cache_dirty_tag(page); + f2fs_clear_page_cache_dirty_tag(page_folio(page)); clear_page_dirty_for_io(page); ClearPageUptodate(page); clear_page_private_all(page); diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index df436dd3aac1..a4b90215a51f 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -3890,7 +3890,7 @@ void f2fs_write_failed(struct inode *inode, loff_t to); void f2fs_invalidate_folio(struct folio *folio, size_t offset, size_t length); bool f2fs_release_folio(struct folio *folio, gfp_t wait); bool f2fs_overwrite_io(struct inode *inode, loff_t pos, size_t len); -void f2fs_clear_page_cache_dirty_tag(struct page *page); +void f2fs_clear_page_cache_dirty_tag(struct folio *folio); int f2fs_init_post_read_processing(void); void f2fs_destroy_post_read_processing(void); int f2fs_init_post_read_wq(struct f2fs_sb_info *sbi); diff --git a/fs/f2fs/inline.c b/fs/f2fs/inline.c index d76a3bed7093..98d122164cd1 100644 --- a/fs/f2fs/inline.c +++ b/fs/f2fs/inline.c @@ -281,7 +281,7 @@ int f2fs_write_inline_data(struct inode *inode, struct page *page) page, 0, MAX_INLINE_DATA(inode)); set_page_dirty(ipage); - f2fs_clear_page_cache_dirty_tag(page); + f2fs_clear_page_cache_dirty_tag(page_folio(page)); set_inode_flag(inode, FI_APPEND_WRITE); set_inode_flag(inode, FI_DATA_EXIST); diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index 9e7a6e21f30c..20518c12f5b7 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c @@ -123,7 +123,7 @@ bool f2fs_available_free_memory(struct f2fs_sb_info *sbi, int type) static void clear_node_page_dirty(struct page *page) { if (PageDirty(page)) { - f2fs_clear_page_cache_dirty_tag(page); + f2fs_clear_page_cache_dirty_tag(page_folio(page)); clear_page_dirty_for_io(page); dec_page_count(F2FS_P_SB(page), F2FS_DIRTY_NODES); } From patchwork Tue Aug 13 14:13:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chao Yu X-Patchwork-Id: 13762100 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 763D9C52D7B for ; Tue, 13 Aug 2024 14:14:03 +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 1sdsHj-0001KN-2r; Tue, 13 Aug 2024 14:14:03 +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 1sdsHh-0001K7-RT for linux-f2fs-devel@lists.sourceforge.net; Tue, 13 Aug 2024 14:14:01 +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=/1nmacVmrsXn6q7cUflrbKUeMHuQqfjQNR0KC6cVyz8=; b=NcsTdIlWmR8B3pE2dnf0JlpGwK t87SLKRJaW1iqoRqWw4O1SH5xrRO2etzQihbciAguTf/bSMy/+y/3aMfXvWb9acWeaqYFXHQxn+Mu DUEnnaC6681ReVtM6ziP3jf29kOCjpskum+jUXNgOg3K23Eu8ri+3ykcRcJ0RdSPrnVE=; 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=/1nmacVmrsXn6q7cUflrbKUeMHuQqfjQNR0KC6cVyz8=; b=OEuuLSBOeiSHtvanpNAW2W+qQx yxH+k45ZRWA3lvgAloCSgWkLSIMl586Z33kvR+jsSV0VTkxdTOCSC6chSBMM+tTjwtqHJftw31Bx2 P1k+3Tclv9tVEIIv79oil3H+cZMJy5Pz3MT5L6cxPj7hcGPciQxkHs9eCCddmi0QxO68=; 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 1sdsHg-0001Cw-Uf for linux-f2fs-devel@lists.sourceforge.net; Tue, 13 Aug 2024 14:14:01 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 94D6F61727; Tue, 13 Aug 2024 14:13:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ECC9CC4AF11; Tue, 13 Aug 2024 14:13:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1723558430; bh=ceJAsQVNvPZUvEVH90Lwtfbz3Ha3JuH6fkV/BpfNMgQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nJR5h6nfLGvDN1tZY8B6tCGJErI5wYrupexx86bDUR8ZZHF8uZMGcphc6Zx+caNhZ DrbS/FicXfh88Q20S4VUlUtCar05NhDlieMIS29787iWRjGwOYby6pamMfP0wkw0HZ pQp4ZSo4Fen2MQNQKjKJrr6rDdx4wjoLpCWmsrX9dTV+wQQBOtQ6xLo6FrY2Awb3k4 hNcABuWiQCJxOO53ORBjVtZ56ffg/X6a2XYmKuOUrpBydDcY9iHgRRVSB257K3gO6f R3JV1+fOfwZz9f77Gw9b7J3Y5nIyp9u4cGHMyLobvT9YrItmYnqwz/r4dHHvmyasDO piGcoJYEvKSXA== From: Chao Yu To: jaegeuk@kernel.org Date: Tue, 13 Aug 2024 22:13:26 +0800 Message-Id: <20240813141331.417067-4-chao@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240813141331.417067-1-chao@kernel.org> References: <20240813141331.417067-1-chao@kernel.org> MIME-Version: 1.0 X-Headers-End: 1sdsHg-0001Cw-Uf Subject: [f2fs-dev] [PATCH 4/9] f2fs: convert f2fs_write_inline_data() 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 | 2 +- fs/f2fs/f2fs.h | 2 +- fs/f2fs/inline.c | 10 +++++----- fs/f2fs/node.c | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 0df5a0c66ede..6d2a37db0c9e 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -2866,7 +2866,7 @@ int f2fs_write_single_data_page(struct page *page, int *submitted, err = -EAGAIN; if (f2fs_has_inline_data(inode)) { - err = f2fs_write_inline_data(inode, page); + err = f2fs_write_inline_data(inode, folio); if (!err) goto out; } diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index a4b90215a51f..7c7760aa1a7c 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -4185,7 +4185,7 @@ int f2fs_read_inline_data(struct inode *inode, struct folio *folio); int f2fs_convert_inline_page(struct dnode_of_data *dn, struct page *page); int f2fs_convert_inline_inode(struct inode *inode); int f2fs_try_convert_inline_dir(struct inode *dir, struct dentry *dentry); -int f2fs_write_inline_data(struct inode *inode, struct page *page); +int f2fs_write_inline_data(struct inode *inode, struct folio *folio); int f2fs_recover_inline_data(struct inode *inode, struct page *npage); struct f2fs_dir_entry *f2fs_find_in_inline_dir(struct inode *dir, const struct f2fs_filename *fname, diff --git a/fs/f2fs/inline.c b/fs/f2fs/inline.c index 98d122164cd1..005babf1bed1 100644 --- a/fs/f2fs/inline.c +++ b/fs/f2fs/inline.c @@ -260,7 +260,7 @@ int f2fs_convert_inline_inode(struct inode *inode) return err; } -int f2fs_write_inline_data(struct inode *inode, struct page *page) +int f2fs_write_inline_data(struct inode *inode, struct folio *folio) { struct f2fs_sb_info *sbi = F2FS_I_SB(inode); struct page *ipage; @@ -274,14 +274,14 @@ int f2fs_write_inline_data(struct inode *inode, struct page *page) return -EAGAIN; } - f2fs_bug_on(F2FS_I_SB(inode), page->index); + f2fs_bug_on(F2FS_I_SB(inode), folio->index); f2fs_wait_on_page_writeback(ipage, NODE, true, true); - memcpy_from_page(inline_data_addr(inode, ipage), - page, 0, MAX_INLINE_DATA(inode)); + memcpy_from_folio(inline_data_addr(inode, ipage), + folio, 0, MAX_INLINE_DATA(inode)); set_page_dirty(ipage); - f2fs_clear_page_cache_dirty_tag(page_folio(page)); + f2fs_clear_page_cache_dirty_tag(folio); set_inode_flag(inode, FI_APPEND_WRITE); set_inode_flag(inode, FI_DATA_EXIST); diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index 20518c12f5b7..2b764c86aacc 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c @@ -1535,7 +1535,7 @@ static void flush_inline_data(struct f2fs_sb_info *sbi, nid_t ino) if (!clear_page_dirty_for_io(page)) goto page_out; - ret = f2fs_write_inline_data(inode, page); + ret = f2fs_write_inline_data(inode, page_folio(page)); inode_dec_dirty_pages(inode); f2fs_remove_dirty_inode(inode); if (ret) From patchwork Tue Aug 13 14:13:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chao Yu X-Patchwork-Id: 13762102 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 693C6C531DC for ; Tue, 13 Aug 2024 14:14:06 +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 1sdsHl-0002Qy-Bx; Tue, 13 Aug 2024 14:14:06 +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 1sdsHj-0002Qp-1y for linux-f2fs-devel@lists.sourceforge.net; Tue, 13 Aug 2024 14:14:03 +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=Fv5AR5W3KMKZ5e07IpsLsS4ElWgcmPzeACpnc0VHM9I=; b=it2dZg9k4pvdhLb6mLKxdwJqh1 E5jlylbM11prjfNmihHOEm0wlCWhyHNWidAhfBhd9HEU/5W3PIyfvXwuTyYlXqwEBTJGp5LuUm6UD v3FOzMFKU6BUExQSJ3bnVNMU/CPIT6JBOvcT/va0trNc3xWtVoQUlCyH2KuO3VWawv9E=; 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=Fv5AR5W3KMKZ5e07IpsLsS4ElWgcmPzeACpnc0VHM9I=; b=e5CpcRkSI9/D7QYBTN4flvKI+7 fRCzCHjiOXfpJuFvURwSJmefYOdbjwlNhuuaVavDGNsD5MSKFIowpcRvunj7KwX9+md7FZRMvnc5Z Ib1OTC4FCKwASbhc5PTa4MaOpjItCH6cjIrHGHLaCEK57/x4Q+/w/PMEIDWHFk4gR4qU=; 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 1sdsHi-0001D1-Tc for linux-f2fs-devel@lists.sourceforge.net; Tue, 13 Aug 2024 14:14:03 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 9015C61722; Tue, 13 Aug 2024 14:13:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E6733C4AF0F; Tue, 13 Aug 2024 14:13:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1723558432; bh=CAOJ8mgA8jKzzI9hA7HpfYwAeUu6fh4NOYcV9F2ZHaw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jojLb2S8+RXDU3B+0dvEVenn7/GAwWb3Mu2ll6AbX3FJ+WXV0Ul8RFaFDRhqt2lAm Eyn1k3U1YVnoXMZrjxCmGRHdRlS8xIL5/BzSicOS/CkUwMXRc0S/VE2G/BpZ4F4w/k dBB6FWr3cf2GXDCdV/wExXZZQhhShlqJh70kMYz8XE+ATbLNZNfz/YGNohcpM5DVXB blgqcGLhod9jvLlJzDlQepVfEGQQyWpgXp5sMPm9U2YBZj20IR4lMoJDEpg3R7WFEN 40HSY1IO/t4BvQ4i4T6uszN5J9GMXG6twUuW2mJkP/4D/61yQC1rHg3kSwhk+6iEgC OrEn7tvVBaDVg== From: Chao Yu To: jaegeuk@kernel.org Date: Tue, 13 Aug 2024 22:13:27 +0800 Message-Id: <20240813141331.417067-5-chao@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240813141331.417067-1-chao@kernel.org> References: <20240813141331.417067-1-chao@kernel.org> MIME-Version: 1.0 X-Headers-End: 1sdsHi-0001D1-Tc Subject: [f2fs-dev] [PATCH 5/9] f2fs: convert f2fs_write_single_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/compress.c | 3 ++- fs/f2fs/data.c | 29 +++++++++++++++-------------- fs/f2fs/f2fs.h | 2 +- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c index eb5cd1457ffc..82c31641e696 100644 --- a/fs/f2fs/compress.c +++ b/fs/f2fs/compress.c @@ -1523,7 +1523,8 @@ static int f2fs_write_raw_pages(struct compress_ctx *cc, if (!clear_page_dirty_for_io(cc->rpages[i])) goto continue_unlock; - ret = f2fs_write_single_data_page(cc->rpages[i], &submitted, + ret = f2fs_write_single_data_page(page_folio(cc->rpages[i]), + &submitted, NULL, NULL, wbc, io_type, compr_blocks, false); if (ret) { diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 6d2a37db0c9e..0779e222f709 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -2764,7 +2764,7 @@ int f2fs_do_write_data_page(struct f2fs_io_info *fio) return err; } -int f2fs_write_single_data_page(struct page *page, int *submitted, +int f2fs_write_single_data_page(struct folio *folio, int *submitted, struct bio **bio, sector_t *last_block, struct writeback_control *wbc, @@ -2772,12 +2772,13 @@ int f2fs_write_single_data_page(struct page *page, int *submitted, int compr_blocks, bool allow_balance) { - struct inode *inode = page->mapping->host; + struct inode *inode = folio->mapping->host; + struct page *page = folio_page(folio, 0); struct f2fs_sb_info *sbi = F2FS_I_SB(inode); loff_t i_size = i_size_read(inode); const pgoff_t end_index = ((unsigned long long)i_size) >> PAGE_SHIFT; - loff_t psize = (loff_t)(page->index + 1) << PAGE_SHIFT; + loff_t psize = (loff_t)(folio->index + 1) << PAGE_SHIFT; unsigned offset = 0; bool need_balance_fs = false; bool quota_inode = IS_NOQUOTA(inode); @@ -2801,11 +2802,11 @@ int f2fs_write_single_data_page(struct page *page, int *submitted, .last_block = last_block, }; - trace_f2fs_writepage(page_folio(page), DATA); + trace_f2fs_writepage(folio, DATA); /* we should bypass data pages to proceed the kworker jobs */ if (unlikely(f2fs_cp_error(sbi))) { - mapping_set_error(page->mapping, -EIO); + mapping_set_error(folio->mapping, -EIO); /* * don't drop any dirty dentry pages for keeping lastest * directory structure. @@ -2823,7 +2824,7 @@ int f2fs_write_single_data_page(struct page *page, int *submitted, if (unlikely(is_sbi_flag_set(sbi, SBI_POR_DOING))) goto redirty_out; - if (page->index < end_index || + if (folio->index < end_index || f2fs_verity_in_progress(inode) || compr_blocks) goto write; @@ -2833,10 +2834,10 @@ int f2fs_write_single_data_page(struct page *page, int *submitted, * this page does not have to be written to disk. */ offset = i_size & (PAGE_SIZE - 1); - if ((page->index >= end_index + 1) || !offset) + if ((folio->index >= end_index + 1) || !offset) goto out; - zero_user_segment(page, offset, PAGE_SIZE); + folio_zero_segment(folio, offset, folio_size(folio)); write: /* Dentry/quota blocks are controlled by checkpoint */ if (S_ISDIR(inode->i_mode) || quota_inode) { @@ -2896,7 +2897,7 @@ int f2fs_write_single_data_page(struct page *page, int *submitted, out: inode_dec_dirty_pages(inode); if (err) { - ClearPageUptodate(page); + folio_clear_uptodate(folio); clear_page_private_gcing(page); } @@ -2906,7 +2907,7 @@ int f2fs_write_single_data_page(struct page *page, int *submitted, f2fs_remove_dirty_inode(inode); submitted = NULL; } - unlock_page(page); + folio_unlock(folio); if (!S_ISDIR(inode->i_mode) && !IS_NOQUOTA(inode) && !F2FS_I(inode)->wb_task && allow_balance) f2fs_balance_fs(sbi, need_balance_fs); @@ -2924,7 +2925,7 @@ int f2fs_write_single_data_page(struct page *page, int *submitted, return 0; redirty_out: - redirty_page_for_writepage(wbc, page); + folio_redirty_for_writepage(wbc, folio); /* * pageout() in MM translates EAGAIN, so calls handle_write_error() * -> mapping_set_error() -> set_bit(AS_EIO, ...). @@ -2933,7 +2934,7 @@ int f2fs_write_single_data_page(struct page *page, int *submitted, */ if (!err || wbc->for_reclaim) return AOP_WRITEPAGE_ACTIVATE; - unlock_page(page); + folio_unlock(folio); return err; } @@ -2955,7 +2956,7 @@ static int f2fs_write_data_page(struct page *page, out: #endif - return f2fs_write_single_data_page(page, NULL, NULL, NULL, + return f2fs_write_single_data_page(page_folio(page), NULL, NULL, NULL, wbc, FS_DATA_IO, 0, true); } @@ -3165,7 +3166,7 @@ static int f2fs_write_cache_pages(struct address_space *mapping, continue; } #endif - ret = f2fs_write_single_data_page(&folio->page, + ret = f2fs_write_single_data_page(folio, &submitted, &bio, &last_block, wbc, io_type, 0, true); if (ret == AOP_WRITEPAGE_ACTIVATE) diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index 7c7760aa1a7c..5800ac90a5f7 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -3881,7 +3881,7 @@ int f2fs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, int f2fs_encrypt_one_page(struct f2fs_io_info *fio); bool f2fs_should_update_inplace(struct inode *inode, struct f2fs_io_info *fio); bool f2fs_should_update_outplace(struct inode *inode, struct f2fs_io_info *fio); -int f2fs_write_single_data_page(struct page *page, int *submitted, +int f2fs_write_single_data_page(struct folio *folio, int *submitted, struct bio **bio, sector_t *last_block, struct writeback_control *wbc, enum iostat_type io_type, From patchwork Tue Aug 13 14:13:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chao Yu X-Patchwork-Id: 13762103 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 7A9B8C531DD for ; Tue, 13 Aug 2024 14:14:07 +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 1sdsHn-0008F6-5d; Tue, 13 Aug 2024 14:14:07 +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 1sdsHj-0008Ev-0I for linux-f2fs-devel@lists.sourceforge.net; Tue, 13 Aug 2024 14:14:03 +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=1WWbNiSMb5R3onZ11REmsXLVkIPus+NYPhsIBIR+2wY=; b=EcAJ68FBhdRqw4uatlabJkaEiS VLsB7gWlXe0Bq5K+lMIGzXZSg6L2Ccg6QQjmRx4JRufweAc3ir9E7l269167XoAe/7ImwEWpPPkNG hG8LTih2ucagskID1r284vsiYYPcPxxvif9BOOi6j6CQKc0D84KAAm5MGqKZyrgMDSc4=; 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=1WWbNiSMb5R3onZ11REmsXLVkIPus+NYPhsIBIR+2wY=; b=JUxX8V7l72HJRSCAyR/d35WsBt gVUhZ3P9S6nhaurAlt/u9CRXv2NwFy9KnRo9rOl2oG5eEbKT6WN7dybBYTyB2CRzLgWrAGC74syKu mdex+NX8gZLhYwfxkYEsp/W/9evvTaRwlI7yVKnD2G68emjd6AsQZ0TSviYqIET396bY=; Received: from sin.source.kernel.org ([145.40.73.55]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1sdsHh-0001Cv-S8 for linux-f2fs-devel@lists.sourceforge.net; Tue, 13 Aug 2024 14:14:02 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 2B237CE13C8; Tue, 13 Aug 2024 14:13:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E06D3C4AF09; Tue, 13 Aug 2024 14:13:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1723558434; bh=zSV7Y8/YinzwLLmItU/Jrj8HlYLGg1vRnshuh+Net40=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cENiMq50qkOxvacUzSIJQ0H3mYQZqwrwZCRVGoYN/NYxAR4585QmwPv2X6oIP25Ab +B76atRtnt0i0vPyV7ey+Chz74u3vxo+tQq8F0t1Qe4xkPzWm3Q1mfOutV+68ZHGfL gL3LAax+IAfoYEUZrQJds2PqTvQDUgxE6F4KPVpR6JhwYjPtXgX52lpn8OTmbbqsHZ IWI+Ak0DCF4/y0cNtJ3ssz4YxBbN0FfnDQwRKH129F8CMspElDySjW1R+AThPzK9Gn i8EdSn8PIad5ggpkQmwCoImIan/FSUPZrogTJO1c6XfIUmXgDv6iWJ0lPsUMtg6z9y 1skICs8iQDGcg== From: Chao Yu To: jaegeuk@kernel.org Date: Tue, 13 Aug 2024 22:13:28 +0800 Message-Id: <20240813141331.417067-6-chao@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240813141331.417067-1-chao@kernel.org> References: <20240813141331.417067-1-chao@kernel.org> MIME-Version: 1.0 X-Headers-End: 1sdsHh-0001Cv-S8 Subject: [f2fs-dev] [PATCH 6/9] f2fs: convert f2fs_do_write_meta_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/checkpoint.c | 2 +- fs/f2fs/f2fs.h | 2 +- fs/f2fs/segment.c | 14 +++++++------- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c index f3d22b8ef2ff..d73d4d05313e 100644 --- a/fs/f2fs/checkpoint.c +++ b/fs/f2fs/checkpoint.c @@ -362,7 +362,7 @@ static int __f2fs_write_meta_page(struct page *page, if (wbc->for_reclaim && page->index < GET_SUM_BLOCK(sbi, 0)) goto redirty_out; - f2fs_do_write_meta_page(sbi, page, io_type); + f2fs_do_write_meta_page(sbi, page_folio(page), io_type); dec_page_count(sbi, F2FS_DIRTY_META); if (wbc->for_reclaim) diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index 5800ac90a5f7..c29ed8b6eea6 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -3732,7 +3732,7 @@ bool f2fs_exist_trim_candidates(struct f2fs_sb_info *sbi, struct page *f2fs_get_sum_page(struct f2fs_sb_info *sbi, unsigned int segno); void f2fs_update_meta_page(struct f2fs_sb_info *sbi, void *src, block_t blk_addr); -void f2fs_do_write_meta_page(struct f2fs_sb_info *sbi, struct page *page, +void f2fs_do_write_meta_page(struct f2fs_sb_info *sbi, struct folio *folio, enum iostat_type io_type); void f2fs_do_write_node_page(unsigned int nid, struct f2fs_io_info *fio); void f2fs_outplace_write_data(struct dnode_of_data *dn, diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 741e46f9d0fd..2d1965bed443 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -3822,7 +3822,7 @@ static void do_write_page(struct f2fs_summary *sum, struct f2fs_io_info *fio) f2fs_up_read(&fio->sbi->io_order_lock); } -void f2fs_do_write_meta_page(struct f2fs_sb_info *sbi, struct page *page, +void f2fs_do_write_meta_page(struct f2fs_sb_info *sbi, struct folio *folio, enum iostat_type io_type) { struct f2fs_io_info fio = { @@ -3831,20 +3831,20 @@ void f2fs_do_write_meta_page(struct f2fs_sb_info *sbi, struct page *page, .temp = HOT, .op = REQ_OP_WRITE, .op_flags = REQ_SYNC | REQ_META | REQ_PRIO, - .old_blkaddr = page->index, - .new_blkaddr = page->index, - .page = page, + .old_blkaddr = folio->index, + .new_blkaddr = folio->index, + .page = folio_page(folio, 0), .encrypted_page = NULL, .in_list = 0, }; - if (unlikely(page->index >= MAIN_BLKADDR(sbi))) + if (unlikely(folio->index >= MAIN_BLKADDR(sbi))) fio.op_flags &= ~REQ_META; - set_page_writeback(page); + folio_start_writeback(folio); f2fs_submit_page_write(&fio); - stat_inc_meta_count(sbi, page->index); + stat_inc_meta_count(sbi, folio->index); f2fs_update_iostat(sbi, NULL, io_type, F2FS_BLKSIZE); } From patchwork Tue Aug 13 14:13:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chao Yu X-Patchwork-Id: 13762105 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 D4CFAC52D7C for ; Tue, 13 Aug 2024 14:14:12 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-3.v29.lw.sourceforge.com) by sfs-ml-3.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1sdsHq-0007Jt-A9; Tue, 13 Aug 2024 14:14:09 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-3.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1sdsHo-0007Jf-3A for linux-f2fs-devel@lists.sourceforge.net; Tue, 13 Aug 2024 14:14:07 +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=j+iw0zkklSTC2aRDUdvVgf+vxe/jKuhM9JE8Xc6+KuE=; b=OuGOrIXIiVQ1nEIYiI/uKNnAi0 4uPfNDtFb1V20V/JpM1bMdbWqZYfR40sqKHbLEAE0ifFVkYpgtWCcR6UFp/tTaRL7Z/Ko2FF7s1vi QZ1/TohjtW9WXDZuvAKpwycrKvCt6j9RvwgNIhXzhHt7MtKpyZFV/SEO90BvuZoJczmo=; 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=j+iw0zkklSTC2aRDUdvVgf+vxe/jKuhM9JE8Xc6+KuE=; b=N9zGzEwS4XZFgdaub0w1i8EIOz M6GThrNKqChmqnrQuHSWQ1noOSZgkVrbRj/0pwZTUrYh9LwFy1fUkhze5crHoAxUdRLDDcU3TONNF Cwu+s/ToYXEz0UA/PjsoB68LZB6pYarkJUX99eNZw3WvjPACWCxze3ARAw5+Mk7S0ABI=; 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 1sdsHm-0001DD-SX for linux-f2fs-devel@lists.sourceforge.net; Tue, 13 Aug 2024 14:14:07 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 82B8A6170B; Tue, 13 Aug 2024 14:13:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9E4AC4AF15; Tue, 13 Aug 2024 14:13:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1723558436; bh=O7pw8vrwHsmRKsgyDC121Jnhb8Pog4l0udno2Rfx5N4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dk2QQ8wPoosbvLg3UHkk0KZRRfPL+3OhTJB3QJvfzwZgmVX2wOIW2nDOmgCG/FfXH 22onUHZLrgYMlhhMUHd4lPUzN+wC9x30La1GVCGqIpd4fJbnNqm2Ep9zwgiecO+myb 9DievUR+BqDyjmwoOxV81W69bK0vaZKbtEG+8KWJN2t2ZoUQyfBbFf3lt3Wg5AtMAH GWu4m2/nQpw8xT/JFxsKI64dB3bhgIk9UiA4g2/7oP/sNTNPfpNLF6+Br91lt+TU7f 89ApQROUK0Khm9dr3EIGLPTb2Zl2cn2AGCsKbl05axspxur/QHeQLcO15iqTqHJ2Nf SJKKcx2Dnl0EQ== From: Chao Yu To: jaegeuk@kernel.org Date: Tue, 13 Aug 2024 22:13:29 +0800 Message-Id: <20240813141331.417067-7-chao@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240813141331.417067-1-chao@kernel.org> References: <20240813141331.417067-1-chao@kernel.org> MIME-Version: 1.0 X-Headers-End: 1sdsHm-0001DD-SX Subject: [f2fs-dev] [PATCH 7/9] f2fs: convert __f2fs_write_meta_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/checkpoint.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c index d73d4d05313e..ffaf295a198a 100644 --- a/fs/f2fs/checkpoint.c +++ b/fs/f2fs/checkpoint.c @@ -345,30 +345,31 @@ static int __f2fs_write_meta_page(struct page *page, enum iostat_type io_type) { struct f2fs_sb_info *sbi = F2FS_P_SB(page); + struct folio *folio = page_folio(page); - trace_f2fs_writepage(page_folio(page), META); + trace_f2fs_writepage(folio, META); if (unlikely(f2fs_cp_error(sbi))) { if (is_sbi_flag_set(sbi, SBI_IS_CLOSE)) { - ClearPageUptodate(page); + folio_clear_uptodate(folio); dec_page_count(sbi, F2FS_DIRTY_META); - unlock_page(page); + folio_unlock(folio); return 0; } goto redirty_out; } if (unlikely(is_sbi_flag_set(sbi, SBI_POR_DOING))) goto redirty_out; - if (wbc->for_reclaim && page->index < GET_SUM_BLOCK(sbi, 0)) + if (wbc->for_reclaim && folio->index < GET_SUM_BLOCK(sbi, 0)) goto redirty_out; - f2fs_do_write_meta_page(sbi, page_folio(page), io_type); + f2fs_do_write_meta_page(sbi, folio, io_type); dec_page_count(sbi, F2FS_DIRTY_META); if (wbc->for_reclaim) f2fs_submit_merged_write_cond(sbi, NULL, page, 0, META); - unlock_page(page); + folio_unlock(folio); if (unlikely(f2fs_cp_error(sbi))) f2fs_submit_merged_write(sbi, META); From patchwork Tue Aug 13 14:13:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chao Yu X-Patchwork-Id: 13762104 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 CD8FBC52D7C for ; Tue, 13 Aug 2024 14:14:08 +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 1sdsHo-0001LC-Dk; Tue, 13 Aug 2024 14:14:08 +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 1sdsHk-0001Kg-Hg for linux-f2fs-devel@lists.sourceforge.net; Tue, 13 Aug 2024 14:14:04 +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=aKA/ZZ3O8Z+6nCg36uZ9SadppOXjFaBHpqnT40tFc/k=; b=UYYCoZKCRDncVWIyb/+I4sh6Ru +sgbe2j8LKuSqP8VOr6aFyqW0IRuIsRPdrL1H0584C6oZkbTCnB9DA5nB+AqR78FazJs0wNXHKgI6 CMLl3ECXs4ZCAASQnBfVzrgPxqwGFTX2tmO1BZKEmUZ11WXza3MZhXUzpZrhyr28SKws=; 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=aKA/ZZ3O8Z+6nCg36uZ9SadppOXjFaBHpqnT40tFc/k=; b=De+LFRUMQcbdarGW2BGxcEMBwh JMZS64w2qeC7hKmIotoKbh8ZaNSgemf4y+B5d47noqvOV/EtsHdQqcfZIKc73qcvGkZLGwRIa6GLO 436XNPA0QXf1GFF7feiHXWO1R4RdKYWhtr5Aqd3bEcmnpJ0HvlLE3Af2z4WQ2wRh0L+w=; 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 1sdsHj-0001D5-R3 for linux-f2fs-devel@lists.sourceforge.net; Tue, 13 Aug 2024 14:14:04 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 7D2E361726; Tue, 13 Aug 2024 14:13:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D559CC4AF0B; Tue, 13 Aug 2024 14:13:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1723558438; bh=5T499NbgrjKr5NOj5StQGgnVfYV5k+BMGIi5VEOc7AU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EpS+8sNg/0fjtUqjjEU21HwpPd1cVu3aEWiOVNVS6pXd87OhjQlLc2OjCXW4Z/qOC CMui+djcxR8+17IaMN3S1g/nnlIEu/2OMbeEDLIFqsb38mCsaKE0BT1tsGvbm1g5dI I2hG+3ecJsm+Q6Oc9JkJeBXKGednlRW6hsQqbzF95oF1k3QcYQ/OxyJYpjTvMDapWq 6arnDIddQiw4lng0uDwIlQIH16LMkeYPqEXCK2sSB+2OqHjoatR9rhnDcOXo6rB+bW 3oYsk2yOWwXYyPa49ge+ahGv4R45qYQ8ky4bGSTgYeqd7dF6+cTZcPrAsEQ/jdWX2L gICkksTrwlR/w== From: Chao Yu To: jaegeuk@kernel.org Date: Tue, 13 Aug 2024 22:13:30 +0800 Message-Id: <20240813141331.417067-8-chao@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240813141331.417067-1-chao@kernel.org> References: <20240813141331.417067-1-chao@kernel.org> MIME-Version: 1.0 X-Headers-End: 1sdsHj-0001D5-R3 Subject: [f2fs-dev] [PATCH 8/9] f2fs: convert f2fs_read_multi_pages() 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 | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 0779e222f709..9e21cfe11cc7 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -2207,19 +2207,22 @@ int f2fs_read_multi_pages(struct compress_ctx *cc, struct bio **bio_ret, /* get rid of pages beyond EOF */ for (i = 0; i < cc->cluster_size; i++) { struct page *page = cc->rpages[i]; + struct folio *folio; if (!page) continue; - if ((sector_t)page->index >= last_block_in_file) { - zero_user_segment(page, 0, PAGE_SIZE); - if (!PageUptodate(page)) - SetPageUptodate(page); - } else if (!PageUptodate(page)) { + + folio = page_folio(page); + if ((sector_t)folio->index >= last_block_in_file) { + folio_zero_segment(folio, 0, folio_size(folio)); + if (!folio_test_uptodate(folio)) + folio_mark_uptodate(folio); + } else if (!folio_test_uptodate(folio)) { continue; } - unlock_page(page); + folio_unlock(folio); if (for_write) - put_page(page); + folio_put(folio); cc->rpages[i] = NULL; cc->nr_rpages--; } @@ -2279,7 +2282,7 @@ int f2fs_read_multi_pages(struct compress_ctx *cc, struct bio **bio_ret, } for (i = 0; i < cc->nr_cpages; i++) { - struct page *page = dic->cpages[i]; + struct folio *folio = page_folio(dic->cpages[i]); block_t blkaddr; struct bio_post_read_ctx *ctx; @@ -2289,7 +2292,8 @@ int f2fs_read_multi_pages(struct compress_ctx *cc, struct bio **bio_ret, f2fs_wait_on_block_writeback(inode, blkaddr); - if (f2fs_load_compressed_page(sbi, page, blkaddr)) { + if (f2fs_load_compressed_page(sbi, folio_page(folio, 0), + blkaddr)) { if (atomic_dec_and_test(&dic->remaining_pages)) { f2fs_decompress_cluster(dic, true); break; @@ -2299,7 +2303,7 @@ int f2fs_read_multi_pages(struct compress_ctx *cc, struct bio **bio_ret, if (bio && (!page_is_mergeable(sbi, bio, *last_block_in_bio, blkaddr) || - !f2fs_crypt_mergeable_bio(bio, inode, page->index, NULL))) { + !f2fs_crypt_mergeable_bio(bio, inode, folio->index, NULL))) { submit_and_realloc: f2fs_submit_read_bio(sbi, bio, DATA); bio = NULL; @@ -2308,7 +2312,7 @@ int f2fs_read_multi_pages(struct compress_ctx *cc, struct bio **bio_ret, if (!bio) { bio = f2fs_grab_read_bio(inode, blkaddr, nr_pages, f2fs_ra_op_flags(rac), - page->index, for_write); + folio->index, for_write); if (IS_ERR(bio)) { ret = PTR_ERR(bio); f2fs_decompress_end_io(dic, ret, true); @@ -2318,7 +2322,7 @@ int f2fs_read_multi_pages(struct compress_ctx *cc, struct bio **bio_ret, } } - if (bio_add_page(bio, page, blocksize, 0) < blocksize) + if (bio_add_folio(bio, folio, blocksize, 0) < blocksize) goto submit_and_realloc; ctx = get_post_read_ctx(bio); From patchwork Tue Aug 13 14:13:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chao Yu X-Patchwork-Id: 13762106 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 D96C9C531DC for ; Tue, 13 Aug 2024 14:14:13 +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 1sdsHt-0008Fu-HR; Tue, 13 Aug 2024 14:14:13 +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 1sdsHs-0008Fi-4G for linux-f2fs-devel@lists.sourceforge.net; Tue, 13 Aug 2024 14:14:12 +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=GALEBg6QTn4diRzzk+xHggmwIgCVRve5iXWh4Fx33uw=; b=EdGQ6jPNUNd2JcPgpa6BbrOsuc JqcRzR4AX62L+lGnfbRI6diK/l42jPOQAsESTknBv/lb/l2vweiU7YRN3YvIw4DcOm9K8UIaIN/N/ NbtSRy5wnuhi/vgnFFnVwIWPW+/zHwZxaX69r7Mos9sXlekIjASndvEd2ESiZ+KZGxWA=; 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=GALEBg6QTn4diRzzk+xHggmwIgCVRve5iXWh4Fx33uw=; b=dzAsBSBcWzkcPbFHqmaWyaAE5R VEo0hxhZDDBK4gdrkPsrmA9lml+c/g0Zyp2BUN4yDSiul4txPe5nGHbcVT/zXwT2P2AmAe49mkfam 0jauomjXmy2hUGA9ekJyXsUSGHXwZedjc5A8cUEVwHPfHdpncXN7crM9v90ZT0zPtLE4=; 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 1sdsHq-0001Di-SV for linux-f2fs-devel@lists.sourceforge.net; Tue, 13 Aug 2024 14:14:11 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 776B96172F; Tue, 13 Aug 2024 14:14:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CFF9DC4AF11; Tue, 13 Aug 2024 14:13:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1723558440; bh=+Rahtg2CIbqQVDwx0J+IxStkz1u33ze7GCP87Z5bhDY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=azkwPqRfL6kB75jA+pqe+ygYJJV/FrIXp79ryh2MjDe6l9aF+7/8bbWxzpTHMQFm2 7RFyhMAzw2BHCVZNj78tyeVGZzzP5CGKx+QXsLuZAsOOPOcJQgomYIqhqkxHa3zFKo w2me4nsj27Tbom/J9J16Tom96uQagm2Avj1KsxT9wuHZWSwemdPkgZ59l+KbGcS8JW SqYW/r+LmwSIDyj5a77se9l2UghPwZcqqOI45l6HXB1JR+rL1l/LXSaImKvPFX0FfE 5dEDxiTJOI8g2hJYucr/KDKj4P1lMR1p3U8wAQrshzW4t259xs4wkVxyk5xEIXLO1P ZRuY/bcCD+bjQ== From: Chao Yu To: jaegeuk@kernel.org Date: Tue, 13 Aug 2024 22:13:31 +0800 Message-Id: <20240813141331.417067-9-chao@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240813141331.417067-1-chao@kernel.org> References: <20240813141331.417067-1-chao@kernel.org> MIME-Version: 1.0 X-Headers-End: 1sdsHq-0001Di-SV Subject: [f2fs-dev] [PATCH 9/9] f2fs: convert f2fs_handle_page_eio() 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/checkpoint.c | 2 +- fs/f2fs/f2fs.h | 6 ++++-- fs/f2fs/node.c | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c index ffaf295a198a..7f76460b721f 100644 --- a/fs/f2fs/checkpoint.c +++ b/fs/f2fs/checkpoint.c @@ -99,7 +99,7 @@ static struct page *__get_meta_page(struct f2fs_sb_info *sbi, pgoff_t index, } if (unlikely(!PageUptodate(page))) { - f2fs_handle_page_eio(sbi, page->index, META); + f2fs_handle_page_eio(sbi, page_folio(page), META); f2fs_put_page(page, 1); return ERR_PTR(-EIO); } diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index c29ed8b6eea6..28b6246e07f9 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -4666,9 +4666,11 @@ static inline void f2fs_io_schedule_timeout(long timeout) io_schedule_timeout(timeout); } -static inline void f2fs_handle_page_eio(struct f2fs_sb_info *sbi, pgoff_t ofs, - enum page_type type) +static inline void f2fs_handle_page_eio(struct f2fs_sb_info *sbi, + struct folio *folio, enum page_type type) { + pgoff_t ofs = folio->index; + if (unlikely(f2fs_cp_error(sbi))) return; diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index 2b764c86aacc..7beaa3690e03 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c @@ -1492,7 +1492,7 @@ static struct page *__get_node_page(struct f2fs_sb_info *sbi, pgoff_t nid, out_put_err: /* ENOENT comes from read_node_page which is not an error. */ if (err != -ENOENT) - f2fs_handle_page_eio(sbi, page->index, NODE); + f2fs_handle_page_eio(sbi, page_folio(page), NODE); f2fs_put_page(page, 1); return ERR_PTR(err); }