Unionfs: implement replacement for mnt_get_count
authorErez Zadok <ezk@cs.sunysb.edu>
Sun, 6 Mar 2011 21:37:01 +0000 (16:37 -0500)
committerErez Zadok <ezk@cs.sunysb.edu>
Wed, 30 Mar 2011 23:31:56 +0000 (19:31 -0400)
Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
fs/unionfs/debug.c

index 100d2c625c323d866857e6ee50ec659f84b373f2..a76f92a9f389775da55c5e121bdd988c1642f960 100644 (file)
@@ -442,6 +442,22 @@ void __unionfs_check_nd(const struct nameidata *nd,
        }
 }
 
+static unsigned int __mnt_get_count(struct vfsmount *mnt)
+{
+#ifdef CONFIG_SMP
+       unsigned int count = 0;
+       int cpu;
+
+       for_each_possible_cpu(cpu) {
+               count += per_cpu_ptr(mnt->mnt_pcp, cpu)->mnt_count;
+       }
+
+       return count;
+#else
+       return mnt->mnt_count;
+#endif
+}
+
 /* useful to track vfsmount leaks that could cause EBUSY on unmount */
 void __show_branch_counts(const struct super_block *sb,
                          const char *file, const char *fxn, int line)
@@ -456,7 +472,7 @@ void __show_branch_counts(const struct super_block *sb,
                else
                        mnt = NULL;
                printk(KERN_CONT "%d:",
-                      (mnt ? atomic_read(&mnt->mnt_count) : -99));
+                      (mnt ? __mnt_get_count(mnt) : -99));
        }
        printk(KERN_CONT "%s:%s:%d\n", file, fxn, line);
 }