GFS2: Add new debug trace point and evict code path
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/1 GFS2: Add new debug trace point and evict code path
Hi,
This patch adds a new kernel trace point for general gfs2 debugging. Its first use is to trace which codepath is taken when an inode is evicted. This helped me debugging some nasty problems.
Signed-off-by Bob Peterson <[email protected]>
---
fs/gfs2/super.c +26 -7
@@ -41,6 +41,7 @@#include "recovery.h" #include "rgrp.h" #include "super.h" +#include "trace_gfs2.h" #include "trans.h" #include "util.h" #include "sys.h"
@@ -815,6 +816,7 @@ static void gfs2_dirty_inode(struct inode *inode, int flags) } ret =gfs2_meta_inode_buffer (ip, &bh); +trace_gfs2_debug (ip->i_gl, ret,"gfs2_dirty_inode" );if (ret ==0 ) {gfs2_trans_add_meta (ip->i_gl, bh);gfs2_dinode_out (ip, bh->b_data);
@@ -1528,12 +1530,15 @@ static void gfs2_evict_inode(struct inode *inode)int error;if (test_bit (GIF_FREE_VFS_INODE , &ip->i_flags)) { +trace_gfs2_debug (ip->i_gl, inode->i_nlink,"evict_case_3a" );clear_inode (inode);return ; } -if (inode->i_nlink || (sb->s_flags &MS_RDONLY )) +if (inode->i_nlink || (sb->s_flags &MS_RDONLY )) { +trace_gfs2_debug (ip->i_gl, inode->i_state,"evict_case_3" ); goto out; + }/* Must not read inode block until block type has been verified */ error =gfs2_glock_nq_init (ip->i_gl,LM_ST_EXCLUSIVE ,GL_SKIP , &gh);
@@ -1541,19 +1546,24 @@ static void gfs2_evict_inode(struct inode *inode) ip->i_iopen_gh.gh_flags |=GL_NOCACHE ;gfs2_glock_dq_wait (&ip->i_iopen_gh);gfs2_holder_uninit (&ip->i_iopen_gh); +trace_gfs2_debug (ip->i_gl, error,"evict_case_glerr" ); goto out; }if (!test_bit (GIF_ALLOC_FAILED , &ip->i_flags)) { error =gfs2_check_blk_type (sdp, ip->i_no_addr,GFS2_BLKST_UNLINKED ); -if (error) +if (error) { +trace_gfs2_debug (ip->i_gl, error,"evict_case_2a" ); goto out_truncate; + } }if (test_bit (GIF_INVALID , &ip->i_flags)) { error =gfs2_inode_refresh (ip); -if (error) +if (error) { +trace_gfs2_debug (ip->i_gl, error,"evict_case_2b" ); goto out_truncate; + } } if (gfs2_holder_initialized(&ip->i_iopen_gh) &&
@@ -1563,8 +1573,10 @@ static void gfs2_evict_inode(struct inode *inode)gfs2_holder_reinit (LM_ST_EXCLUSIVE ,LM_FLAG_TRY_1CB |GL_NOCACHE , &ip->i_iopen_gh); error =gfs2_glock_nq (&ip->i_iopen_gh); -if (error) +if (error) { +trace_gfs2_debug (ip->i_gl, error,"evict_case_2c" ); goto out_truncate; + } }/* Case 1 starts here */
@@ -1572,22 +1584,29 @@ static void gfs2_evict_inode(struct inode *inode)if (S_ISDIR (inode->i_mode) && (ip->i_diskflags &GFS2_DIF_EXHASH )) { error =gfs2_dir_exhash_dealloc (ip); -if (error) +if (error) { +trace_gfs2_debug (ip->i_gl, error,"evict_case_1a" ); goto out_unlock; + } }if (ip->i_eattr) { error =gfs2_ea_dealloc (ip); -if (error) +if (error) { +trace_gfs2_debug (ip->i_gl, error,"evict_case_1b" ); goto out_unlock; + } }if (!gfs2_is_stuffed (ip)) { error =gfs2_file_dealloc (ip); -if (error) +if (error) { +trace_gfs2_debug (ip->i_gl, error,"evict_case_1c" ); goto out_unlock; + } } +trace_gfs2_debug (ip->i_gl, error,"evict_case_1" ); error =gfs2_dinode_dealloc (ip); goto out_unlock;
fs/gfs2/trace_gfs2.h +32 -0
@@ -548,6 +548,38 @@ TRACE_EVENT(gfs2_rs, rs_func_name(__entry->func), (unsigned long)__entry->free) ); +/* Generic debug messages */ +TRACE_EVENT (gfs2_debug, + + TP_PROTO(struct gfs2_glock *gl, int ret, const char *msg), + +TP_ARGS (gl, ret, msg), + +TP_STRUCT__entry ( + __field( dev_t, dev ) + __field( u64, glnum ) + __field( u32, gltype ) + __field( int, ret ) + __field( int, nrpages ) +__string ( msg, msg ) + ), + +TP_fast_assign ( + __entry->dev = gl->gl_name.ln_sbd->sd_vfs->s_dev; + __entry->glnum = gl->gl_name.ln_number; + __entry->gltype = gl->gl_name.ln_type; + __entry->ret = ret; + __entry->nrpages = (gfs2_glock2aspace(gl) ? + gfs2_glock2aspace(gl)->nrpages : 0); + __assign_str(msg, msg); + ), + +TP_printk ("%u,%u %u:%llu rc:%d pgs: %d %s" , +MAJOR (__entry->dev),MINOR (__entry->dev), __entry->gltype, + (unsigned long long )__entry->glnum, __entry->ret, + __entry->nrpages,__get_str (msg)) +); +#endif /* _TRACE_GFS2_H */ /* This part must be outside protection */