From: Erez_Zadok Date: Fri, 16 Nov 2007 18:47:08 +0000 (-0500) Subject: Unionfs: debugging: show inode reference counts for all branches X-Git-Url: https://git.fsl.cs.sunysb.edu/?a=commitdiff_plain;h=5e6eeaceb84e8de2a2a2a2bdeae926d6bf044aeb;p=unionfs-odf.git Unionfs: debugging: show inode reference counts for all branches Another useful utility function for debugging, to show the inode refcnt's of all lower inodes. Signed-off-by: Erez Zadok --- diff --git a/fs/unionfs/debug.c b/fs/unionfs/debug.c index cc9d42ad67..424c60d650 100644 --- a/fs/unionfs/debug.c +++ b/fs/unionfs/debug.c @@ -468,3 +468,24 @@ void __show_dinode_times(const struct dentry *dentry, lower_inode->i_ctime.tv_nsec); } } + +void __show_inode_counts(const struct inode *inode, + const char *file, const char *fxn, int line) +{ + struct inode *lower_inode; + int bindex; + + if (!inode) { + printk("SiC: Null inode\n"); + return; + } + for (bindex=sbstart(inode->i_sb); bindex <= sbend(inode->i_sb); bindex++) { + lower_inode = unionfs_lower_inode_idx(inode, bindex); + if (!lower_inode) + continue; + printk("SIC(%lu:%d:%d): ", inode->i_ino, bindex, + atomic_read(&(inode)->i_count)); + printk("lc=%d ", atomic_read(&(lower_inode)->i_count)); + printk("%s:%s:%d\n",file,fxn,line); + } +} diff --git a/fs/unionfs/union.h b/fs/unionfs/union.h index f2a39af9d3..24ca368907 100644 --- a/fs/unionfs/union.h +++ b/fs/unionfs/union.h @@ -574,6 +574,8 @@ static inline struct dentry *__odf_dstack_pop(struct dentry_stack *stack) __FILE__,__FUNCTION__,__LINE__) #define show_dinode_times(d) __show_dinode_times((d), \ __FILE__,__FUNCTION__,__LINE__) +#define show_inode_counts(i) __show_inode_counts((i), \ + __FILE__,__FUNCTION__,__LINE__) extern void __unionfs_check_inode(const struct inode *inode, const char *fname, const char *fxn, int line); @@ -588,6 +590,8 @@ extern void __show_inode_times(const struct inode *inode, const char *file, const char *fxn, int line); extern void __show_dinode_times(const struct dentry *dentry, const char *file, const char *fxn, int line); +extern void __show_inode_counts(const struct inode *inode, + const char *file, const char *fxn, int line); #else /* not UNIONFS_DEBUG */ @@ -598,6 +602,7 @@ extern void __show_dinode_times(const struct dentry *dentry, #define show_branch_counts(sb) #define show_inode_times(i) #define show_dinode_times(d) +#define show_inode_counts(i) #endif /* not UNIONFS_DEBUG */