All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
To: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>,
	linux-nilfs@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: [PATCH 08/35] nilfs2: Convert to nilfs_clear_folio_dirty()
Date: Mon,  6 Nov 2023 17:38:36 +0000	[thread overview]
Message-ID: <20231106173903.1734114-9-willy@infradead.org> (raw)
In-Reply-To: <20231106173903.1734114-1-willy@infradead.org>

All callers of nilfs_clear_dirty_page() now have a folio, so rename
the function and pass in the folio.  Saves three hidden calls to
compound_head().

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 fs/nilfs2/inode.c |  2 +-
 fs/nilfs2/mdt.c   |  2 +-
 fs/nilfs2/page.c  | 27 ++++++++++++++-------------
 fs/nilfs2/page.h  |  2 +-
 4 files changed, 17 insertions(+), 16 deletions(-)

diff --git a/fs/nilfs2/inode.c b/fs/nilfs2/inode.c
index c7ec56358a79..8fe784f62720 100644
--- a/fs/nilfs2/inode.c
+++ b/fs/nilfs2/inode.c
@@ -186,7 +186,7 @@ static int nilfs_writepage(struct page *page, struct writeback_control *wbc)
 		 * have dirty pages that try to be flushed in background.
 		 * So, here we simply discard this dirty page.
 		 */
-		nilfs_clear_dirty_page(page, false);
+		nilfs_clear_folio_dirty(folio, false);
 		folio_unlock(folio);
 		return -EROFS;
 	}
diff --git a/fs/nilfs2/mdt.c b/fs/nilfs2/mdt.c
index 327408512b86..2e7952ac2f67 100644
--- a/fs/nilfs2/mdt.c
+++ b/fs/nilfs2/mdt.c
@@ -411,7 +411,7 @@ nilfs_mdt_write_page(struct page *page, struct writeback_control *wbc)
 		 * have dirty folios that try to be flushed in background.
 		 * So, here we simply discard this dirty folio.
 		 */
-		nilfs_clear_dirty_page(page, false);
+		nilfs_clear_folio_dirty(folio, false);
 		folio_unlock(folio);
 		return -EROFS;
 	}
diff --git a/fs/nilfs2/page.c b/fs/nilfs2/page.c
index 29799a49c234..48a91ff059f5 100644
--- a/fs/nilfs2/page.c
+++ b/fs/nilfs2/page.c
@@ -379,7 +379,7 @@ void nilfs_clear_dirty_pages(struct address_space *mapping, bool silent)
 			 * was acquired.  Skip processing in that case.
 			 */
 			if (likely(folio->mapping == mapping))
-				nilfs_clear_dirty_page(&folio->page, silent);
+				nilfs_clear_folio_dirty(folio, silent);
 
 			folio_unlock(folio);
 		}
@@ -389,32 +389,33 @@ void nilfs_clear_dirty_pages(struct address_space *mapping, bool silent)
 }
 
 /**
- * nilfs_clear_dirty_page - discard dirty page
- * @page: dirty page that will be discarded
+ * nilfs_clear_folio_dirty - discard dirty folio
+ * @folio: dirty folio that will be discarded
  * @silent: suppress [true] or print [false] warning messages
  */
-void nilfs_clear_dirty_page(struct page *page, bool silent)
+void nilfs_clear_folio_dirty(struct folio *folio, bool silent)
 {
-	struct inode *inode = page->mapping->host;
+	struct inode *inode = folio->mapping->host;
 	struct super_block *sb = inode->i_sb;
+	struct buffer_head *bh, *head;
 
-	BUG_ON(!PageLocked(page));
+	BUG_ON(!folio_test_locked(folio));
 
 	if (!silent)
 		nilfs_warn(sb, "discard dirty page: offset=%lld, ino=%lu",
-			   page_offset(page), inode->i_ino);
+			   folio_pos(folio), inode->i_ino);
 
-	ClearPageUptodate(page);
-	ClearPageMappedToDisk(page);
+	folio_clear_uptodate(folio);
+	folio_clear_mappedtodisk(folio);
 
