[PATCH 4/9] xfs: use per-CPU data for the quota statistics

Dave Chinner david at fromorbit.com
Wed Feb 15 17:59:29 CST 2012


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 at 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 <dchinner at redhat.com>

-- 
Dave Chinner
david at fromorbit.com



More information about the xfs mailing list