Skip to content

Commit d05d4a6

Browse files
Andreas Gruenbachergregkh
authored andcommitted
gfs2: less aggressive low-memory log flushing
[ Upstream commit 7288185 ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 2c57d6c commit d05d4a6

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
@@ -159,6 +159,7 @@ static int gfs2_writepages(struct address_space *mapping,
159159
struct writeback_control *wbc)
160160
{
161161
struct gfs2_sbd *sdp = gfs2_mapping2sbd(mapping);
162+
long initial_nr_to_write = wbc->nr_to_write;
162163
struct iomap_writepage_ctx wpc = {
163164
.inode = mapping->host,
164165
.wbc = wbc,
@@ -167,13 +168,13 @@ static int gfs2_writepages(struct address_space *mapping,
167168
int ret;
168169

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

0 commit comments

Comments
 (0)