Commit 6f0419e0 authored by KAMEZAWA Hiroyuki's avatar KAMEZAWA Hiroyuki Committed by Linus Torvalds

[PATCH] for_each_possible_cpu: xfs

for_each_cpu() actually iterates across all possible CPUs.  We've had mistakes
in the past where people were using for_each_cpu() where they should have been
iterating across only online or present CPUs.  This is inefficient and
possibly buggy.

We're renaming for_each_cpu() to for_each_possible_cpu() to avoid this in the
future.

This patch replaces for_each_cpu with for_each_possible_cpu.
in xfs.
Signed-off-by: default avatarKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Acked-by: default avatarNathan Scott <nathans@sgi.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent d6938d1b
...@@ -62,7 +62,7 @@ xfs_read_xfsstats( ...@@ -62,7 +62,7 @@ xfs_read_xfsstats(
while (j < xstats[i].endpoint) { while (j < xstats[i].endpoint) {
val = 0; val = 0;
/* sum over all cpus */ /* sum over all cpus */
for_each_cpu(c) for_each_possible_cpu(c)
val += *(((__u32*)&per_cpu(xfsstats, c) + j)); val += *(((__u32*)&per_cpu(xfsstats, c) + j));
len += sprintf(buffer + len, " %u", val); len += sprintf(buffer + len, " %u", val);
j++; j++;
...@@ -70,7 +70,7 @@ xfs_read_xfsstats( ...@@ -70,7 +70,7 @@ xfs_read_xfsstats(
buffer[len++] = '\n'; buffer[len++] = '\n';
} }
/* extra precision counters */ /* extra precision counters */
for_each_cpu(i) { for_each_possible_cpu(i) {
xs_xstrat_bytes += per_cpu(xfsstats, i).xs_xstrat_bytes; xs_xstrat_bytes += per_cpu(xfsstats, i).xs_xstrat_bytes;
xs_write_bytes += per_cpu(xfsstats, i).xs_write_bytes; xs_write_bytes += per_cpu(xfsstats, i).xs_write_bytes;
xs_read_bytes += per_cpu(xfsstats, i).xs_read_bytes; xs_read_bytes += per_cpu(xfsstats, i).xs_read_bytes;
......
...@@ -38,7 +38,7 @@ xfs_stats_clear_proc_handler( ...@@ -38,7 +38,7 @@ xfs_stats_clear_proc_handler(
if (!ret && write && *valp) { if (!ret && write && *valp) {
printk("XFS Clearing xfsstats\n"); printk("XFS Clearing xfsstats\n");
for_each_cpu(c) { for_each_possible_cpu(c) {
preempt_disable(); preempt_disable();
/* save vn_active, it's a universal truth! */ /* save vn_active, it's a universal truth! */
vn_active = per_cpu(xfsstats, c).vn_active; vn_active = per_cpu(xfsstats, c).vn_active;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment