From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
To: Andreas Gruenbacher <agruenba@redhat.com>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>,
gfs2@lists.linux.dev, linux-fsdevel@vger.kernel.org
Subject: [PATCH 1/4] gfs2: Add gfs2_aspace_writepages()
Date: Fri, 19 Jul 2024 18:51:01 +0100 [thread overview]
Message-ID: <20240719175105.788253-2-willy@infradead.org> (raw)
In-Reply-To: <20240719175105.788253-1-willy@infradead.org>
This saves one indirect function call per folio and gets us closer to
removing aops->writepage.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
fs/gfs2/meta_io.c | 28 +++++++++++++++++++++++-----
1 file changed, 23 insertions(+), 5 deletions(-)
diff --git a/fs/gfs2/meta_io.c b/fs/gfs2/meta_io.c
index 2b26e8d529aa..cfb204c9396c 100644
--- a/fs/gfs2/meta_io.c
+++ b/fs/gfs2/meta_io.c
@@ -30,9 +30,9 @@
#include "util.h"
#include "trace_gfs2.h"
-static int gfs2_aspace_writepage(struct page *page, struct writeback_control *wbc)
+static void gfs2_aspace_write_folio(struct folio *folio,
+ struct writeback_control *wbc)
{
- struct folio *folio = page_folio(page);
struct buffer_head *bh, *head;
int nr_underway = 0;
blk_opf_t write_flags = REQ_META | REQ_PRIO | wbc_to_write_flags(wbc);
@@ -66,8 +66,8 @@ static int gfs2_aspace_writepage(struct page *page, struct writeback_control *wb
} while ((bh = bh->b_this_page) != head);
/*
- * The page and its buffers are protected by PageWriteback(), so we can
- * drop the bh refcounts early.
+ * The folio and its buffers are protected from truncation by
+ * the writeback flag, so we can drop the bh refcounts early.
*/
BUG_ON(folio_test_writeback(folio));
folio_start_writeback(folio);
@@ -84,14 +84,31 @@ static int gfs2_aspace_writepage(struct page *page, struct writeback_control *wb
if (nr_underway == 0)
folio_end_writeback(folio);
+}
+
+static int gfs2_aspace_writepage(struct page *page, struct writeback_control *wbc)
+{
+ gfs2_aspace_write_folio(page_folio(page), wbc);
return 0;
}
+static int gfs2_aspace_writepages(struct address_space *mapping,
+ struct writeback_control *wbc)
+{
+ struct folio *folio = NULL;
+ int error;
+
+ while ((folio = writeback_iter(mapping, wbc, folio, &error)))
+ gfs2_aspace_write_folio(folio, wbc);
+
+ return error;
+}
+
const struct address_space_operations gfs2_meta_aops = {
.dirty_folio = block_dirty_folio,
.invalidate_folio = block_invalidate_folio,
- .writepage = gfs2_aspace_writepage,
+ .writepages = gfs2_aspace_writepages,
.release_folio = gfs2_release_folio,
};
@@ -99,6 +116,7 @@ const struct address_space_operations gfs2_rgrp_aops = {
.dirty_folio = block_dirty_folio,
.invalidate_folio = block_invalidate_folio,
.writepage = gfs2_aspace_writepage,
+ .writepages = gfs2_aspace_writepages,
.release_folio = gfs2_release_folio,
};
--
2.43.0
next prev parent reply other threads:[~2024-07-19 17:51 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-19 17:51 [PATCH 0/4] Remove uses of aops->writepage from gfs2 Matthew Wilcox (Oracle)
2024-07-19 17:51 ` Matthew Wilcox (Oracle) [this message]
2024-07-19 17:51 ` [PATCH 2/4] gfs2: Remove __gfs2_writepage() Matthew Wilcox (Oracle)
2024-07-19 17:51 ` [PATCH 3/4] gfs2: Remove gfs2_jdata_writepage() Matthew Wilcox (Oracle)
2024-07-19 17:51 ` [PATCH 4/4] gfs2: Remove gfs2_aspace_writepage() Matthew Wilcox (Oracle)
2024-08-07 12:21 ` [PATCH 0/4] Remove uses of aops->writepage from gfs2 Matthew Wilcox
2024-08-07 16:24 ` 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=20240719175105.788253-2-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).