From: Dave Chinner <david@fromorbit.com>
To: Bill O'Donnell <billodo@redhat.com>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH 4/4] xfs: consolidate sysfs ops (dbg, stats, log)
Date: Wed, 9 Sep 2015 07:06:44 +1000 [thread overview]
Message-ID: <20150908210644.GK3902@dastard> (raw)
In-Reply-To: <1441734594-4175-5-git-send-email-billodo@redhat.com>
On Tue, Sep 08, 2015 at 12:49:54PM -0500, Bill O'Donnell wrote:
> As a part of the series to move xfs global stats from procfs to sysfs,
> this patch consolidates the sysfs ops functions and removes redundancy.
>
> Signed-off-by: Bill O'Donnell <billodo@redhat.com>
> ---
> fs/xfs/xfs_stats.c | 2 +-
> fs/xfs/xfs_sysfs.c | 144 +++++++++++++++++------------------------------------
> 2 files changed, 48 insertions(+), 98 deletions(-)
>
> diff --git a/fs/xfs/xfs_stats.c b/fs/xfs/xfs_stats.c
> index 05d5227..dc6ca67 100644
> --- a/fs/xfs/xfs_stats.c
> +++ b/fs/xfs/xfs_stats.c
> @@ -92,7 +92,7 @@ int xfs_stats_format(char *buf)
> 0);
> #endif
>
> -return len;
> + return len;
> }
>
> void xfs_stats_clearall(void)
> diff --git a/fs/xfs/xfs_sysfs.c b/fs/xfs/xfs_sysfs.c
> index a094e20..6fd597b 100644
> --- a/fs/xfs/xfs_sysfs.c
> +++ b/fs/xfs/xfs_sysfs.c
> @@ -54,6 +54,50 @@ struct kobj_type xfs_mp_ktype = {
> .release = xfs_sysfs_release,
> };
>
> +static inline struct xlog *
> +to_xlog(struct kobject *kobject)
> +{
> + struct xfs_kobj *kobj = to_kobj(kobject);
> +
> + return container_of(kobj, struct xlog, l_kobj);
> +}
> +
> +STATIC ssize_t
> +xfs_sysfs_object_show(
> + struct kobject *kobject,
> + struct attribute *attr,
> + char *buf)
> +{
> + struct xfs_sysfs_attr *xfs_attr = to_attr(attr);
> + struct kobj_type *ktype = get_ktype(kobject);
> + void *data = NULL;
> +
> + if (ktype == &xfs_log_ktype)
> + data = to_xlog(kobject);
Move the to_xlog(kobject) to the relevant ->show/->store operations
and just pass the kobject to them. Otherwise we'll end up with a lot
of non-generic functionality in these functions.
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2015-09-08 21:06 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-08 17:49 [PATCH 0/4 V5] xfs: new global stats in sysfs Bill O'Donnell
2015-09-08 17:49 ` [PATCH 1/4] xfs: create global stats and stats_clear " Bill O'Donnell
2015-09-08 17:49 ` [PATCH 2/4] xfs: create symlink proc/fs/xfs/stat to sys/fs/xfs/stats Bill O'Donnell
2015-09-08 17:49 ` [PATCH 3/4] xfs: remove unused procfs code Bill O'Donnell
2015-09-08 17:49 ` [PATCH 4/4] xfs: consolidate sysfs ops (dbg, stats, log) Bill O'Donnell
2015-09-08 21:06 ` Dave Chinner [this message]
-- strict thread matches above, loose matches on Subject: below --
2015-09-09 17:06 [PATCH 0/4 v6] xfs: new global stats in sysfs Bill O'Donnell
2015-09-09 17:06 ` [PATCH 4/4] xfs: consolidate sysfs ops (dbg, stats, log) Bill O'Donnell
2015-09-08 15:09 [PATCH 0/4 V4] xfs: new global stats in sysfs Bill O'Donnell
2015-09-08 15:09 ` [PATCH 4/4] xfs: consolidate sysfs ops (dbg, stats, log) Bill O'Donnell
2015-09-08 16:23 ` Brian Foster
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=20150908210644.GK3902@dastard \
--to=david@fromorbit.com \
--cc=billodo@redhat.com \
--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