xfs
[Top] [All Lists]

Re: [PATCH 7/7 v11] xfs: per-filesystem stats counter implementation

To: Eric Sandeen <sandeen@xxxxxxxxxxx>
Subject: Re: [PATCH 7/7 v11] xfs: per-filesystem stats counter implementation
From: Dave Chinner <david@xxxxxxxxxxxxx>
Date: Wed, 7 Oct 2015 17:21:14 +1100
Cc: xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <5614938F.3020000@xxxxxxxxxxx>
References: <1443802960-26662-1-git-send-email-billodo@xxxxxxxxxx> <1443802960-26662-8-git-send-email-billodo@xxxxxxxxxx> <20151006213553.GA21334@xxxxxxxxxx> <5614938F.3020000@xxxxxxxxxxx>
User-agent: Mutt/1.5.21 (2010-09-15)
On Tue, Oct 06, 2015 at 10:37:51PM -0500, Eric Sandeen wrote:
> 
> 
> On 10/6/15 4:35 PM, Bill O'Donnell wrote:
> > UPDATE:
> > -v11: fix errors in dfs_dquot.c functions touching stats counts.
> > 
> > This patch modifies the stats counting macros and the callers
> > to those macros to properly increment, decrement, and add-to
> > the xfs stats counts. The counts for global and per-fs stats
> > are correctly advanced, and cleared by writing a "1" to the
> > corresponding clear file.
> > 
> > global counts: /sys/fs/xfs/stats/stats
> > per-fs counts: /sys/fs/xfs/sda*/stats/stats
> > 
> > global clear:  /sys/fs/xfs/stats/stats_clear
> > per-fs clear:  /sys/fs/xfs/sda*/stats/stats_clear
> > 
> > Signed-off-by: Bill O'Donnell <billodo@xxxxxxxxxx>
> > ---
> 
> ...
> 
> > diff --git a/fs/xfs/xfs_stats.h b/fs/xfs/xfs_stats.h
> > index 54f2260..2ab82c5 100644
> > --- a/fs/xfs/xfs_stats.h
> > +++ b/fs/xfs/xfs_stats.h
> > @@ -218,14 +218,23 @@ int xfs_stats_format(struct xfsstats __percpu *stats, 
> > char *buf);
> >  void xfs_stats_clearall(struct xfsstats __percpu *stats);
> >  extern struct xstats xfsstats;
> >  
> > -#define XFS_STATS_INC(v)   \
> > -   (per_cpu_ptr(xfsstats.xs_stats, current_cpu())->v++)
> > +#define XFS_STATS_INC(mp, v)                                       \
> > +do {                                                               \
> > +   per_cpu_ptr(xfsstats.xs_stats, current_cpu())->v++;     \
> > +   per_cpu_ptr(mp->m_stats.xs_stats, current_cpu())->v++;  \
> > +} while (0)
> >  
> > -#define XFS_STATS_DEC(v)   \
> > -   (per_cpu_ptr(xfsstats.xs_stats, current_cpu())->v--)
> > +#define XFS_STATS_DEC(mp, v)                                       \
> > +do {                                                               \
> > +   per_cpu_ptr(xfsstats.xs_stats, current_cpu())->v--;     \
> > +   per_cpu_ptr(mp->m_stats.xs_stats, current_cpu())->v--;  \
> > +} while (0)
> >  
> > -#define XFS_STATS_ADD(v, inc)      \
> > -   (per_cpu_ptr(xfsstats.xs_stats, current_cpu())->v += (inc))
> > +#define XFS_STATS_ADD(mp, v, inc)                                  \
> > +do {                                                                       
> > \
> > +   per_cpu_ptr(xfsstats.xs_stats, current_cpu())->v += (inc);      \
> > +   per_cpu_ptr(mp->m_stats.xs_stats, current_cpu())->v += (inc);   \
> > +} while (0)
> >  
> >  extern int xfs_init_procfs(void);
> >  extern void xfs_cleanup_procfs(void);
> 
> One other thing that I just caught looking at the code (not enough context
> in the patch to see it) - this is all under #ifdef CONFIG_PROC_FS, and now
> that it's all moved to sysfs, we should just remove that conditional from
> this file.  The only thing that matters w.r.t. procfs is the symlink
> creation, and that's already handled in xfs_init_procfs() definitions.
> 
> Dave, maybe you can just fix that on commit ...

I moved the conditional just to cover the xfs_init_procfs()
definitions.

Cheers,

Dave.
-- 
Dave Chinner
david@xxxxxxxxxxxxx

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