public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@sandeen.net>
To: xfs@oss.sgi.com
Subject: Re: [PATCH 7/7 v11] xfs: per-filesystem stats counter implementation
Date: Tue, 6 Oct 2015 22:37:51 -0500	[thread overview]
Message-ID: <5614938F.3020000@sandeen.net> (raw)
In-Reply-To: <20151006213553.GA21334@redhat.com>



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@redhat.com>
> ---

...

> 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@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  reply	other threads:[~2015-10-07  3:37 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-02 16:22 [PATCH 0/7 v10] xfs: per-fs stats in sysfs Bill O'Donnell
2015-10-02 16:22 ` [PATCH 1/7] xfs: create global stats and stats_clear " Bill O'Donnell
2015-10-02 16:22 ` [PATCH 2/7] xfs: create symlink proc/fs/xfs/stat to sys/fs/xfs/stats Bill O'Donnell
2015-10-02 16:22 ` [PATCH 3/7] xfs: remove unused procfs code Bill O'Donnell
2015-10-02 16:22 ` [PATCH 4/7] xfs: consolidate sysfs ops (dbg, stats, log) Bill O'Donnell
2015-10-02 16:22 ` [PATCH 5/7] xfs: incorporate sysfs/kobject in xfsstats: handlers take kobjects Bill O'Donnell
2015-10-02 16:22 ` [PATCH 6/7] xfs: per-filesystem stats in sysfs Bill O'Donnell
2015-10-07  6:29   ` Dave Chinner
2015-10-02 16:22 ` [PATCH 7/7] xfs: per-filesystem stats counter implementation Bill O'Donnell
2015-10-06 21:35   ` [PATCH 7/7 v11] " Bill O'Donnell
2015-10-07  3:37     ` Eric Sandeen [this message]
2015-10-07  6:21       ` Dave Chinner
2015-10-07  6:18   ` [PATCH 7/7] " Dave Chinner
2015-10-02 16:30 ` [PATCH 0/7 v10] xfs: per-fs stats in sysfs Eric Sandeen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5614938F.3020000@sandeen.net \
    --to=sandeen@sandeen.net \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox