From mboxrd@z Thu Jan 1 00:00:00 1970 From: Steven Whitehouse Date: Mon, 4 Dec 2017 12:12:09 +0000 Subject: [Cluster-devel] [GFS2 PATCH] GFS2: Log the reason for log flushes in every log header In-Reply-To: <353387775.37200223.1512156899106.JavaMail.zimbra@redhat.com> References: <353387775.37200223.1512156899106.JavaMail.zimbra@redhat.com> Message-ID: <38e91074-0113-5f12-ae48-f1dee4370904@redhat.com> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Hi, On 01/12/17 19:34, Bob Peterson wrote: > Hi, > > This patch just adds the capability for GFS2 to track which function > called gfs2_log_flush. This should make it easier to diagnose > problems based on the sequence of events found in the journals. > > Signed-off-by: Bob Peterson > --- > fs/gfs2/aops.c | 2 +- > fs/gfs2/file.c | 3 ++- > fs/gfs2/glops.c | 13 +++++++------ > fs/gfs2/incore.h | 22 ++++++++++++++++++++++ > fs/gfs2/log.c | 19 +++++++++++-------- > fs/gfs2/log.h | 3 ++- > fs/gfs2/ops_fstype.c | 2 +- > fs/gfs2/quota.c | 3 ++- > fs/gfs2/rgrp.c | 3 ++- > fs/gfs2/super.c | 9 +++++---- > fs/gfs2/trans.c | 2 +- > 11 files changed, 56 insertions(+), 25 deletions(-) > > diff --git a/fs/gfs2/aops.c b/fs/gfs2/aops.c > index 658ca027cab9..10fa52321a73 100644 > --- a/fs/gfs2/aops.c > +++ b/fs/gfs2/aops.c > @@ -445,7 +445,7 @@ static int gfs2_jdata_writepages(struct address_space *mapping, > > ret = gfs2_write_cache_jdata(mapping, wbc); > if (ret == 0 && wbc->sync_mode == WB_SYNC_ALL) { > - gfs2_log_flush(sdp, ip->i_gl, NORMAL_FLUSH); > + gfs2_log_flush(sdp, ip->i_gl, NORMAL_FLUSH, LGF_JDATA_WPAGES); > ret = gfs2_write_cache_jdata(mapping, wbc); > } > return ret; Since we already have a flags field for gfs2_log_flush, lets make these the same field to avoid having to send two sets of flags. > diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c > index 58705ef8643a..e180df15e107 100644 > --- a/fs/gfs2/file.c > +++ b/fs/gfs2/file.c > @@ -246,7 +246,8 @@ static int do_gfs2_set_flags(struct file *filp, u32 reqflags, u32 mask) > } > if ((flags ^ new_flags) & GFS2_DIF_JDATA) { > if (new_flags & GFS2_DIF_JDATA) > - gfs2_log_flush(sdp, ip->i_gl, NORMAL_FLUSH); > + gfs2_log_flush(sdp, ip->i_gl, NORMAL_FLUSH, > + LGF_SET_FLAGS); > error = filemap_fdatawrite(inode->i_mapping); > if (error) > goto out; > diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c > index cdd1c5f06f45..f661fbec259c 100644 > --- a/fs/gfs2/glops.c > +++ b/fs/gfs2/glops.c > @@ -107,7 +107,7 @@ static void gfs2_ail_empty_gl(struct gfs2_glock *gl) > __gfs2_ail_flush(gl, 0, tr.tr_revokes); > > gfs2_trans_end(sdp); > - gfs2_log_flush(sdp, NULL, NORMAL_FLUSH); > + gfs2_log_flush(sdp, NULL, NORMAL_FLUSH, LGF_AIL_EMPTY_GL); > } > > void gfs2_ail_flush(struct gfs2_glock *gl, bool fsync) > @@ -128,7 +128,7 @@ void gfs2_ail_flush(struct gfs2_glock *gl, bool fsync) > return; > __gfs2_ail_flush(gl, fsync, max_revokes); > gfs2_trans_end(sdp); > - gfs2_log_flush(sdp, NULL, NORMAL_FLUSH); > + gfs2_log_flush(sdp, NULL, NORMAL_FLUSH, LGF_AIL_FLUSH); > } > > /** > @@ -157,7 +157,7 @@ static void rgrp_go_sync(struct gfs2_glock *gl) > return; > GLOCK_BUG_ON(gl, gl->gl_state != LM_ST_EXCLUSIVE); > > - gfs2_log_flush(sdp, gl, NORMAL_FLUSH); > + gfs2_log_flush(sdp, gl, NORMAL_FLUSH, LGF_RGRP_GO_SYNC); > filemap_fdatawrite_range(mapping, gl->gl_vm.start, gl->gl_vm.end); > error = filemap_fdatawait_range(mapping, gl->gl_vm.start, gl->gl_vm.end); > mapping_set_error(mapping, error); > @@ -252,7 +252,7 @@ static void inode_go_sync(struct gfs2_glock *gl) > > GLOCK_BUG_ON(gl, gl->gl_state != LM_ST_EXCLUSIVE); > > - gfs2_log_flush(gl->gl_name.ln_sbd, gl, NORMAL_FLUSH); > + gfs2_log_flush(gl->gl_name.ln_sbd, gl, NORMAL_FLUSH, LGF_INODE_GO_SYNC); > filemap_fdatawrite(metamapping); > if (isreg) { > struct address_space *mapping = ip->i_inode.i_mapping; > @@ -303,7 +303,8 @@ static void inode_go_inval(struct gfs2_glock *gl, int flags) > } > > if (ip == GFS2_I(gl->gl_name.ln_sbd->sd_rindex)) { > - gfs2_log_flush(gl->gl_name.ln_sbd, NULL, NORMAL_FLUSH); > + gfs2_log_flush(gl->gl_name.ln_sbd, NULL, NORMAL_FLUSH, > + LGF_INODE_GO_INVAL); > gl->gl_name.ln_sbd->sd_rindex_uptodate = 0; > } > if (ip && S_ISREG(ip->i_inode.i_mode)) > @@ -495,7 +496,7 @@ static void freeze_go_sync(struct gfs2_glock *gl) > gfs2_assert_withdraw(sdp, 0); > } > queue_work(gfs2_freeze_wq, &sdp->sd_freeze_work); > - gfs2_log_flush(sdp, NULL, FREEZE_FLUSH); > + gfs2_log_flush(sdp, NULL, FREEZE_FLUSH, LGF_FREEZE_GO_SYNC); > } > } > > diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h > index 6e18e9793ec4..1e07fa2468f9 100644 > --- a/fs/gfs2/incore.h > +++ b/fs/gfs2/incore.h > @@ -134,6 +134,28 @@ enum gfs2_state_bits { > BH_Zeronew = BH_PrivateStart + 2, > }; > > +enum gfs2_log_flushers { > + LGF_SHUTDOWN = 0x701, > + LGF_JDATA_WPAGES = 0x702, > + LGF_SET_FLAGS = 0x703, > + LGF_AIL_EMPTY_GL = 0x704, > + LGF_AIL_FLUSH = 0x705, > + LGF_RGRP_GO_SYNC = 0x706, > + LGF_INODE_GO_SYNC = 0x707, > + LGF_INODE_GO_INVAL = 0x708, > + LGF_FREEZE_GO_SYNC = 0x709, > + LGF_KILL_SB = 0x70a, > + LGF_DO_SYNC = 0x70b, > + LGF_INPLACE_RESERVE = 0x70c, > + LGF_WRITE_INODE = 0x70d, > + LGF_MAKE_FS_RO = 0x70e, > + LGF_SYNC_FS = 0x70f, > + LGF_EVICT_INODE = 0x710, > + LGF_TRANS_END = 0x711, > + LGF_LOGD_JFLUSH_REQD = 0x712, > + LGF_LOGD_AIL_FLUSH_REQD = 0x712, > +}; > + These constants are written to disk, so they need to be in the ondisk header file in order that the utils can access them. Steve.