aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/quota.h
diff options
context:
space:
mode:
authorDmitry Monakhov <dmonakhov@openvz.org>2010-05-26 17:21:58 -0400
committerJan Kara <jack@suse.cz>2010-05-27 12:56:27 -0400
commitf32764bd2bbb6ea003c158b1d276b4dc9f900348 (patch)
tree7fbabde3796a97b8b121349ea76b22b23238230a /include/linux/quota.h
parent1513b02c8b537af275ea74fdfb380c618b9e6778 (diff)
quota: Convert quota statistics to generic percpu_counter
Generic per-cpu counter has some memory overhead but it is negligible for modern systems and embedded systems compile without quota support. And code reuse is a good thing. This patch should fix complain from preemptive kernels which was introduced by dde9588853b1bde. [Jan Kara: Fixed patch to work on 32-bit archs as well] Reported-by: Rafael J. Wysocki <rjw@sisk.pl> Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org> Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'include/linux/quota.h')
-rw-r--r--include/linux/quota.h16
1 files changed, 4 insertions, 12 deletions
diff --git a/include/linux/quota.h b/include/linux/quota.h
index 2789d07c37be..94c1f03b50eb 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -174,8 +174,7 @@ enum {
174#include <linux/rwsem.h> 174#include <linux/rwsem.h>
175#include <linux/spinlock.h> 175#include <linux/spinlock.h>
176#include <linux/wait.h> 176#include <linux/wait.h>
177#include <linux/percpu.h> 177#include <linux/percpu_counter.h>
178#include <linux/smp.h>
179 178
180#include <linux/dqblk_xfs.h> 179#include <linux/dqblk_xfs.h>
181#include <linux/dqblk_v1.h> 180#include <linux/dqblk_v1.h>
@@ -254,6 +253,7 @@ enum {
254 253
255struct dqstats { 254struct dqstats {
256 int stat[_DQST_DQSTAT_LAST]; 255 int stat[_DQST_DQSTAT_LAST];
256 struct percpu_counter counter[_DQST_DQSTAT_LAST];
257}; 257};
258 258
259extern struct dqstats *dqstats_pcpu; 259extern struct dqstats *dqstats_pcpu;
@@ -261,20 +261,12 @@ extern struct dqstats dqstats;
261 261
262static inline void dqstats_inc(unsigned int type) 262static inline void dqstats_inc(unsigned int type)
263{ 263{
264#ifdef CONFIG_SMP 264 percpu_counter_inc(&dqstats.counter[type]);
265 per_cpu_ptr(dqstats_pcpu, smp_processor_id())->stat[type]++;
266#else
267 dqstats.stat[type]++;
268#endif
269} 265}
270 266
271static inline void dqstats_dec(unsigned int type) 267static inline void dqstats_dec(unsigned int type)
272{ 268{
273#ifdef CONFIG_SMP 269 percpu_counter_dec(&dqstats.counter[type]);
274 per_cpu_ptr(dqstats_pcpu, smp_processor_id())->stat[type]--;
275#else
276 dqstats.stat[type]--;
277#endif
278} 270}
279 271
280#define DQ_MOD_B 0 /* dquot modified since read */ 272#define DQ_MOD_B 0 /* dquot modified since read */