xfs
[Top] [All Lists]

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

To: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Subject: Re: [PATCH 4/9] xfs: use per-CPU data for the quota statistics
From: Dave Chinner <david@xxxxxxxxxxxxx>
Date: Thu, 16 Feb 2012 10:59:29 +1100
Cc: xfs@xxxxxxxxxxx
In-reply-to: <20120215023147.414783335@xxxxxxxxxxxxxxxxxxxxxx>
References: <20120215022926.577682146@xxxxxxxxxxxxxxxxxxxxxx> <20120215023147.414783335@xxxxxxxxxxxxxxxxxxxxxx>
User-agent: Mutt/1.5.21 (2010-09-15)
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@xxxxxx>

.....

> -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@xxxxxxxxxx>

-- 
Dave Chinner
david@xxxxxxxxxxxxx

<Prev in Thread] Current Thread [Next in Thread>