]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/xfs/linux-2.6/xfs_stats.c
[XFS] streamline init/exit path
[linux-2.6-omap-h63xx.git] / fs / xfs / linux-2.6 / xfs_stats.c
index 1f0589a05ecadb4f357e36d8470e9f1b8d4277b0..3d5b67c075c7ab5b927884313f35196fd9249e80 100644 (file)
@@ -62,7 +62,7 @@ xfs_read_xfsstats(
                while (j < xstats[i].endpoint) {
                        val = 0;
                        /* sum over all cpus */
-                       for_each_cpu(c)
+                       for_each_possible_cpu(c)
                                val += *(((__u32*)&per_cpu(xfsstats, c) + j));
                        len += sprintf(buffer + len, " %u", val);
                        j++;
@@ -70,7 +70,7 @@ xfs_read_xfsstats(
                buffer[len++] = '\n';
        }
        /* extra precision counters */
-       for_each_cpu(i) {
+       for_each_possible_cpu(i) {
                xs_xstrat_bytes += per_cpu(xfsstats, i).xs_xstrat_bytes;
                xs_write_bytes += per_cpu(xfsstats, i).xs_write_bytes;
                xs_read_bytes += per_cpu(xfsstats, i).xs_read_bytes;
@@ -98,12 +98,21 @@ xfs_read_xfsstats(
        return len;
 }
 
-void
+int
 xfs_init_procfs(void)
 {
        if (!proc_mkdir("fs/xfs", NULL))
-               return;
-       create_proc_read_entry("fs/xfs/stat", 0, NULL, xfs_read_xfsstats, NULL);
+               goto out;
+
+       if (!create_proc_read_entry("fs/xfs/stat", 0, NULL,
+                       xfs_read_xfsstats, NULL))
+               goto out_remove_entry;
+       return 0;
+
+ out_remove_entry:
+       remove_proc_entry("fs/xfs", NULL);
+ out:
+       return -ENOMEM;
 }
 
 void