Re: [PATCH 4/4] xfs: consolidate sysfs ops (dbg, stats, log)

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

 



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@xxxxxxxxxx>
> ---
>  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@xxxxxxxxxxxxx

_______________________________________________
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