From: Dave Chinner <david@fromorbit.com>
To: Brian Foster <bfoster@redhat.com>
Cc: xfs@oss.sgi.com
Subject: Re: [RFC PATCH 1/2] xfs: add basic per-mount sysfs attribute support
Date: Tue, 20 May 2014 22:16:47 +1000 [thread overview]
Message-ID: <20140520121647.GH8554@dastard> (raw)
In-Reply-To: <1400263966-35541-2-git-send-email-bfoster@redhat.com>
On Fri, May 16, 2014 at 02:12:45PM -0400, Brian Foster wrote:
> Initialize/destroy a kset on module init/fini for XFS. The XFS attribute
> directory is represented as /sys/fs/xfs. Create a subdirectory per-mount
> based on the system device name.
>
> Also add some basic macros to aid in the addition of sysfs attributes.
> This code is modeled after the equivalent mechanism for ext4.
>
> Signed-off-by: Brian Foster <bfoster@redhat.com>
> ---
> fs/xfs/xfs_mount.c | 79 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
> fs/xfs/xfs_mount.h | 2 ++
> fs/xfs/xfs_super.c | 12 ++++++++-
> 3 files changed, 92 insertions(+), 1 deletion(-)
>
> diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
> index 944f3d9..9ed9dd0 100644
> --- a/fs/xfs/xfs_mount.c
> +++ b/fs/xfs/xfs_mount.c
> @@ -60,6 +60,9 @@ static DEFINE_MUTEX(xfs_uuid_table_mutex);
> static int xfs_uuid_table_size;
> static uuid_t *xfs_uuid_table;
>
> +extern struct kset *xfs_kset;
> +static struct kobj_type xfs_ktype;
> +
> /*
> * See if the UUID is unique among mounted XFS filesystems.
> * Mount fails if UUID is nil or a FS with the same UUID is already mounted.
> @@ -955,6 +958,13 @@ xfs_mountfs(
> "Unable to allocate reserve blocks. Continuing without reserve pool.");
> }
>
> + mp->m_kobject.kset = xfs_kset;
> + init_completion(&mp->m_kobject_complete);
> + error = kobject_init_and_add(&mp->m_kobject, &xfs_ktype, NULL,
> + "%s", mp->m_fsname);
> + if (error)
> + goto out_rtunmount;
> +
I think this should be wrapped in a helper, same for the destruction
code. It shoul dalso be called earlier rather than later, because we
are going to want to add children to this object (e.g. per-ag sysfs
attribute directories), and we probably want to isolate information
from different subsystems to different subdirectories under this.
e.g;
/sysfs/fs/xfs/vda/....
/vdb/log/...
/trans/...
/ag/0/sb/....
/agf/....
/agi/....
/agfl/....
/1/sb/...
...
/n/agfl/....
/quota/....
Dumping everything in the root directory is probably not a good
idea, and hence we shoul dbe creating the heirarchy as we initialise
subsystems during mount, and freeing them as we tear them down from
unmount...
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:[~2014-05-20 12:16 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-16 18:12 [RFC PATCH 0/2] xfs: sysfs attribute support Brian Foster
2014-05-16 18:12 ` [RFC PATCH 1/2] xfs: add basic per-mount " Brian Foster
2014-05-20 12:16 ` Dave Chinner [this message]
2014-05-16 18:12 ` [RFC PATCH 2/2] xfs: sysfs attributes for the current log state Brian Foster
2014-05-19 21:56 ` Dave Chinner
2014-05-20 11:17 ` Brian Foster
2014-05-20 11:52 ` Dave Chinner
2014-05-21 14:48 ` [RFC PATCH 0/2] xfs: sysfs attribute support Christoph Hellwig
2014-05-22 13:16 ` 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=20140520121647.GH8554@dastard \
--to=david@fromorbit.com \
--cc=bfoster@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