Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

GFS2: Use filemap_fdatawrite() to write back the AIL

In order to ensure that the mapping stats (and thus the bdi) are correctly
updated, this patch changes the AIL writeback to use the filemap_datawrite
function. This helps prevent stalls in balance_dirty_pages() due to
large amounts of dirty metadata when there is little or no dirty data
around.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>

+5 -10
+5 -10
fs/gfs2/log.c
··· 91 91 __releases(&sdp->sd_ail_lock) 92 92 __acquires(&sdp->sd_ail_lock) 93 93 { 94 + struct gfs2_glock *gl = NULL; 94 95 struct gfs2_bufdata *bd, *s; 95 96 struct buffer_head *bh; 96 97 int retry; ··· 114 113 115 114 if (!buffer_dirty(bh)) 116 115 continue; 117 - 116 + if (gl == bd->bd_gl) 117 + continue; 118 + gl = bd->bd_gl; 118 119 list_move(&bd->bd_ail_st_list, &ai->ai_ail1_list); 119 120 120 - get_bh(bh); 121 121 spin_unlock(&sdp->sd_ail_lock); 122 - lock_buffer(bh); 123 - if (test_clear_buffer_dirty(bh)) { 124 - bh->b_end_io = end_buffer_write_sync; 125 - submit_bh(WRITE_SYNC, bh); 126 - } else { 127 - unlock_buffer(bh); 128 - brelse(bh); 129 - } 122 + filemap_fdatawrite(gfs2_glock2aspace(gl)); 130 123 spin_lock(&sdp->sd_ail_lock); 131 124 132 125 retry = 1;