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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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 ...

-Eric

_______________________________________________
xfs mailing list
xfs@xxxxxxxxxxx
http://oss.sgi.com/mailman/listinfo/xfs



[Index of Archives]     [Linux XFS Devel]     [Linux Filesystem Development]     [Filesystem Testing]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux