From: Andreas Gruenbacher <agruenba@redhat.com>
To: gfs2@lists.linux.dev
Cc: Andreas Gruenbacher <agruenba@redhat.com>
Subject: [PATCH 06/18] gfs2: less aggressive low-memory log flushing
Date: Mon, 13 Apr 2026 16:51:59 +0200 [thread overview]
Message-ID: <20260413145211.881752-7-agruenba@redhat.com> (raw)
In-Reply-To: <20260413145211.881752-1-agruenba@redhat.com>
It turns out that for some workloads, the fix in commit b74cd55aa9a9d
("gfs2: low-memory forced flush fixes") causes the number of forced log
flushes to increase to a degree that the overall filesystem performance
drops significantly. Address that by forcing a log flush only when
gfs2_writepages cannot make any progress rather than when it cannot make
"enough" progress.
Fixes: b74cd55aa9a9d ("gfs2: low-memory forced flush fixes")
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
---
fs/gfs2/aops.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/fs/gfs2/aops.c b/fs/gfs2/aops.c
index e79ad087512a..6a6ded7a61d2 100644
--- a/fs/gfs2/aops.c
+++ b/fs/gfs2/aops.c
@@ -158,6 +158,7 @@ static int gfs2_writepages(struct address_space *mapping,
struct writeback_control *wbc)
{
struct gfs2_sbd *sdp = gfs2_mapping2sbd(mapping);
+ long initial_nr_to_write = wbc->nr_to_write;
struct iomap_writepage_ctx wpc = {
.inode = mapping->host,
.wbc = wbc,
@@ -166,13 +167,13 @@ static int gfs2_writepages(struct address_space *mapping,
int ret;
/*
- * Even if we didn't write enough pages here, we might still be holding
+ * Even if we didn't write any pages here, we might still be holding
* dirty pages in the ail. We forcibly flush the ail because we don't
* want balance_dirty_pages() to loop indefinitely trying to write out
* pages held in the ail that it can't find.
*/
ret = iomap_writepages(&wpc);
- if (ret == 0 && wbc->nr_to_write > 0)
+ if (ret == 0 && wbc->nr_to_write == initial_nr_to_write)
set_bit(SDF_FORCE_AIL_FLUSH, &sdp->sd_flags);
return ret;
}
--
2.53.0
next prev parent reply other threads:[~2026-04-13 14:52 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-13 14:51 [PATCH 00/18] gfs2 patches on for-next Andreas Gruenbacher
2026-04-13 14:51 ` [PATCH 01/18] gfs2: Call unlock_new_inode before d_instantiate Andreas Gruenbacher
2026-04-13 14:51 ` [PATCH 02/18] gfs2: Remove unnecessary check in gfs2_evict_inode Andreas Gruenbacher
2026-04-13 14:51 ` [PATCH 03/18] gfs2: Avoid unnecessary transactions in evict_linked_inode Andreas Gruenbacher
2026-04-13 14:51 ` [PATCH 04/18] gfs2: minor evict_[un]linked_inode cleanup Andreas Gruenbacher
2026-04-13 14:51 ` [PATCH 05/18] gfs2: Fix data loss during inode evict Andreas Gruenbacher
2026-04-13 14:51 ` Andreas Gruenbacher [this message]
2026-04-13 14:52 ` [PATCH 07/18] gfs2: Get rid of gfs2_log_[un]lock helpers Andreas Gruenbacher
2026-04-13 14:52 ` [PATCH 08/18] gfs2: Move gfs2_remove_from_journal to log.c Andreas Gruenbacher
2026-04-13 14:52 ` [PATCH 09/18] gfs2: Remove trans_drain code duplication Andreas Gruenbacher
2026-04-13 14:52 ` [PATCH 10/18] gfs2: bufdata allocation race Andreas Gruenbacher
2026-04-13 14:52 ` [PATCH 11/18] gfs2: drain ail under sd_log_flush_lock Andreas Gruenbacher
2026-04-13 14:52 ` [PATCH 12/18] gfs2: fix address space truncation during withdraw Andreas Gruenbacher
2026-04-13 14:52 ` [PATCH 13/18] gfs2: add some missing log locking Andreas Gruenbacher
2026-04-13 14:52 ` [PATCH 14/18] gfs2: gfs2_log_flush withdraw fixes Andreas Gruenbacher
2026-04-13 14:52 ` [PATCH 15/18] gfs2: inode directory consistency checks Andreas Gruenbacher
2026-04-13 14:52 ` [PATCH 16/18] gfs2: wait for withdraw earlier during unmount Andreas Gruenbacher
2026-04-13 14:52 ` [PATCH 17/18] gfs2: hide error messages after withdraw Andreas Gruenbacher
2026-04-13 14:52 ` [PATCH 18/18] gfs2: prevent NULL pointer dereference during unmount 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=20260413145211.881752-7-agruenba@redhat.com \
--to=agruenba@redhat.com \
--cc=gfs2@lists.linux.dev \
/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