From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
To: "Darrick J. Wong" <djwong@kernel.org>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>,
linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-block@vger.kernel.org,
Jens Axboe <axboe@kernel.dk>,
Christoph Hellwig <hch@infradead.org>
Subject: [PATCH 17/21] iomap,xfs: Convert ->discard_page to ->discard_folio
Date: Mon, 1 Nov 2021 20:39:25 +0000 [thread overview]
Message-ID: <20211101203929.954622-18-willy@infradead.org> (raw)
In-Reply-To: <20211101203929.954622-1-willy@infradead.org>
XFS has the only implementation of ->discard_page today, so convert it
to use folios in the same patch as converting the API.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
fs/iomap/buffered-io.c | 4 ++--
fs/xfs/xfs_aops.c | 24 ++++++++++++------------
include/linux/iomap.h | 2 +-
3 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c
index 6862487f4067..c50ae76835ca 100644
--- a/fs/iomap/buffered-io.c
+++ b/fs/iomap/buffered-io.c
@@ -1349,8 +1349,8 @@ iomap_writepage_map(struct iomap_writepage_ctx *wpc,
* won't be affected by I/O completion and we must unlock it
* now.
*/
- if (wpc->ops->discard_page)
- wpc->ops->discard_page(page, file_offset);
+ if (wpc->ops->discard_folio)
+ wpc->ops->discard_folio(page_folio(page), file_offset);
if (!count) {
ClearPageUptodate(page);
unlock_page(page);
diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c
index 34fc6148032a..c6c4d07d0d26 100644
--- a/fs/xfs/xfs_aops.c
+++ b/fs/xfs/xfs_aops.c
@@ -428,37 +428,37 @@ xfs_prepare_ioend(
* see a ENOSPC in writeback).
*/
static void
-xfs_discard_page(
- struct page *page,
- loff_t fileoff)
+xfs_discard_folio(
+ struct folio *folio,
+ loff_t pos)
{
- struct inode *inode = page->mapping->host;
+ struct inode *inode = folio->mapping->host;
struct xfs_inode *ip = XFS_I(inode);
struct xfs_mount *mp = ip->i_mount;
- unsigned int pageoff = offset_in_page(fileoff);
- xfs_fileoff_t start_fsb = XFS_B_TO_FSBT(mp, fileoff);
- xfs_fileoff_t pageoff_fsb = XFS_B_TO_FSBT(mp, pageoff);
+ size_t offset = offset_in_folio(folio, pos);
+ xfs_fileoff_t start_fsb = XFS_B_TO_FSBT(mp, pos);
+ xfs_fileoff_t pageoff_fsb = XFS_B_TO_FSBT(mp, offset);
int error;
if (xfs_is_shutdown(mp))
goto out_invalidate;
xfs_alert_ratelimited(mp,
- "page discard on page "PTR_FMT", inode 0x%llx, offset %llu.",
- page, ip->i_ino, fileoff);
+ "page discard on page "PTR_FMT", inode 0x%llx, pos %llu.",
+ folio, ip->i_ino, pos);
error = xfs_bmap_punch_delalloc_range(ip, start_fsb,
- i_blocks_per_page(inode, page) - pageoff_fsb);
+ i_blocks_per_folio(inode, folio) - pageoff_fsb);
if (error && !xfs_is_shutdown(mp))
xfs_alert(mp, "page discard unable to remove delalloc mapping.");
out_invalidate:
- iomap_invalidatepage(page, pageoff, PAGE_SIZE - pageoff);
+ iomap_invalidate_folio(folio, offset, folio_size(folio) - offset);
}
static const struct iomap_writeback_ops xfs_writeback_ops = {
.map_blocks = xfs_map_blocks,
.prepare_ioend = xfs_prepare_ioend,
- .discard_page = xfs_discard_page,
+ .discard_folio = xfs_discard_folio,
};
STATIC int
diff --git a/include/linux/iomap.h b/include/linux/iomap.h
index 91de58ca09fc..1a161314d7e4 100644
--- a/include/linux/iomap.h
+++ b/include/linux/iomap.h
@@ -285,7 +285,7 @@ struct iomap_writeback_ops {
* Optional, allows the file system to discard state on a page where
* we failed to submit any I/O.
*/
- void (*discard_page)(struct page *page, loff_t fileoff);
+ void (*discard_folio)(struct folio *folio, loff_t pos);
};
struct iomap_writepage_ctx {
--
2.33.0
next prev parent reply other threads:[~2021-11-01 21:22 UTC|newest]
Thread overview: 70+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-01 20:39 [PATCH 00/21] iomap/xfs folio patches Matthew Wilcox (Oracle)
2021-11-01 20:39 ` [PATCH 01/21] fs: Remove FS_THP_SUPPORT Matthew Wilcox (Oracle)
2021-11-02 7:12 ` Christoph Hellwig
2021-11-01 20:39 ` [PATCH 02/21] block: Add bio_add_folio() Matthew Wilcox (Oracle)
2021-11-01 20:51 ` Jens Axboe
2021-11-02 14:15 ` Matthew Wilcox
2021-11-02 7:12 ` Christoph Hellwig
2021-11-03 1:25 ` wangjianjian (C)
2021-11-03 2:22 ` Matthew Wilcox
2021-11-01 20:39 ` [PATCH 03/21] block: Add bio_for_each_folio_all() Matthew Wilcox (Oracle)
2021-11-01 20:51 ` Jens Axboe
2021-11-02 7:13 ` Christoph Hellwig
2021-11-02 20:24 ` Matthew Wilcox
2021-11-02 22:24 ` Darrick J. Wong
2021-11-02 22:33 ` Jens Axboe
2021-11-02 22:37 ` Darrick J. Wong
2021-11-01 20:39 ` [PATCH 04/21] iomap: Convert to_iomap_page to take a folio Matthew Wilcox (Oracle)
2021-11-02 7:13 ` Christoph Hellwig
2021-11-01 20:39 ` [PATCH 05/21] iomap: Convert iomap_page_create " Matthew Wilcox (Oracle)
2021-11-02 7:14 ` Christoph Hellwig
2021-11-01 20:39 ` [PATCH 06/21] iomap: Convert iomap_page_release " Matthew Wilcox (Oracle)
2021-11-01 20:39 ` [PATCH 07/21] iomap: Convert iomap_releasepage to use " Matthew Wilcox (Oracle)
2021-11-02 7:14 ` Christoph Hellwig
2021-11-02 22:39 ` Darrick J. Wong
2021-11-01 20:39 ` [PATCH 08/21] iomap: Add iomap_invalidate_folio Matthew Wilcox (Oracle)
2021-11-02 7:15 ` Christoph Hellwig
2021-11-02 22:36 ` Darrick J. Wong
2021-11-01 20:39 ` [PATCH 09/21] iomap: Pass the iomap_page into iomap_set_range_uptodate Matthew Wilcox (Oracle)
2021-11-02 7:16 ` Christoph Hellwig
2021-11-01 20:39 ` [PATCH 10/21] iomap: Convert bio completions to use folios Matthew Wilcox (Oracle)
2021-11-02 7:17 ` Christoph Hellwig
2021-11-01 20:39 ` [PATCH 11/21] iomap: Use folio offsets instead of page offsets Matthew Wilcox (Oracle)
2021-11-02 7:18 ` Christoph Hellwig
2021-11-01 20:39 ` [PATCH 12/21] iomap: Convert iomap_read_inline_data to take a folio Matthew Wilcox (Oracle)
2021-11-02 7:18 ` Christoph Hellwig
2021-11-01 20:39 ` [PATCH 13/21] iomap: Convert readahead and readpage to use " Matthew Wilcox (Oracle)
2021-11-02 7:20 ` Christoph Hellwig
2021-11-02 12:28 ` Matthew Wilcox
2021-11-01 20:39 ` [PATCH 14/21] iomap: Convert iomap_page_mkwrite " Matthew Wilcox (Oracle)
2021-11-02 7:21 ` Christoph Hellwig
2021-11-01 20:39 ` [PATCH 15/21] iomap: Convert iomap_write_begin and iomap_write_end to folios Matthew Wilcox (Oracle)
2021-11-02 0:25 ` kernel test robot
2021-11-02 7:22 ` Christoph Hellwig
2021-11-02 23:22 ` Darrick J. Wong
2021-11-03 3:15 ` Matthew Wilcox
2021-11-03 12:47 ` Matthew Wilcox
2021-11-01 20:39 ` [PATCH 16/21] iomap: Convert iomap_write_end_inline to take a folio Matthew Wilcox (Oracle)
2021-11-02 7:22 ` Christoph Hellwig
2021-11-01 20:39 ` Matthew Wilcox (Oracle) [this message]
2021-11-02 7:23 ` [PATCH 17/21] iomap,xfs: Convert ->discard_page to ->discard_folio Christoph Hellwig
2021-11-03 15:43 ` Darrick J. Wong
2021-11-01 20:39 ` [PATCH 18/21] iomap: Convert iomap_add_to_ioend to take a folio Matthew Wilcox (Oracle)
2021-11-02 7:26 ` Christoph Hellwig
2021-11-02 20:28 ` Matthew Wilcox
2021-11-03 15:54 ` Christoph Hellwig
2021-11-04 3:33 ` Matthew Wilcox
2021-11-04 8:38 ` Christoph Hellwig
2021-11-04 8:40 ` Christoph Hellwig
2021-11-03 16:00 ` Darrick J. Wong
2021-11-04 3:42 ` Matthew Wilcox
2021-11-01 20:39 ` [PATCH 19/21] iomap: Convert iomap_migrate_page to use folios Matthew Wilcox (Oracle)
2021-11-02 7:27 ` Christoph Hellwig
2021-11-03 16:02 ` Darrick J. Wong
2021-11-06 3:44 ` Matthew Wilcox
2021-11-01 20:39 ` [PATCH 20/21] iomap: Support multi-page folios in invalidatepage Matthew Wilcox (Oracle)
2021-11-02 7:27 ` Christoph Hellwig
2021-11-03 16:03 ` Darrick J. Wong
2021-11-01 20:39 ` [PATCH 21/21] xfs: Support multi-page folios Matthew Wilcox (Oracle)
2021-11-02 7:27 ` Christoph Hellwig
2021-11-03 16:07 ` Darrick J. Wong
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=20211101203929.954622-18-willy@infradead.org \
--to=willy@infradead.org \
--cc=axboe@kernel.dk \
--cc=djwong@kernel.org \
--cc=hch@infradead.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-xfs@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 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).