summaryrefslogtreecommitdiffstats
path: root/include/linux/quota.h
diff options
context:
space:
mode:
authorDmitry Monakhov <dmonakhov@openvz.org>2010-05-26 23:21:58 +0200
committerJan Kara <jack@suse.cz>2010-05-27 18:56:27 +0200
commitf32764bd2bbb6ea003c158b1d276b4dc9f900348 (patch)
tree7fbabde3796a97b8b121349ea76b22b23238230a /include/linux/quota.h
parent1513b02c8b537af275ea74fdfb380c618b9e6778 (diff)
downloadop-kernel-dev-f32764bd2bbb6ea003c158b1d276b4dc9f900348.zip
op-kernel-dev-f32764bd2bbb6ea003c158b1d276b4dc9f900348.tar.gz
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 2789d07..94c1f03 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -174,8 +174,7 @@ enum {
#include <linux/rwsem.h>
#include <linux/spinlock.h>
#include <linux/wait.h>
-#include <linux/percpu.h>
-#include <linux/smp.h>
+#include <linux/percpu_counter.h>
#include <linux/dqblk_xfs.h>
#include <linux/dqblk_v1.h>
@@ -254,6 +253,7 @@ enum {
struct dqstats {
int stat[_DQST_DQSTAT_LAST];
+ struct percpu_counter counter[_DQST_DQSTAT_LAST];
};
extern struct dqstats *dqstats_pcpu;
@@ -261,20 +261,12 @@ extern struct dqstats dqstats;
static inline void dqstats_inc(unsigned int type)
{
-#ifdef CONFIG_SMP
- per_cpu_ptr(dqstats_pcpu, smp_processor_id())->stat[type]++;
-#else
- dqstats.stat[type]++;
-#endif
+ percpu_counter_inc(&dqstats.counter[type]);
}
static inline void dqstats_dec(unsigned int type)
{
-#ifdef CONFIG_SMP
- per_cpu_ptr(dqstats_pcpu, smp_processor_id())->stat[type]--;
-#else
- dqstats.stat[type]--;
-#endif
+ percpu_counter_dec(&dqstats.counter[type]);
}
#define DQ_MOD_B 0 /* dquot modified since read */
OpenPOWER on IntegriCloud