linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
To: linux-fsdevel@vger.kernel.org
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>,
	linux-mm@kvack.org, linux-block@vger.kernel.org,
	"Darrick J . Wong" <djwong@kernel.org>
Subject: [PATCH v15 03/17] iomap: Convert to_iomap_page to take a folio
Date: Mon, 19 Jul 2021 19:39:47 +0100	[thread overview]
Message-ID: <20210719184001.1750630-4-willy@infradead.org> (raw)
In-Reply-To: <20210719184001.1750630-1-willy@infradead.org>

The big comment about only using a head page can go away now that
it takes a folio argument.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
---
 fs/iomap/buffered-io.c | 32 +++++++++++++++-----------------
 1 file changed, 15 insertions(+), 17 deletions(-)

diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c
index 87ccb3438bec..d4870a2691f9 100644
--- a/fs/iomap/buffered-io.c
+++ b/fs/iomap/buffered-io.c
@@ -22,8 +22,8 @@
 #include "../internal.h"
 
 /*
- * Structure allocated for each page or THP when block size < page size
- * to track sub-page uptodate status and I/O completions.
+ * Structure allocated for each folio when block size < folio size
+ * to track sub-folio uptodate status and I/O completions.
  */
 struct iomap_page {
 	atomic_t		read_bytes_pending;
@@ -32,17 +32,10 @@ struct iomap_page {
 	unsigned long		uptodate[];
 };
 
-static inline struct iomap_page *to_iomap_page(struct page *page)
+static inline struct iomap_page *to_iomap_page(struct folio *folio)
 {
-	/*
-	 * per-block data is stored in the head page.  Callers should
-	 * not be dealing with tail pages (and if they are, they can
-	 * call thp_head() first.
-	 */
-	VM_BUG_ON_PGFLAGS(PageTail(page), page);
-
-	if (page_has_private(page))
-		return (struct iomap_page *)page_private(page);
+	if (folio_test_private(folio))
+		return folio_get_private(folio);
 	return NULL;
 }
 
@@ -51,7 +44,8 @@ static struct bio_set iomap_ioend_bioset;
 static struct iomap_page *
 iomap_page_create(struct inode *inode, struct page *page)
 {
-	struct iomap_page *iop = to_iomap_page(page);
+	struct folio *folio = page_folio(page);
+	struct iomap_page *iop = to_iomap_page(folio);
 	unsigned int nr_blocks = i_blocks_per_page(inode, page);
 
 	if (iop || nr_blocks <= 1)
@@ -144,7 +138,8 @@ iomap_adjust_read_range(struct inode *inode, struct iomap_page *iop,
 static void
 iomap_iop_set_range_uptodate(struct page *page, unsigned off, unsigned len)
 {
-	struct iomap_page *iop = to_iomap_page(page);
+	struct folio *folio = page_folio(page);
+	struct iomap_page *iop = to_iomap_page(folio);
 	struct inode *inode = page->mapping->host;
 	unsigned first = off >> inode->i_blkbits;
 	unsigned last = (off + len - 1) >> inode->i_blkbits;
@@ -173,7 +168,8 @@ static void
 iomap_read_page_end_io(struct bio_vec *bvec, int error)
 {
 	struct page *page = bvec->bv_page;
-	struct iomap_page *iop = to_iomap_page(page);
+	struct folio *folio = page_folio(page);
+	struct iomap_page *iop = to_iomap_page(folio);
 
 	if (unlikely(error)) {
 		ClearPageUptodate(page);
@@ -435,7 +431,8 @@ int
 iomap_is_partially_uptodate(struct page *page, unsigned long from,
 		unsigned long count)
 {
-	struct iomap_page *iop = to_iomap_page(page);
+	struct folio *folio = page_folio(page);
+	struct iomap_page *iop = to_iomap_page(folio);
 	struct inode *inode = page->mapping->host;
 	unsigned len, first, last;
 	unsigned i;
@@ -1012,7 +1009,8 @@ static void
 iomap_finish_page_writeback(struct inode *inode, struct page *page,
 		int error, unsigned int len)
 {
-	struct iomap_page *iop = to_iomap_page(page);
+	struct folio *folio = page_folio(page);
+	struct iomap_page *iop = to_iomap_page(folio);
 
 	if (error) {
 		SetPageError(page);
-- 
2.30.2


  parent reply	other threads:[~2021-07-19 22:09 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-19 18:39 [PATCH v15 00/17] Folio support in block + iomap layers Matthew Wilcox (Oracle)
2021-07-19 18:39 ` [PATCH v15 01/17] block: Add bio_add_folio() Matthew Wilcox (Oracle)
2021-07-20  1:28   ` Darrick J. Wong
2021-07-20  6:42   ` Christoph Hellwig
2021-07-20 11:16     ` Matthew Wilcox
2021-07-22 16:27     ` Matthew Wilcox
2021-07-30  8:25   ` Ming Lei
2021-07-30 11:30     ` Matthew Wilcox
2021-07-19 18:39 ` [PATCH v15 02/17] block: Add bio_for_each_folio_all() Matthew Wilcox (Oracle)
2021-07-20  1:29   ` Darrick J. Wong
2021-07-20  1:59     ` Matthew Wilcox
2021-07-20  6:48   ` Christoph Hellwig
2021-07-23  2:40     ` Matthew Wilcox
2021-07-20 12:05   ` kernel test robot
2021-07-20 12:05   ` kernel test robot
2021-07-20 12:26   ` kernel test robot
2021-07-19 18:39 ` Matthew Wilcox (Oracle) [this message]
2021-07-20  6:49   ` [PATCH v15 03/17] iomap: Convert to_iomap_page to take a folio Christoph Hellwig
2021-07-19 18:39 ` [PATCH v15 04/17] iomap: Convert iomap_page_create " Matthew Wilcox (Oracle)
2021-07-20  6:50   ` Christoph Hellwig
2021-07-19 18:39 ` [PATCH v15 05/17] iomap: Convert iomap_page_release " Matthew Wilcox (Oracle)
2021-07-20  6:52   ` Christoph Hellwig
2021-07-20 11:29     ` Matthew Wilcox
2021-07-20 11:40       ` Christoph Hellwig
2021-07-19 18:39 ` [PATCH v15 06/17] iomap: Convert iomap_releasepage to use " Matthew Wilcox (Oracle)
2021-07-20  6:54   ` Christoph Hellwig
2021-07-20 23:56   ` Darrick J. Wong
2021-07-19 18:39 ` [PATCH v15 07/17] iomap: Convert iomap_invalidatepage " Matthew Wilcox (Oracle)
2021-07-20  6:55   ` Christoph Hellwig
2021-07-20 23:57   ` Darrick J. Wong
2021-07-19 18:39 ` [PATCH v15 08/17] iomap: Pass the iomap_page into iomap_set_range_uptodate Matthew Wilcox (Oracle)
2021-07-20  6:57   ` Christoph Hellwig
2021-07-20 11:36     ` Matthew Wilcox
2021-07-19 18:39 ` [PATCH v15 09/17] iomap: Use folio offsets instead of page offsets Matthew Wilcox (Oracle)
2021-07-20  6:59   ` Christoph Hellwig
2021-07-20 11:42     ` Matthew Wilcox
2021-07-19 18:39 ` [PATCH v15 10/17] iomap: Convert bio completions to use folios Matthew Wilcox (Oracle)
2021-07-20  7:08   ` Christoph Hellwig
2021-07-19 18:39 ` [PATCH v15 11/17] iomap: Convert readahead and readpage to use a folio Matthew Wilcox (Oracle)
2021-07-20  7:09   ` Christoph Hellwig
2021-07-19 18:39 ` [PATCH v15 12/17] iomap: Convert iomap_page_mkwrite " Matthew Wilcox (Oracle)
2021-07-20  7:13   ` Christoph Hellwig
2021-07-19 18:39 ` [PATCH v15 13/17] iomap: Convert iomap_write_begin and iomap_write_end to folios Matthew Wilcox (Oracle)
2021-07-20  7:15   ` Christoph Hellwig
2021-07-20 23:59   ` Darrick J. Wong
2021-07-19 18:39 ` [PATCH v15 14/17] iomap: Convert iomap_read_inline_data to take a folio Matthew Wilcox (Oracle)
2021-07-20  7:16   ` Christoph Hellwig
2021-07-19 18:39 ` [PATCH v15 15/17] iomap: Convert iomap_write_end_inline " Matthew Wilcox (Oracle)
2021-07-20  7:17   ` Christoph Hellwig
2021-07-19 18:40 ` [PATCH v15 16/17] iomap: Convert iomap_add_to_ioend " Matthew Wilcox (Oracle)
2021-07-20  7:20   ` Christoph Hellwig
2021-07-20 11:45     ` Matthew Wilcox
2021-07-21  0:12   ` Darrick J. Wong
2021-07-21  4:27     ` Christoph Hellwig
2021-07-21  4:31       ` Matthew Wilcox
2021-07-21 15:28         ` Darrick J. Wong
2021-07-19 18:40 ` [PATCH v15 17/17] iomap: Convert iomap_migrate_page to use folios Matthew Wilcox (Oracle)
2021-07-20  7:21   ` Christoph Hellwig
2021-07-20 13:30   ` kernel test robot
2021-07-21  0:02   ` Darrick J. Wong
2021-07-20  8:44 ` [PATCH v15 00/17] Folio support in block + iomap layers Christoph Hellwig
2021-07-20 11:08   ` Matthew Wilcox

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=20210719184001.1750630-4-willy@infradead.org \
    --to=willy@infradead.org \
    --cc=djwong@kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-mm@kvack.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).