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

Dave Chinner david at fromorbit.com
Wed Oct 7 01:18:05 CDT 2015


On Fri, Oct 02, 2015 at 11:22:40AM -0500, Bill O'Donnell wrote:
> 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 at redhat.com>
....
> +#define __XFS_BTREE_STATS_INC(mp, type, stat) \
> +	XFS_STATS_INC(mp, xs_ ## type ## _2_ ## stat)
> +#define XFS_BTREE_STATS_INC(cur, stat)	\
>  do {    \
> +	struct xfs_mount *mp = cur->bc_mp; \

This will cause gcc to throw "shadow definition" warnings in
userspace as the macro will be used in functions that already have a
"mp" variable defined. In general, variables within a macro like
this are given a "__" prefix so such namespace collisions are
unlikely. I'll fix this up manually.

Otherwise looks OK.

Cheers,

Dave.
-- 
Dave Chinner
david at fromorbit.com



More information about the xfs mailing list