Re: [PATCH 4/9] xfs: use per-CPU data for the quota statistics
From: Dave Chinner <david@fromorbit.com>
Date: 2012-02-15 23:59:34
From: Dave Chinner <david@fromorbit.com>
Date: 2012-02-15 23:59:34
On Tue, Feb 14, 2012 at 09:29:30PM -0500, Christoph Hellwig wrote:
Use the same per-CPU scheme used in the main XFS statistics, as well as the VFS inode and dcache statistics for the quota code. Signed-off-by: Christoph Hellwig <hch@lst.de>
.....
-struct xqmstats xqmstats;
+DEFINE_PER_CPU(struct xqmstats, xqmstats);
+
+static int xqmstats_sum(int idx)
+{
+ int val = 0, cpu;
+
+ for_each_possible_cpu(cpu)
+ val += *(((__u32 *)&per_cpu(xqmstats, cpu) + idx));
+ return max(val, 0);
+}Why not just make val a 64bit value so overflow is simply not an issue? Otherwise, all looks good. Reviewed-by: Dave Chinner <redacted> -- Dave Chinner david@fromorbit.com _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs