Skip to content

Commit 7288185

Browse files
author
Andreas Gruenbacher
committed
gfs2: less aggressive low-memory log flushing
It turns out that for some workloads, the fix in commit b74cd55 ("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: b74cd55 ("gfs2: low-memory forced flush fixes") Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
1 parent bd67f17 commit 7288185

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

fs/gfs2/aops.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ static int gfs2_writepages(struct address_space *mapping,
158158
struct writeback_control *wbc)
159159
{
160160
struct gfs2_sbd *sdp = gfs2_mapping2sbd(mapping);
161+
long initial_nr_to_write = wbc->nr_to_write;
161162
struct iomap_writepage_ctx wpc = {
162163
.inode = mapping->host,
163164
.wbc = wbc,
@@ -166,13 +167,13 @@ static int gfs2_writepages(struct address_space *mapping,
166167
int ret;
167168

168169
/*
169-
* Even if we didn't write enough pages here, we might still be holding
170+
* Even if we didn't write any pages here, we might still be holding
170171
* dirty pages in the ail. We forcibly flush the ail because we don't
171172
* want balance_dirty_pages() to loop indefinitely trying to write out
172173
* pages held in the ail that it can't find.
173174
*/
174175
ret = iomap_writepages(&wpc);
175-
if (ret == 0 && wbc->nr_to_write > 0)
176+
if (ret == 0 && wbc->nr_to_write == initial_nr_to_write)
176177
set_bit(SDF_FORCE_AIL_FLUSH, &sdp->sd_flags);
177178
return ret;
178179
}

0 commit comments

Comments
 (0)