-	if (page_has_buffers(page)) {
-		struct buffer_head *bh, *head;
+	head = folio_buffers(folio);
+	if (head) {
 		const unsigned long clear_bits =
 			(BIT(BH_Uptodate) | BIT(BH_Dirty) | BIT(BH_Mapped) |
 			 BIT(BH_Async_Write) | BIT(BH_NILFS_Volatile) |
 			 BIT(BH_NILFS_Checked) | BIT(BH_NILFS_Redirected));
 
-		bh = head = page_buffers(page);
+		bh = head;
 		do {
 			lock_buffer(bh);
 			if (!silent)
@@ -427,7 +428,7 @@ void nilfs_clear_dirty_page(struct page *page, bool silent)
 		} while (bh = bh->b_this_page, bh != head);
 	}
 
-	__nilfs_clear_page_dirty(page);
+	__nilfs_clear_page_dirty(&folio->page);
 }
 
 unsigned int nilfs_page_count_clean_buffers(struct page *page,
diff --git a/fs/nilfs2/page.h b/fs/nilfs2/page.h
index a8ab800e689c..c419bb1f5b7d 100644
--- a/fs/nilfs2/page.h
+++ b/fs/nilfs2/page.h
@@ -41,7 +41,7 @@ void nilfs_page_bug(struct page *);
 
 int nilfs_copy_dirty_pages(struct address_space *, struct address_space *);
 void nilfs_copy_back_pages(struct address_space *, struct address_space *);
-void nilfs_clear_dirty_page(struct page *, bool);
+void nilfs_clear_folio_dirty(struct folio *, bool);
 void nilfs_clear_dirty_pages(struct address_space *, bool);
 unsigned int nilfs_page_count_clean_buffers(struct page *, unsigned int,
 					    unsigned int);
-- 
2.42.0


  parent reply	other threads:[~2023-11-06 17:39 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-06 17:38 [PATCH 00/35] nilfs2: Folio conversions Matthew Wilcox (Oracle)
2023-11-06 17:38 ` [PATCH 01/35] nilfs2: Add nilfs_end_folio_io() Matthew Wilcox (Oracle)
2023-11-06 17:38 ` [PATCH 02/35] nilfs2: Convert nilfs_abort_logs to use folios Matthew Wilcox (Oracle)
2023-11-06 17:38 ` [PATCH 03/35] nilfs2: Convert nilfs_segctor_complete_write " Matthew Wilcox (Oracle)
2023-11-06 17:38 ` [PATCH 04/35] nilfs2: Convert nilfs_forget_buffer to use a folio Matthew Wilcox (Oracle)
2023-11-06 17:38 ` [PATCH 05/35] nilfs2: Convert to nilfs_folio_buffers_clean() Matthew Wilcox (Oracle)
2023-11-06 17:38 ` [PATCH 06/35] nilfs2: Convert nilfs_writepage() to use a folio Matthew Wilcox (Oracle)
2023-11-06 17:38 ` [PATCH 07/35] nilfs2: Convert nilfs_mdt_write_page() " Matthew Wilcox (Oracle)
2023-11-06 17:38 ` Matthew Wilcox (Oracle) [this message]
2023-11-06 17:38 ` [PATCH 09/35] nilfs2: Convert to __nilfs_clear_folio_dirty() Matthew Wilcox (Oracle)
2023-11-06 17:38 ` [PATCH 10/35] nilfs2: Convert nilfs_segctor_prepare_write to use folios Matthew Wilcox (Oracle)
2023-11-06 17:38 ` [PATCH 11/35] nilfs2: Convert nilfs_page_mkwrite() to use a folio Matthew Wilcox (Oracle)
2023-11-09 13:11   ` Ryusuke Konishi
2023-11-09 13:37     ` Matthew Wilcox
2023-11-09 14:22       ` Ryusuke Konishi
2023-11-06 17:38 ` [PATCH 12/35] nilfs2: Convert nilfs_mdt_create_block " Matthew Wilcox (Oracle)
2023-11-06 17:38 ` [PATCH 13/35] nilfs2: Convert nilfs_mdt_submit_block " Matthew Wilcox (Oracle)
2023-11-06 17:38 ` [PATCH 14/35] nilfs2: Convert nilfs_gccache_submit_read_data " Matthew Wilcox (Oracle)
2023-11-06 17:38 ` [PATCH 15/35] nilfs2: Convert nilfs_btnode_create_block " Matthew Wilcox (Oracle)
2023-11-06 17:38 ` [PATCH 16/35] nilfs2: Convert nilfs_btnode_submit_block " Matthew Wilcox (Oracle)
2023-11-06 17:38 ` [PATCH 17/35] nilfs2: Convert nilfs_btnode_delete " Matthew Wilcox (Oracle)
2023-11-06 17:38 ` [PATCH 18/35] nilfs2: Convert nilfs_btnode_prepare_change_key " Matthew Wilcox (Oracle)
2023-11-06 17:38 ` [PATCH 19/35] nilfs2: Convert nilfs_btnode_commit_change_key " Matthew Wilcox (Oracle)
2023-11-06 17:38 ` [PATCH 20/35] nilfs2: Convert nilfs_btnode_abort_change_key " Matthew Wilcox (Oracle)
2023-11-06 17:38 ` [PATCH 21/35] nilfs2: Remove page_address() from nilfs_set_link Matthew Wilcox (Oracle)
2023-11-06 17:38 ` [PATCH 22/35] nilfs2: Remove page_address() from nilfs_add_link Matthew Wilcox (Oracle)
2023-11-06 17:38 ` [PATCH 23/35] nilfs2: Remove page_address() from nilfs_delete_entry Matthew Wilcox (Oracle)
2023-11-06 17:38 ` [PATCH 24/35] nilfs2: Return the mapped address from nilfs_get_page() Matthew Wilcox (Oracle)
2023-11-06 17:38 ` [PATCH 25/35] nilfs2: Pass the mapped address to nilfs_check_page() Matthew Wilcox (Oracle)
2023-11-06 17:38 ` [PATCH 26/35] nilfs2: Switch to kmap_local for directory handling Matthew Wilcox (Oracle)
2023-11-06 17:38 ` [PATCH 27/35] nilfs2: Add nilfs_get_folio() Matthew Wilcox (Oracle)
2023-11-06 17:38 ` [PATCH 28/35] nilfs2: Convert nilfs_readdir to use a folio Matthew Wilcox (Oracle)
2023-11-06 17:38 ` [PATCH 29/35] nilfs2: Convert nilfs_find_entry " Matthew Wilcox (Oracle)
2023-11-06 17:38 ` [PATCH 30/35] nilfs2: Convert nilfs_rename() to use folios Matthew Wilcox (Oracle)
2023-11-06 17:38 ` [PATCH 31/35] nilfs2: Convert nilfs_add_link() to use a folio Matthew Wilcox (Oracle)
2023-11-06 17:39 ` [PATCH 32/35] nilfs2: Convert nilfs_empty_dir() " Matthew Wilcox (Oracle)
2023-11-06 17:39 ` [PATCH 33/35] nilfs2: Convert nilfs_make_empty() " Matthew Wilcox (Oracle)
2023-11-06 17:39 ` [PATCH 34/35] nilfs2: Convert nilfs_prepare_chunk() and nilfs_commit_chunk() to folios Matthew Wilcox (Oracle)
2023-11-06 17:39 ` [PATCH 35/35] nilfs2: Convert nilfs_page_bug() to nilfs_folio_bug() Matthew Wilcox (Oracle)
2023-11-07  1:49 ` [PATCH 00/35] nilfs2: Folio conversions Ryusuke Konishi
2023-11-12  0:10   ` Ryusuke Konishi
2023-11-21 17:43     ` Ryusuke Konishi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231106173903.1734114-9-willy@infradead.org \
    --to=willy@infradead.org \
    --cc=konishi.ryusuke@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-nilfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.