Skip to content

Commit 17d7768

Browse files
AstralBobAndreas Gruenbacher
authored andcommitted
gfs2: Don't get stuck with I/O plugged in gfs2_ail1_flush
In gfs2_ail1_flush, we're using I/O plugging to give the block layer a better chance of merging I/O requests. If we're too aggressive here, we can end up waiting on I/O to complete while still plugged. Fix that in a way similar to writeback_sb_inodes, except that we can't use blk_flush_plug because blk_flush_plug_list is not exported. Signed-off-by: Bob Peterson <[email protected]> Signed-off-by: Andreas Gruenbacher <[email protected]>
1 parent 803074a commit 17d7768

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

fs/gfs2/log.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ void gfs2_remove_from_ail(struct gfs2_bufdata *bd)
9191

9292
static int gfs2_ail1_start_one(struct gfs2_sbd *sdp,
9393
struct writeback_control *wbc,
94-
struct gfs2_trans *tr)
94+
struct gfs2_trans *tr, struct blk_plug *plug)
9595
__releases(&sdp->sd_ail_lock)
9696
__acquires(&sdp->sd_ail_lock)
9797
{
@@ -133,6 +133,11 @@ __acquires(&sdp->sd_ail_lock)
133133
continue;
134134
spin_unlock(&sdp->sd_ail_lock);
135135
ret = generic_writepages(mapping, wbc);
136+
if (need_resched()) {
137+
blk_finish_plug(plug);
138+
cond_resched();
139+
blk_start_plug(plug);
140+
}
136141
spin_lock(&sdp->sd_ail_lock);
137142
if (ret == -ENODATA) /* if a jdata write into a new hole */
138143
ret = 0; /* ignore it */
@@ -207,7 +212,7 @@ void gfs2_ail1_flush(struct gfs2_sbd *sdp, struct writeback_control *wbc)
207212
list_for_each_entry_reverse(tr, head, tr_list) {
208213
if (wbc->nr_to_write <= 0)
209214
break;
210-
ret = gfs2_ail1_start_one(sdp, wbc, tr);
215+
ret = gfs2_ail1_start_one(sdp, wbc, tr, &plug);
211216
if (ret) {
212217
if (ret == -EBUSY)
213218
goto restart;

0 commit comments

Comments
 (0)