From patchwork Tue Aug 20 03:46:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chao Yu X-Patchwork-Id: 13769278 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 36671C54722 for ; Tue, 20 Aug 2024 03:47:24 +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 1sgFq5-0006ix-Ns; Tue, 20 Aug 2024 03:47:21 +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 1sgFq3-0006ip-7N for linux-f2fs-devel@lists.sourceforge.net; Tue, 20 Aug 2024 03:47:18 +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=/GItEWqxznVCij7rKDkuYmv2jUj/+xx6HzGDrLsxMOU=; b=LhvjNM3Y7SOr8OyJnu9WVv63jI 2HLIlyXlvNaoUmAqKL/LeHKjYNHDwBJOVXKrz6dbUjEnVx9cYITQFpeTdnZJ13D4gSTkxVtvoXDqB keTAy5aoEDKbem5rOeruHkcyD3+P5Esfz3F5XBVvaJH3yJsQQ8lnHg3uRFmXuuAHu6fY=; 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=/GItEWqxznVCij7rKDkuYmv2jUj/+xx6HzGDrLsxMOU=; b=h PRU35S7R5mLlcXo0MyX8QiREHAxAwEck5+prJWjsCdjJNTcLfvESiSnDrcorruMLq2QKV41jTzmlb 0cV/Ucd2oqMA/M/ymbdIkn90+N7LiQsbc+uexZLlJyjkt37B02jSE8OkHVfhHlZzi6G9IkjwozF7/ sQzXGOqBK5Oi5xyc=; 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 1sgFq1-0006RU-G6 for linux-f2fs-devel@lists.sourceforge.net; Tue, 20 Aug 2024 03:47:18 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id A9A5FCE0989; Tue, 20 Aug 2024 03:47:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1DF5AC4AF0C; Tue, 20 Aug 2024 03:47:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1724125624; bh=g4BTj0BsXqAj1BLALkrYqHcBy0nS0AoA9Yo+xzPSI3w=; h=From:To:Cc:Subject:Date:From; b=EWvYZUIAWCaXoBFo5ThcMoMl+KZVKuVlkWRa55RwOpuL4j3Kd7blI0IG8zWQw+aTu L3pdYh1jKCeYafMuBSqSRAq8GCxd/oleYTl1nMjf3SZC3p0PELwDfIc/00RszkdRzX J2VGElFvyOjiNnM9S7P+nJ10n5PzPC9ZY6Q5R4tdhmDaWGdIW87/5Im68rw15R5Uxj qaqHQCQEIb5vBzezO6+YrTpuYFzqu0o2NQbRBxEyniUApYtG6hNt/uPKDW8J8bXI/2 fEmYOkkuurkuyZseogsoPYwUPeFqCKmxSO7QRSbfDLk2HSFJowKNTodnbnFGHsrfc9 k8hs9lzec2kFA== From: Chao Yu To: jaegeuk@kernel.org Date: Tue, 20 Aug 2024 11:46:47 +0800 Message-Id: <20240820034654.698236-1-chao@kernel.org> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-Headers-End: 1sgFq1-0006RU-G6 Subject: [f2fs-dev] [PATCH v2 1/8] f2fs: convert f2fs_write_begin() 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 --- v2: - fix compile error. fs/f2fs/data.c | 44 +++++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 0655fddfc4ba..85ac05c3655a 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -3378,11 +3378,11 @@ void f2fs_write_failed(struct inode *inode, loff_t to) } static int prepare_write_begin(struct f2fs_sb_info *sbi, - struct page *page, loff_t pos, unsigned len, + struct folio *folio, loff_t pos, unsigned int len, block_t *blk_addr, bool *node_changed) { - struct inode *inode = page->mapping->host; - pgoff_t index = page->index; + struct inode *inode = folio->mapping->host; + pgoff_t index = folio->index; struct dnode_of_data dn; struct page *ipage; bool locked = false; @@ -3419,13 +3419,13 @@ static int prepare_write_begin(struct f2fs_sb_info *sbi, if (f2fs_has_inline_data(inode)) { if (pos + len <= MAX_INLINE_DATA(inode)) { - f2fs_do_read_inline_data(page_folio(page), ipage); + f2fs_do_read_inline_data(folio, ipage); set_inode_flag(inode, FI_DATA_EXIST); if (inode->i_nlink) set_page_private_inline(ipage); goto out; } - err = f2fs_convert_inline_page(&dn, page); + err = f2fs_convert_inline_page(&dn, folio_page(folio, 0)); if (err || dn.data_blkaddr != NULL_ADDR) goto out; } @@ -3518,12 +3518,12 @@ static int __reserve_data_block(struct inode *inode, pgoff_t index, } static int prepare_atomic_write_begin(struct f2fs_sb_info *sbi, - struct page *page, loff_t pos, unsigned int len, + struct folio *folio, loff_t pos, unsigned int len, block_t *blk_addr, bool *node_changed, bool *use_cow) { - struct inode *inode = page->mapping->host; + struct inode *inode = folio->mapping->host; struct inode *cow_inode = F2FS_I(inode)->cow_inode; - pgoff_t index = page->index; + pgoff_t index = folio->index; int err = 0; block_t ori_blk_addr = NULL_ADDR; @@ -3566,6 +3566,7 @@ static int f2fs_write_begin(struct file *file, struct address_space *mapping, struct inode *inode = mapping->host; struct f2fs_sb_info *sbi = F2FS_I_SB(inode); struct page *page = NULL; + struct folio *folio; pgoff_t index = ((unsigned long long) pos) >> PAGE_SHIFT; bool need_balance = false; bool use_cow = false; @@ -3625,22 +3626,23 @@ static int f2fs_write_begin(struct file *file, struct address_space *mapping, /* TODO: cluster can be compressed due to race with .writepage */ *pagep = page; + folio = page_folio(page); if (f2fs_is_atomic_file(inode)) - err = prepare_atomic_write_begin(sbi, page, pos, len, + err = prepare_atomic_write_begin(sbi, folio, pos, len, &blkaddr, &need_balance, &use_cow); else - err = prepare_write_begin(sbi, page, pos, len, + err = prepare_write_begin(sbi, folio, pos, len, &blkaddr, &need_balance); if (err) goto fail; if (need_balance && !IS_NOQUOTA(inode) && has_not_enough_free_secs(sbi, 0, 0)) { - unlock_page(page); + folio_unlock(folio); f2fs_balance_fs(sbi, true); - lock_page(page); - if (page->mapping != mapping) { + folio_lock(folio); + if (folio->mapping != mapping) { /* The page got truncated from under us */ f2fs_put_page(page, 1); goto repeat; @@ -3649,18 +3651,18 @@ static int f2fs_write_begin(struct file *file, struct address_space *mapping, f2fs_wait_on_page_writeback(page, DATA, false, true); - if (len == PAGE_SIZE || PageUptodate(page)) + if (len == PAGE_SIZE || folio_test_uptodate(folio)) return 0; if (!(pos & (PAGE_SIZE - 1)) && (pos + len) >= i_size_read(inode) && !f2fs_verity_in_progress(inode)) { - zero_user_segment(page, len, PAGE_SIZE); + folio_zero_segment(folio, len, folio_size(folio)); return 0; } if (blkaddr == NEW_ADDR) { - zero_user_segment(page, 0, PAGE_SIZE); - SetPageUptodate(page); + folio_zero_segment(folio, 0, folio_size(folio)); + folio_mark_uptodate(folio); } else { if (!f2fs_is_valid_blkaddr(sbi, blkaddr, DATA_GENERIC_ENHANCE_READ)) { @@ -3669,16 +3671,16 @@ static int f2fs_write_begin(struct file *file, struct address_space *mapping, } err = f2fs_submit_page_read(use_cow ? F2FS_I(inode)->cow_inode : inode, - page_folio(page), blkaddr, 0, true); + folio, blkaddr, 0, true); if (err) goto fail; - lock_page(page); - if (unlikely(page->mapping != mapping)) { + folio_lock(folio); + if (unlikely(folio->mapping != mapping)) { f2fs_put_page(page, 1); goto repeat; } - if (unlikely(!PageUptodate(page))) { + if (unlikely(!folio_test_uptodate(folio))) { err = -EIO; goto fail; } From patchwork Tue Aug 20 03:46:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chao Yu X-Patchwork-Id: 13769277 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 C3DCCC531DC for ; Tue, 20 Aug 2024 03:47:22 +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 1sgFq4-00060U-4I; Tue, 20 Aug 2024 03:47:20 +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 1sgFq1-00060A-Mq for linux-f2fs-devel@lists.sourceforge.net; Tue, 20 Aug 2024 03:47:17 +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=sl+lJzsF78cNGF+gdEXyQc0DTfmYaWTyJkEwVcP56ZA=; b=bUESpRsu6zWNJMsVgTAsgvJtH7 FAUyyucXUvcauoqr6lDETLMfWGTNAp+IwS7FkB1ezK5ijnR8F/GozVPYt2HIavNlsBZ/loxAAVW4X 9e7MD9Wn828pj1QFwYj6V7gowp/cpvSNToLbNz58El4vBeLt0/Bl/Hxf/VBtIITjd3JI=; 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=sl+lJzsF78cNGF+gdEXyQc0DTfmYaWTyJkEwVcP56ZA=; b=M0k2NoHfvQjseQzxggrNAYul8H CdTlqj169qh8XoXVFxx5g4ty6k1DuD8+UJSMSkl6GFAqeCcy+P6a5V0rW/tfepH/EhxyaUt1CWpY1 Y+2omp4s4Zuh5DSC7qXwg+esiZ6OW4Z6taWmqCDRkNeXwjF4oygoNcvPlCl9NIKjvTq0=; 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 1sgFq1-0006RW-2I for linux-f2fs-devel@lists.sourceforge.net; Tue, 20 Aug 2024 03:47:17 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id AE60D60DB6; Tue, 20 Aug 2024 03:47:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 04647C4AF10; Tue, 20 Aug 2024 03:47:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1724125626; bh=/xnmcfediMlfnoUVnmuzbvo1S4c7hWPIg/RHrVMxn+c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rCFZbc5AbaUpaNwC+ljQqt6ePtYw8+HcBnq7MqOSx4BbLTQ2uxDSZMvMCVkTgeku9 Pb07QZqIWBfrYkZT+mNd8bRQ+jO3Lcz+1FG9L7RVur1bPCQ5Ysl1FmfQhRwyrlaAqc ec0hCn7AC6/fL27ZlRTvhZWrJErJVAnMemjuv8WXUwkS/wMi1wvQSPEELsBAaVhL9N s2C6roVhXGZQG2MfI/SFG00zlRQCRqEJqgK8FyXBKBdCkDIeE0tq0ocTT1QRfLmmUU 7I6uaESCzHfdJwxJ0pN/dP5inywV0aCt26rzDbYaXz33jA/mNeVa61RUyIoa4cSHkm T4YCTeup2NQ+w== From: Chao Yu To: jaegeuk@kernel.org Date: Tue, 20 Aug 2024 11:46:48 +0800 Message-Id: <20240820034654.698236-2-chao@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240820034654.698236-1-chao@kernel.org> References: <20240820034654.698236-1-chao@kernel.org> MIME-Version: 1.0 X-Headers-End: 1sgFq1-0006RW-2I Subject: [f2fs-dev] [PATCH v2 2/8] f2fs: convert f2fs_write_end() 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 --- v2: - fix compile error. fs/f2fs/data.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 85ac05c3655a..e114d738b6b4 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -3698,7 +3698,8 @@ static int f2fs_write_end(struct file *file, loff_t pos, unsigned len, unsigned copied, struct page *page, void *fsdata) { - struct inode *inode = page->mapping->host; + struct folio *folio = page_folio(page); + struct inode *inode = folio->mapping->host; trace_f2fs_write_end(inode, pos, len, copied); @@ -3707,17 +3708,17 @@ static int f2fs_write_end(struct file *file, * should be PAGE_SIZE. Otherwise, we treat it with zero copied and * let generic_perform_write() try to copy data again through copied=0. */ - if (!PageUptodate(page)) { + if (!folio_test_uptodate(folio)) { if (unlikely(copied != len)) copied = 0; else - SetPageUptodate(page); + folio_mark_uptodate(folio); } #ifdef CONFIG_F2FS_FS_COMPRESSION /* overwrite compressed file */ if (f2fs_compressed_file(inode) && fsdata) { - f2fs_compress_write_end(inode, fsdata, page->index, copied); + f2fs_compress_write_end(inode, fsdata, folio->index, copied); f2fs_update_time(F2FS_I_SB(inode), REQ_TIME); if (pos + copied > i_size_read(inode) && @@ -3730,10 +3731,10 @@ static int f2fs_write_end(struct file *file, if (!copied) goto unlock_out; - set_page_dirty(page); + folio_mark_dirty(folio); if (f2fs_is_atomic_file(inode)) - set_page_private_atomic(page); + set_page_private_atomic(folio_page(folio, 0)); if (pos + copied > i_size_read(inode) && !f2fs_verity_in_progress(inode)) { From patchwork Tue Aug 20 03:46:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chao Yu X-Patchwork-Id: 13769276 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 0D4A2C3DA4A for ; Tue, 20 Aug 2024 03:47:23 +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 1sgFq6-0007wN-2L; Tue, 20 Aug 2024 03:47:22 +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 1sgFq3-0007wD-Fo for linux-f2fs-devel@lists.sourceforge.net; Tue, 20 Aug 2024 03:47:19 +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=4GknH1Zwi0GWeOzSpYsC4QgaC/LmZ0emVEef2dI0udw=; b=L0PrvRer20FNa3CaoRpG4StQvF UZDp8S0dazYUlPlYJCoQbaIQTzgHXiuJ0BywCP7t3Fe5uVf+0rejVBurKgEjk17E66TrL05rbY0KO 6yGYdACVmFXRpeOKKzN1j9r5Ks/cAm//O9CzeC1CEwj9PSaX4k1esrWj68iqpJulUvfY=; 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=4GknH1Zwi0GWeOzSpYsC4QgaC/LmZ0emVEef2dI0udw=; b=OTqkY8OFUbn2v0r/Ba46fDRdwM 8+WMyc2Dg/N3D5dw3lC3o1yITkhZbFkUyGsGHmKeBoQbMbxl9+Y6979NIJ3z+q2fKW8Jqz/iJZqS0 CPUw520yW+x6LCbUAE2hgpqzCQebNfE7X5lKdULlY+jmpErFgDm4Y9DFBxnTKX1KKAm4=; 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 1sgFq2-0006Ra-SO for linux-f2fs-devel@lists.sourceforge.net; Tue, 20 Aug 2024 03:47:19 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 791D260DB7; Tue, 20 Aug 2024 03:47:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DE4FEC4AF0C; Tue, 20 Aug 2024 03:47:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1724125628; bh=7JJv4KN9xSbK50goC7fnEuayXM2V2u/CfyhdMECGBOI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EufZ7fid6iK5WZ0mY5vev5+v9YjCzqJ7/tbDQ2aRbfmnviIuxm5LjcYRhpcYSf+39 9ppD9U2cI3wYMNsQd64WOJD2HnPHzXbKaRVaMgKNa2OM3aJmJM1nRsVKuPV9BAZTTX t0zy/kxs9BhCsjbM7qlTAzKKEQgx/FnalQIP8+gdGyqR9yngo9I9VxdLB05HtmOVg0 lSqeI4r0UBHSeoIyu8GxAvmrfF+AZ0lHfR9kqjymU0uIbq/ng32cxPZG3zFsG64Vct Tg2GI11CbPYBZsZV+smUi5oiMOVXq3+QZP+U2GWrkruCdI2a+xTE8iE5PdAn6IUUgN hyfAsPTomRFLw== From: Chao Yu To: jaegeuk@kernel.org Date: Tue, 20 Aug 2024 11:46:49 +0800 Message-Id: <20240820034654.698236-3-chao@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240820034654.698236-1-chao@kernel.org> References: <20240820034654.698236-1-chao@kernel.org> MIME-Version: 1.0 X-Headers-End: 1sgFq2-0006Ra-SO Subject: [f2fs-dev] [PATCH v2 3/8] f2fs: convert f2fs_set_compressed_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 | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c index 82c31641e696..67bb1e2e07a4 100644 --- a/fs/f2fs/compress.c +++ b/fs/f2fs/compress.c @@ -90,11 +90,13 @@ bool f2fs_is_compressed_page(struct page *page) static void f2fs_set_compressed_page(struct page *page, struct inode *inode, pgoff_t index, void *data) { - attach_page_private(page, (void *)data); + struct folio *folio = page_folio(page); + + folio_attach_private(folio, (void *)data); /* i_crypto_info and iv index */ - page->index = index; - page->mapping = inode->i_mapping; + folio->index = index; + folio->mapping = inode->i_mapping; } static void f2fs_drop_rpages(struct compress_ctx *cc, int len, bool unlock) From patchwork Tue Aug 20 03:46:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chao Yu X-Patchwork-Id: 13769279 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 325E5C5321D for ; Tue, 20 Aug 2024 03:47:24 +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 1sgFq7-0007OV-0W; Tue, 20 Aug 2024 03:47:23 +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 1sgFq4-0007OP-Oa for linux-f2fs-devel@lists.sourceforge.net; Tue, 20 Aug 2024 03:47:21 +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=brtc7/LbxkAwzdgmB+8mO9BBge tdlswkPiyu8V1WptttWwqzs3aSycYGSVNTneLlEan9LmAvsZxWK78FycXc1dv1uxnodeuQyfLo/l/ cLGiQv6RwBrCWheIChjoXLhdN+yb6UBnu5q5COVlNyQ5Uc+D+LT7qF8v9rZceGJVrK/g=; 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=FaDWzC5UZlNfs0zJ48acFLv/EH dmw6H1fRPg5BmAUqMczFgA/VNeYMiZg4FR82pVFxcLNMo7suRgFMe5yePEGCPOR2LGCO9yjTHEzLZ 5Z9qw3qNyQsrQgYwEPjkMQYBesFpK2xx5l0SHt8N3L8yczpah37Og0UE8Uz1lW8BSoGk=; 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 1sgFq4-0006Rh-Mm for linux-f2fs-devel@lists.sourceforge.net; Tue, 20 Aug 2024 03:47:21 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 5DA9360DC4; Tue, 20 Aug 2024 03:47:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C57E5C4AF12; Tue, 20 Aug 2024 03:47:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1724125630; bh=kI9JNrkqcWakqf9nzqIrzXTTjP9TFX7SUhwYCeGt3EY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pTSo7mKbZOK8myMmYn594lSgctp4XIcijOYlsvx2gOEJGuPOKdAIWsrSVnrtHlNNU nL9hKGb8XNnac4eQw9yX0YGX9FyhJUSv/qzdWC3lyTOxmOaLwflmO0+DGIJS46aZpI M9i8s10phwWK5Lb0R/+15nuN2Y8WGnXqbWEjCXnSAtId8gkJhyIK9dPJ2GveRFXG8J vdSEFt2ubmKrMECQwr67lfZdS8Ql3UafBJlAZDsK6Zd3wEPaYq7lG6DNT7NvlIo/B4 yxC4kLeDYgUO5ngRKW1qR3IKBtm9RSS7cEizepcwHAqBv1MPfbrxibgmpFclvqkDPk qh/QOp8PFXf9w== From: Chao Yu To: jaegeuk@kernel.org Date: Tue, 20 Aug 2024 11:46:50 +0800 Message-Id: <20240820034654.698236-4-chao@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240820034654.698236-1-chao@kernel.org> References: <20240820034654.698236-1-chao@kernel.org> MIME-Version: 1.0 X-Headers-End: 1sgFq4-0006Rh-Mm Subject: [f2fs-dev] [PATCH v2 4/8] 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: From patchwork Tue Aug 20 03:46:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chao Yu X-Patchwork-Id: 13769280 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 CB487C5320E for ; Tue, 20 Aug 2024 03:47:24 +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 1sgFq8-00061E-Em; Tue, 20 Aug 2024 03:47:24 +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 1sgFq7-00060z-6H for linux-f2fs-devel@lists.sourceforge.net; Tue, 20 Aug 2024 03:47:23 +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=pVkda070V/cbUxqxCp8oMh9qO6QLojXvPwXoNvqbT50=; b=NSXcCjTM7ka7ewVonjPcyTjsHB DpZW1VT1AGdP3mwgSUqvuL9uRttkYJoEIkDj5QHnFjsVMOhzOiY30Y0HgM3XFbD5BjLR0xuMeNBsR StYoDYMH+klCaNoiWs7JrihXCnOxG+HTqKwFf0lYCh9CFrwXM7ZQaKJfWgL+Pta0cVvk=; 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=pVkda070V/cbUxqxCp8oMh9qO6QLojXvPwXoNvqbT50=; b=i6F15uF2MjqZH8PtWMVljS+B// f5bKk20e+wtMytGaBhYmlDM1f0CeWSvRK7wZMrNbbfJZL9A+S0l/AUb4iZ4GtRy3uLwH+50AJJCom T5xfme+UqwOa6e+FRKgkjZiTGohoe3yQtxNamM1+9wSn4JFSa0q+lkHecoCG/A20+Vlc=; 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 1sgFq6-0006Rk-JE for linux-f2fs-devel@lists.sourceforge.net; Tue, 20 Aug 2024 03:47:23 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 42E5160DBD; Tue, 20 Aug 2024 03:47:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AAEDAC4AF09; Tue, 20 Aug 2024 03:47:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1724125632; bh=Gv9T9VqQEXP+t9GsufY3LhPD+LhHvt38T1omk9U0JGM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Bl7oIWicgFEGKNiIE52WCqV2xquS6lZe4NR7/ZrT+7l0Ti9k3hfX5WhXNw/57m+ws PWhUlShTwj0PkbSaaWLoW9vWz82vY4KZmcsUnOluFC83S+DXwD0K07uhALkdpwieBb LOLJR3+f+rt92gEyyzVhRm1bGipkXbjuuyLccvDvtsUyj88tiGInEjk4NBYoijK6eN m5W5UpSPSCNNA1C82IM//XDJfl8uV6bMTFmXzVsObWdE0y3gQPOOkNOzSEjMtycTDp Ue7DlMUhZNx6L2rAjPK/tHNAyVHRs0mS+Ecev4cgdoAuSif0AkmDeMxP2DTlebC/Mi SwEcuFKp13K1A== From: Chao Yu To: jaegeuk@kernel.org Date: Tue, 20 Aug 2024 11:46:51 +0800 Message-Id: <20240820034654.698236-5-chao@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240820034654.698236-1-chao@kernel.org> References: <20240820034654.698236-1-chao@kernel.org> MIME-Version: 1.0 X-Headers-End: 1sgFq6-0006Rk-JE Subject: [f2fs-dev] [PATCH v2 5/8] f2fs: convert f2fs_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 | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index c57ddee2c7c5..e69097267b99 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -2945,22 +2945,23 @@ int f2fs_write_single_data_page(struct folio *folio, int *submitted, static int f2fs_write_data_page(struct page *page, struct writeback_control *wbc) { + struct folio *folio = page_folio(page); #ifdef CONFIG_F2FS_FS_COMPRESSION - struct inode *inode = page->mapping->host; + struct inode *inode = folio->mapping->host; if (unlikely(f2fs_cp_error(F2FS_I_SB(inode)))) goto out; if (f2fs_compressed_file(inode)) { - if (f2fs_is_compressed_cluster(inode, page->index)) { - redirty_page_for_writepage(wbc, page); + if (f2fs_is_compressed_cluster(inode, folio->index)) { + folio_redirty_for_writepage(wbc, folio); return AOP_WRITEPAGE_ACTIVATE; } } out: #endif - return f2fs_write_single_data_page(page_folio(page), NULL, NULL, NULL, + return f2fs_write_single_data_page(folio, NULL, NULL, NULL, wbc, FS_DATA_IO, 0, true); } From patchwork Tue Aug 20 03:46:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chao Yu X-Patchwork-Id: 13769283 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 699FEC3DA4A for ; Tue, 20 Aug 2024 03:47:30 +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 1sgFqD-0007P2-Bi; Tue, 20 Aug 2024 03:47:30 +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 1sgFqA-0007Ot-Us for linux-f2fs-devel@lists.sourceforge.net; Tue, 20 Aug 2024 03:47:27 +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=lYo8qSTEj38iSexGRTU+AY8CQA J/fKFVO2SJZyCAbNJ8Be0ZqvnRW4XngkNnwiVP4UV2gPI7tdehvdCyqd/pdI4dsOkq8oNKF+q6e3U +U7AYqkCj4R9BwOJDJsgEFsAXgZSMreA3lmPdcW+33KKBTH90/X7s0mOvgWpDYKnLtDk=; 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=hhxBfF7rz7Wl2OcQiyEe4gM6kX j7jKzovMz/e8XyKvcjt4rnQW339g/hs4n68KlXw3zklmnH250teZrQJFur2whXHmiG1i5FguU2tea vf1OSVSoM1ZvnkXj1IHC/DMb6HH4BpRaU/h15BBAlfs6miqqqlMwLa959k18SPAgCGv4=; 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 1sgFqA-0006S1-LL for linux-f2fs-devel@lists.sourceforge.net; Tue, 20 Aug 2024 03:47:27 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id E2A71CE0B6B; Tue, 20 Aug 2024 03:47:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9104AC4AF0B; Tue, 20 Aug 2024 03:47:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1724125634; bh=kXH69VauKPWX1aj+cT6JMgD13fkLJ9/JjHzU17y6Nko=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L/cCJGmqQ1oLhcscrEdTsDKuKu+hC+V6SkEVDcEpGJTTk9pW8rmGJF6pj8nX9VAim +mWkyajtOxXLPdsBMIaTzt+Vqx9rKbi7l3pc1CXQHJsTcnMU4SLn6SwaX90PI6qeK3 BQK16sTOJnAle3+nkEboGXSIBqbt4ji2h77qbRQlgSHFteaOJnNa+MNZ5fHnmiNRIX t6387ScKdnh2pqmjAh9JmUyQZY/Mjp3n1SZRztWAms+B7Lv2E71OEyV9niYxhN/iXz CVjeJovRO75QSefMpznX2M6231txRQ/vXQe9oKz8s3b5vaf3be/NbwaICPkTuIEhez Uia7WG1uPuuaw== From: Chao Yu To: jaegeuk@kernel.org Date: Tue, 20 Aug 2024 11:46:52 +0800 Message-Id: <20240820034654.698236-6-chao@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240820034654.698236-1-chao@kernel.org> References: <20240820034654.698236-1-chao@kernel.org> MIME-Version: 1.0 X-Headers-End: 1sgFqA-0006S1-LL Subject: [f2fs-dev] [PATCH v2 6/8] 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; } From patchwork Tue Aug 20 03:46:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chao Yu X-Patchwork-Id: 13769282 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 EB191C5320E for ; Tue, 20 Aug 2024 03:47:28 +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 1sgFqC-0007x2-KR; Tue, 20 Aug 2024 03:47:28 +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 1sgFqB-0007wn-0L for linux-f2fs-devel@lists.sourceforge.net; Tue, 20 Aug 2024 03:47:27 +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=AlKtkv71Y5dMQWzz+ZZduEIH4qLJToicukWYZuVv5KY=; b=LgxCfbyMpq83osqoQjA2ZnHzPR E09J3SJz1c9r20JGq9cA7ykCT124CE8Lhr9Wo1e5KILSHAT91ZtDvYxBN3ZwPi8iv3hlzK1Wlb9+v BG9HhA1rZSQ8kldd1lIwbWuR3o7w/LKUy3/Scx2kX5aXTtXRbL0l4wjnMuK5LefYAGec=; 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=AlKtkv71Y5dMQWzz+ZZduEIH4qLJToicukWYZuVv5KY=; b=lW6PoER2+ANFDa7Wd6l9BQUspI 52D59cf9mztNJYoVpCe0RznPWMQAf92hJs40TjtFwja3qfr/WCoIAWzO0J3H5yajYi96XB7GGnKLN CiV9uwILliGMi05BcgMXfjXuH+43yKiBIvvPIWPaddwqZt9p8VnpM8DKZEEIIGCvqDfc=; 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 1sgFqA-0006S3-Dc for linux-f2fs-devel@lists.sourceforge.net; Tue, 20 Aug 2024 03:47:26 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 1179C60DBA; Tue, 20 Aug 2024 03:47:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 76045C4AF0C; Tue, 20 Aug 2024 03:47:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1724125635; bh=B1fWIi1dMz6E5T95/Mb2Eyi2qqkYJmzRfHyiW0GG3tk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Xg5qHpCcZ7aZMUBVxcD9o+fzCzp+3g9YtDREFHkt2qMKKjxFESs/1Kg5SUoIuJQ4b yjDCtBUlxGzmNCdm0qNcZgiAS8P6sn90N7vcHvlzmMevIXSexZLbEetRs80kKkkvFe 8dZS59Thq8wTQzcPqy/dF90kMu1JLHNJvYgXcDmVEW3IAzHZfQ3lsIbIUUc/H4WaON ZoSRWdgDMcCybzV/LsAOluArn6lf3AqW7UQPnZW+MM+PwvuRDcFSMWb2PxSu6jjOGm 3xKzEbxQ799w/8YQXDOESZAYTW2HcWIgRU4l2UoZrUou1na3SORw/8YLwMD/N0gF7Y 5pnYGw+o33/hw== From: Chao Yu To: jaegeuk@kernel.org Date: Tue, 20 Aug 2024 11:46:53 +0800 Message-Id: <20240820034654.698236-7-chao@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240820034654.698236-1-chao@kernel.org> References: <20240820034654.698236-1-chao@kernel.org> MIME-Version: 1.0 X-Headers-End: 1sgFqA-0006S3-Dc Subject: [f2fs-dev] [PATCH v2 7/8] f2fs: convert read_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 | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index aeda3eecc9e2..f5e5abce695b 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c @@ -1369,6 +1369,7 @@ struct page *f2fs_new_node_page(struct dnode_of_data *dn, unsigned int ofs) */ static int read_node_page(struct page *page, blk_opf_t op_flags) { + struct folio *folio = page_folio(page); struct f2fs_sb_info *sbi = F2FS_P_SB(page); struct node_info ni; struct f2fs_io_info fio = { @@ -1381,21 +1382,21 @@ static int read_node_page(struct page *page, blk_opf_t op_flags) }; int err; - if (PageUptodate(page)) { + if (folio_test_uptodate(folio)) { if (!f2fs_inode_chksum_verify(sbi, page)) { - ClearPageUptodate(page); + folio_clear_uptodate(folio); return -EFSBADCRC; } return LOCKED_PAGE; } - err = f2fs_get_node_info(sbi, page->index, &ni, false); + err = f2fs_get_node_info(sbi, folio->index, &ni, false); if (err) return err; /* NEW_ADDR can be seen, after cp_error drops some dirty node pages */ if (unlikely(ni.blk_addr == NULL_ADDR || ni.blk_addr == NEW_ADDR)) { - ClearPageUptodate(page); + folio_clear_uptodate(folio); return -ENOENT; } From patchwork Tue Aug 20 03:46:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chao Yu X-Patchwork-Id: 13769281 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 C873FC3DA4A for ; Tue, 20 Aug 2024 03:47:25 +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 1sgFqA-0006jI-21; Tue, 20 Aug 2024 03:47:25 +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 1sgFq8-0006j9-Lb for linux-f2fs-devel@lists.sourceforge.net; Tue, 20 Aug 2024 03:47: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=h+943LVu/+8yhC2SFSEVrRdRoqjPDtyjWdl+009oEDo=; b=ZDZHTsC1GPVlaIxUKS62LtSrtX r1C28kEcV8l1yEHu6IimVlN412p/RJmUXnHDCSDY9g7IKbkQemPBuXPSfqj49GS4CVI3SWkdfAAVD W18DomGxFCZEVptUcgUK6jXZBwovYZ0JdL17cfHdF4//9mcGnQjnYvuWyU9mGW9+J3eQ=; 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=h+943LVu/+8yhC2SFSEVrRdRoqjPDtyjWdl+009oEDo=; b=b625AzJ2zw6FU00SI6798hMr6u LpG1JNZCf68mBWJX5mKbGOWmWWvPcRLe8ExnR35x6hINZkBeiZFVMivUSX1N3CYa9vWEUql81fb/i IzArpm817uGiN1sfoe3MKyMBddXoQxI8Fbabxv+PQHYTOdJ5p9JrN0Xr8guTvb10aSac=; 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 1sgFq7-0006Rp-9D for linux-f2fs-devel@lists.sourceforge.net; Tue, 20 Aug 2024 03:47:24 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id EB25B60DCF; Tue, 20 Aug 2024 03:47:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5D10AC4AF09; Tue, 20 Aug 2024 03:47:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1724125637; bh=8r7Ek2cBap+An9MVHAkEPVDijkmUphd6VWrszUU4RwQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JRJLxlUGgbeST1Z2h6/Qb1w/LMJrsufYye6VcWESI36hZ+vHOWF4CXIjSSynT4TRC HKm3wzFu8l2902A2ca6RnJUaFuB73eVAY8hrAY0r7PPTquT+Lt2P3xLTdZwqitoRmy pTR7hSK0ztWC4pDYkBfQj6xHAYEgkpfRr5vQZsTopnraBbPDGSnk3dDkT0n/moWvcH tgEMkeLxK9bSeHHz3ReGcgvAnn49BekZ8iuPgX5mOGBVtpJ4R+/y8BMdwQKa5HaZct wylRUHT0RzOM6eEo9UIpuYgB/bTeYudA8C3U0OXJaxy2tHO1IOj2cHDgdQC9xblPmb BvtvCc33BPHUw== From: Chao Yu To: jaegeuk@kernel.org Date: Tue, 20 Aug 2024 11:46:54 +0800 Message-Id: <20240820034654.698236-8-chao@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240820034654.698236-1-chao@kernel.org> References: <20240820034654.698236-1-chao@kernel.org> MIME-Version: 1.0 X-Headers-End: 1sgFq7-0006Rp-9D Subject: [f2fs-dev] [PATCH v2 8/8] f2fs: get rid of page->index 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 | 2 +- fs/f2fs/data.c | 12 ++++++------ fs/f2fs/dir.c | 3 ++- fs/f2fs/inode.c | 3 ++- fs/f2fs/node.c | 4 ++-- fs/f2fs/segment.c | 3 ++- 6 files changed, 15 insertions(+), 12 deletions(-) diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c index 67bb1e2e07a4..163ad0d7d495 100644 --- a/fs/f2fs/compress.c +++ b/fs/f2fs/compress.c @@ -881,7 +881,7 @@ static bool cluster_has_invalid_data(struct compress_ctx *cc) f2fs_bug_on(F2FS_I_SB(cc->inode), !page); /* beyond EOF */ - if (page->index >= nr_pages) + if (page_folio(page)->index >= nr_pages) return true; } return false; diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index e69097267b99..c6d688208f8b 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -354,7 +354,7 @@ static void f2fs_write_end_io(struct bio *bio) } f2fs_bug_on(sbi, page->mapping == NODE_MAPPING(sbi) && - page->index != nid_of_node(page)); + page_folio(page)->index != nid_of_node(page)); dec_page_count(sbi, type); if (f2fs_in_warm_node_list(sbi, page)) @@ -703,7 +703,7 @@ int f2fs_submit_page_bio(struct f2fs_io_info *fio) bio = __bio_alloc(fio, 1); f2fs_set_bio_crypt_ctx(bio, fio->page->mapping->host, - fio->page->index, fio, GFP_NOIO); + page_folio(fio->page)->index, fio, GFP_NOIO); if (bio_add_page(bio, page, PAGE_SIZE, 0) < PAGE_SIZE) { bio_put(bio); @@ -802,7 +802,7 @@ static int add_ipu_page(struct f2fs_io_info *fio, struct bio **bio, fio->new_blkaddr)); if (f2fs_crypt_mergeable_bio(*bio, fio->page->mapping->host, - fio->page->index, fio) && + page_folio(fio->page)->index, fio) && bio_add_page(*bio, page, PAGE_SIZE, 0) == PAGE_SIZE) { ret = 0; @@ -902,7 +902,7 @@ int f2fs_merge_page_bio(struct f2fs_io_info *fio) if (!bio) { bio = __bio_alloc(fio, BIO_MAX_VECS); f2fs_set_bio_crypt_ctx(bio, fio->page->mapping->host, - fio->page->index, fio, GFP_NOIO); + page_folio(fio->page)->index, fio, GFP_NOIO); add_bio_entry(fio->sbi, bio, page, fio->temp); } else { @@ -995,13 +995,13 @@ void f2fs_submit_page_write(struct f2fs_io_info *fio) (!io_is_mergeable(sbi, io->bio, io, fio, io->last_block_in_bio, fio->new_blkaddr) || !f2fs_crypt_mergeable_bio(io->bio, fio->page->mapping->host, - bio_page->index, fio))) + page_folio(bio_page)->index, fio))) __submit_merged_bio(io); alloc_new: if (io->bio == NULL) { io->bio = __bio_alloc(fio, BIO_MAX_VECS); f2fs_set_bio_crypt_ctx(io->bio, fio->page->mapping->host, - bio_page->index, fio, GFP_NOIO); + page_folio(bio_page)->index, fio, GFP_NOIO); io->fio = *fio; } diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c index 5fcc952107e9..1136539a57a8 100644 --- a/fs/f2fs/dir.c +++ b/fs/f2fs/dir.c @@ -842,6 +842,7 @@ void f2fs_delete_entry(struct f2fs_dir_entry *dentry, struct page *page, struct f2fs_dentry_block *dentry_blk; unsigned int bit_pos; int slots = GET_DENTRY_SLOTS(le16_to_cpu(dentry->name_len)); + pgoff_t index = page_folio(page)->index; int i; f2fs_update_time(F2FS_I_SB(dir), REQ_TIME); @@ -867,7 +868,7 @@ void f2fs_delete_entry(struct f2fs_dir_entry *dentry, struct page *page, set_page_dirty(page); if (bit_pos == NR_DENTRY_IN_BLOCK && - !f2fs_truncate_hole(dir, page->index, page->index + 1)) { + !f2fs_truncate_hole(dir, index, index + 1)) { f2fs_clear_page_cache_dirty_tag(page_folio(page)); clear_page_dirty_for_io(page); ClearPageUptodate(page); diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c index 5d7e4c7f5969..b2d5c3ef8e24 100644 --- a/fs/f2fs/inode.c +++ b/fs/f2fs/inode.c @@ -174,7 +174,8 @@ bool f2fs_inode_chksum_verify(struct f2fs_sb_info *sbi, struct page *page) if (provided != calculated) f2fs_warn(sbi, "checksum invalid, nid = %lu, ino_of_node = %x, %x vs. %x", - page->index, ino_of_node(page), provided, calculated); + page_folio(page)->index, ino_of_node(page), + provided, calculated); return provided == calculated; } diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index f5e5abce695b..59b13ff243fa 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c @@ -919,7 +919,7 @@ static int truncate_node(struct dnode_of_data *dn) clear_node_page_dirty(dn->node_page); set_sbi_flag(sbi, SBI_IS_DIRTY); - index = dn->node_page->index; + index = page_folio(dn->node_page)->index; f2fs_put_page(dn->node_page, 1); invalidate_mapping_pages(NODE_MAPPING(sbi), @@ -1869,7 +1869,7 @@ int f2fs_fsync_node_pages(struct f2fs_sb_info *sbi, struct inode *inode, } if (!ret && atomic && !marked) { f2fs_debug(sbi, "Retry to write fsync mark: ino=%u, idx=%lx", - ino, last_page->index); + ino, page_folio(last_page)->index); lock_page(last_page); f2fs_wait_on_page_writeback(last_page, NODE, true, true); set_page_dirty(last_page); diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 3bda3f707007..fafbb1cbcb57 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -3564,7 +3564,8 @@ static int __get_segment_type_6(struct f2fs_io_info *fio) if (file_is_cold(inode) || f2fs_need_compress_data(inode)) return CURSEG_COLD_DATA; - type = __get_age_segment_type(inode, fio->page->index); + type = __get_age_segment_type(inode, + page_folio(fio->page)->index); if (type != NO_CHECK_TYPE) return type;