GIT: unionfs2-2.6.27.y: Unionfs: debugging: show inode reference counts for all branches

Erez Zadok ezk at fsl.cs.sunysb.edu
Thu Aug 12 23:16:46 EDT 2010


commit e7238a8f4c95389eb0630dfdf28871a2e016466a
Author: Erez_Zadok <ezk at cs.sunysb.edu>
Date:   Mon Jul 16 23:38:30 2007 -0400

    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 <ezk at cs.sunysb.edu>

diff --git a/fs/unionfs/debug.c b/fs/unionfs/debug.c
index cc9d42a..424c60d 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 2bedaec..a13052b 100644
--- a/fs/unionfs/union.h
+++ b/fs/unionfs/union.h
@@ -545,6 +545,8 @@ static inline void unionfs_mntput(struct dentry *dentry, int bindex)
 	__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);
@@ -559,6 +561,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 */
 
@@ -569,6 +573,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 */
 


More information about the unionfs-cvs mailing list