commit 4d2dfbd57ef21eb5c879ef2213dbcde80bdecc7a
Author: Erez_Zadok <[EMAIL PROTECTED]>
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 <[EMAIL PROTECTED]>

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 */
 
_______________________________________________
unionfs-cvs mailing list: http://unionfs.filesystems.org/
[email protected]
http://www.fsl.cs.sunysb.edu/mailman/listinfo/unionfs-cvs

Reply via email to