mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 23:32:14 +00:00
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 dde9588853
.
[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>
This commit is contained in:
parent
1513b02c8b
commit
f32764bd2b
2 changed files with 17 additions and 45 deletions
|
@ -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 */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue