From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
To: linux-fsdevel@vger.kernel.org, Andreas Gruenbacher <agruenba@redhat.com>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>, gfs2@lists.linux.dev
Subject: [PATCH 2/4] gfs2: Add a migrate_folio operation for journalled files
Date: Wed, 3 Apr 2024 18:23:49 +0100 [thread overview]
Message-ID: <20240403172400.1449213-3-willy@infradead.org> (raw)
In-Reply-To: <20240403172400.1449213-1-willy@infradead.org>
For journalled data, folio migration currently works by writing the folio
back, freeing the folio and faulting the new folio back in. We can
bypass that by telling the migration code to migrate the buffer_heads
attached to our folios. That lets us delete gfs2_jdata_writepage()
as it has no more callers.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
fs/gfs2/aops.c | 34 ++--------------------------------
1 file changed, 2 insertions(+), 32 deletions(-)
diff --git a/fs/gfs2/aops.c b/fs/gfs2/aops.c
index 974aca9c8ea8..68fc8af14700 100644
--- a/fs/gfs2/aops.c
+++ b/fs/gfs2/aops.c
@@ -116,8 +116,7 @@ static int gfs2_write_jdata_folio(struct folio *folio,
* @folio: The folio to write
* @wbc: The writeback control
*
- * This is shared between writepage and writepages and implements the
- * core of the writepage operation. If a transaction is required then
+ * Implements the core of write back. If a transaction is required then
* the checked flag will have been set and the transaction will have
* already been started before this is called.
*/
@@ -139,35 +138,6 @@ static int __gfs2_jdata_write_folio(struct folio *folio,
return gfs2_write_jdata_folio(folio, wbc);
}
-/**
- * gfs2_jdata_writepage - Write complete page
- * @page: Page to write
- * @wbc: The writeback control
- *
- * Returns: errno
- *
- */
-
-static int gfs2_jdata_writepage(struct page *page, struct writeback_control *wbc)
-{
- struct folio *folio = page_folio(page);
- struct inode *inode = page->mapping->host;
- struct gfs2_inode *ip = GFS2_I(inode);
- struct gfs2_sbd *sdp = GFS2_SB(inode);
-
- if (gfs2_assert_withdraw(sdp, ip->i_gl->gl_state == LM_ST_EXCLUSIVE))
- goto out;
- if (folio_test_checked(folio) || current->journal_info)
- goto out_ignore;
- return __gfs2_jdata_write_folio(folio, wbc);
-
-out_ignore:
- folio_redirty_for_writepage(wbc, folio);
-out:
- folio_unlock(folio);
- return 0;
-}
-
/**
* gfs2_writepages - Write a bunch of dirty pages back to disk
* @mapping: The mapping to write
@@ -749,12 +719,12 @@ static const struct address_space_operations gfs2_aops = {
};
static const struct address_space_operations gfs2_jdata_aops = {
- .writepage = gfs2_jdata_writepage,
.writepages = gfs2_jdata_writepages,
.read_folio = gfs2_read_folio,
.readahead = gfs2_readahead,
.dirty_folio = jdata_dirty_folio,
.bmap = gfs2_bmap,
+ .migrate_folio = buffer_migrate_folio,
.invalidate_folio = gfs2_invalidate_folio,
.release_folio = gfs2_release_folio,
.is_partially_uptodate = block_is_partially_uptodate,
--
2.43.0
next prev parent reply other threads:[~2024-04-03 17:24 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-03 17:23 [PATCH 0/4] More GFS2 folio conversions Matthew Wilcox (Oracle)
2024-04-03 17:23 ` [PATCH 1/4] gfs2: Convert gfs2_page_mkwrite() to use a folio Matthew Wilcox (Oracle)
2024-04-03 17:23 ` Matthew Wilcox (Oracle) [this message]
2024-05-02 20:23 ` [PATCH 2/4] gfs2: Add a migrate_folio operation for journalled files Andreas Gruenbacher
2024-05-03 18:30 ` Matthew Wilcox
2024-05-03 19:04 ` Andreas Gruenbacher
2024-04-03 17:23 ` [PATCH 3/4] gfs2: Simplify gfs2_read_super Matthew Wilcox (Oracle)
2024-04-03 17:23 ` [PATCH 4/4] gfs2: Convert gfs2_aspace_writepage() to use a folio Matthew Wilcox (Oracle)
2024-05-02 20:17 ` [PATCH 0/4] More GFS2 folio conversions Andreas Gruenbacher
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=20240403172400.1449213-3-willy@infradead.org \
--to=willy@infradead.org \
--cc=agruenba@redhat.com \
--cc=gfs2@lists.linux.dev \
--cc=linux-fsdevel@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).