* [PATCH 2/3] xfs: create symlink proc/fs/xfs/stat to sys/fs/xfs/stats
2015-09-03 16:36 [PATCH 0/3] xfs: new global stats in sysfs billodo
@ 2015-09-03 16:36 ` billodo
2015-09-03 17:57 ` Darrick J. Wong
2015-09-03 20:08 ` Eric Sandeen
0 siblings, 2 replies; 12+ messages in thread
From: billodo @ 2015-09-03 16:36 UTC (permalink / raw)
To: xfs
As a part of the work to move xfs global stats from procfs to sysfs,
this patch creates the symlink from proc/fs/xfs/stat to sys/fs/xfs/stats.
Signed-off-by: Bill O'Donnell <billodo@redhat.com>
---
fs/xfs/xfs_stats.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/fs/xfs/xfs_stats.c b/fs/xfs/xfs_stats.c
index 856cf57..ad435f1 100644
--- a/fs/xfs/xfs_stats.c
+++ b/fs/xfs/xfs_stats.c
@@ -244,9 +244,13 @@ xfs_init_procfs(void)
if (!proc_mkdir("fs/xfs", NULL))
goto out;
- if (!proc_create("fs/xfs/stat", 0, NULL,
- &xfs_stat_proc_fops))
+ if (!proc_symlink("fs/xfs/stat", NULL,
+ "/sys/fs/xfs/stats/stats"))
+ {
+ printk(KERN_INFO "failed to created fs/xfs/stat symlink\n");
goto out_remove_xfs_dir;
+ }
+
#ifdef CONFIG_XFS_QUOTA
if (!proc_create("fs/xfs/xqmstat", 0, NULL,
&xqmstat_proc_fops))
--
2.4.3
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 2/3] xfs: create symlink proc/fs/xfs/stat to sys/fs/xfs/stats
2015-09-03 16:36 ` [PATCH 2/3] xfs: create symlink proc/fs/xfs/stat to sys/fs/xfs/stats billodo
@ 2015-09-03 17:57 ` Darrick J. Wong
2015-09-03 18:32 ` Eric Sandeen
2015-09-03 20:08 ` Eric Sandeen
1 sibling, 1 reply; 12+ messages in thread
From: Darrick J. Wong @ 2015-09-03 17:57 UTC (permalink / raw)
To: billodo; +Cc: xfs
On Thu, Sep 03, 2015 at 11:36:26AM -0500, billodo wrote:
> As a part of the work to move xfs global stats from procfs to sysfs,
> this patch creates the symlink from proc/fs/xfs/stat to sys/fs/xfs/stats.
>
> Signed-off-by: Bill O'Donnell <billodo@redhat.com>
> ---
> fs/xfs/xfs_stats.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/fs/xfs/xfs_stats.c b/fs/xfs/xfs_stats.c
> index 856cf57..ad435f1 100644
> --- a/fs/xfs/xfs_stats.c
> +++ b/fs/xfs/xfs_stats.c
> @@ -244,9 +244,13 @@ xfs_init_procfs(void)
> if (!proc_mkdir("fs/xfs", NULL))
> goto out;
>
> - if (!proc_create("fs/xfs/stat", 0, NULL,
> - &xfs_stat_proc_fops))
> + if (!proc_symlink("fs/xfs/stat", NULL,
> + "/sys/fs/xfs/stats/stats"))
Uh.... is it actually guaranteed that sysfs is mounted on /sys now?
I sort of recall gregkh grumbling years ago that sysfs can be mounted anywhere,
and that /proc shouldn't hardcode links to it. But that's just handwaving on
my part.
--D
> + {
> + printk(KERN_INFO "failed to created fs/xfs/stat symlink\n");
> goto out_remove_xfs_dir;
> + }
> +
> #ifdef CONFIG_XFS_QUOTA
> if (!proc_create("fs/xfs/xqmstat", 0, NULL,
> &xqmstat_proc_fops))
> --
> 2.4.3
>
> _______________________________________________
> xfs mailing list
> xfs@oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/3] xfs: create symlink proc/fs/xfs/stat to sys/fs/xfs/stats
2015-09-03 17:57 ` Darrick J. Wong
@ 2015-09-03 18:32 ` Eric Sandeen
2015-09-03 18:39 ` Bill O'Donnell
0 siblings, 1 reply; 12+ messages in thread
From: Eric Sandeen @ 2015-09-03 18:32 UTC (permalink / raw)
To: Darrick J. Wong, billodo; +Cc: xfs
On 9/3/15 12:57 PM, Darrick J. Wong wrote:
> On Thu, Sep 03, 2015 at 11:36:26AM -0500, billodo wrote:
>> As a part of the work to move xfs global stats from procfs to sysfs,
>> this patch creates the symlink from proc/fs/xfs/stat to sys/fs/xfs/stats.
>>
>> Signed-off-by: Bill O'Donnell <billodo@redhat.com>
>> ---
>> fs/xfs/xfs_stats.c | 8 ++++++--
>> 1 file changed, 6 insertions(+), 2 deletions(-)
>>
>> diff --git a/fs/xfs/xfs_stats.c b/fs/xfs/xfs_stats.c
>> index 856cf57..ad435f1 100644
>> --- a/fs/xfs/xfs_stats.c
>> +++ b/fs/xfs/xfs_stats.c
>> @@ -244,9 +244,13 @@ xfs_init_procfs(void)
>> if (!proc_mkdir("fs/xfs", NULL))
>> goto out;
>>
>> - if (!proc_create("fs/xfs/stat", 0, NULL,
>> - &xfs_stat_proc_fops))
>> + if (!proc_symlink("fs/xfs/stat", NULL,
>> + "/sys/fs/xfs/stats/stats"))
>
> Uh.... is it actually guaranteed that sysfs is mounted on /sys now?
>
> I sort of recall gregkh grumbling years ago that sysfs can be mounted anywhere,
> and that /proc shouldn't hardcode links to it. But that's just handwaving on
> my part.
You can blame me for that idea. At least one other driver does
do it, though; of_core_init():
proc_symlink("device-tree", NULL, "/sys/firmware/devicetree/base");
worst-case scenario, your "legacy" stats file will be a broken symlink...
-Eric
> --D
>
>> + {
>> + printk(KERN_INFO "failed to created fs/xfs/stat symlink\n");
>> goto out_remove_xfs_dir;
>> + }
>> +
>> #ifdef CONFIG_XFS_QUOTA
>> if (!proc_create("fs/xfs/xqmstat", 0, NULL,
>> &xqmstat_proc_fops))
>> --
>> 2.4.3
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/3] xfs: create symlink proc/fs/xfs/stat to sys/fs/xfs/stats
2015-09-03 18:32 ` Eric Sandeen
@ 2015-09-03 18:39 ` Bill O'Donnell
2015-09-03 19:15 ` Bill O'Donnell
0 siblings, 1 reply; 12+ messages in thread
From: Bill O'Donnell @ 2015-09-03 18:39 UTC (permalink / raw)
To: Eric Sandeen; +Cc: xfs, Darrick J. Wong
On Thu, Sep 03, 2015 at 01:32:25PM -0500, Eric Sandeen wrote:
> On 9/3/15 12:57 PM, Darrick J. Wong wrote:
> > On Thu, Sep 03, 2015 at 11:36:26AM -0500, billodo wrote:
> >> As a part of the work to move xfs global stats from procfs to sysfs,
> >> this patch creates the symlink from proc/fs/xfs/stat to sys/fs/xfs/stats.
> >>
> >> Signed-off-by: Bill O'Donnell <billodo@redhat.com>
> >> ---
> >> fs/xfs/xfs_stats.c | 8 ++++++--
> >> 1 file changed, 6 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/fs/xfs/xfs_stats.c b/fs/xfs/xfs_stats.c
> >> index 856cf57..ad435f1 100644
> >> --- a/fs/xfs/xfs_stats.c
> >> +++ b/fs/xfs/xfs_stats.c
> >> @@ -244,9 +244,13 @@ xfs_init_procfs(void)
> >> if (!proc_mkdir("fs/xfs", NULL))
> >> goto out;
> >>
> >> - if (!proc_create("fs/xfs/stat", 0, NULL,
> >> - &xfs_stat_proc_fops))
> >> + if (!proc_symlink("fs/xfs/stat", NULL,
> >> + "/sys/fs/xfs/stats/stats"))
> >
> > Uh.... is it actually guaranteed that sysfs is mounted on /sys now?
> >
> > I sort of recall gregkh grumbling years ago that sysfs can be mounted anywhere,
> > and that /proc shouldn't hardcode links to it. But that's just handwaving on
> > my part.
>
> You can blame me for that idea. At least one other driver does
> do it, though; of_core_init():
>
> proc_symlink("device-tree", NULL, "/sys/firmware/devicetree/base");
>
> worst-case scenario, your "legacy" stats file will be a broken symlink...
>
> -Eric
>
I'm still looking for something in documentation that dictates such a requirement
regarding symlinks to sysfs elements.
-Bill
> > --D
> >
> >> + {
> >> + printk(KERN_INFO "failed to created fs/xfs/stat symlink\n");
> >> goto out_remove_xfs_dir;
> >> + }
> >> +
> >> #ifdef CONFIG_XFS_QUOTA
> >> if (!proc_create("fs/xfs/xqmstat", 0, NULL,
> >> &xqmstat_proc_fops))
> >> --
> >> 2.4.3
>
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/3] xfs: create symlink proc/fs/xfs/stat to sys/fs/xfs/stats
2015-09-03 18:39 ` Bill O'Donnell
@ 2015-09-03 19:15 ` Bill O'Donnell
2015-09-03 19:17 ` Darrick J. Wong
0 siblings, 1 reply; 12+ messages in thread
From: Bill O'Donnell @ 2015-09-03 19:15 UTC (permalink / raw)
To: Eric Sandeen, xfs, Darrick J. Wong
On Thu, Sep 03, 2015 at 01:39:53PM -0500, Bill O'Donnell wrote:
> On Thu, Sep 03, 2015 at 01:32:25PM -0500, Eric Sandeen wrote:
> > On 9/3/15 12:57 PM, Darrick J. Wong wrote:
> > > On Thu, Sep 03, 2015 at 11:36:26AM -0500, billodo wrote:
> > >> As a part of the work to move xfs global stats from procfs to sysfs,
> > >> this patch creates the symlink from proc/fs/xfs/stat to sys/fs/xfs/stats.
> > >>
> > >> Signed-off-by: Bill O'Donnell <billodo@redhat.com>
> > >> ---
> > >> fs/xfs/xfs_stats.c | 8 ++++++--
> > >> 1 file changed, 6 insertions(+), 2 deletions(-)
> > >>
> > >> diff --git a/fs/xfs/xfs_stats.c b/fs/xfs/xfs_stats.c
> > >> index 856cf57..ad435f1 100644
> > >> --- a/fs/xfs/xfs_stats.c
> > >> +++ b/fs/xfs/xfs_stats.c
> > >> @@ -244,9 +244,13 @@ xfs_init_procfs(void)
> > >> if (!proc_mkdir("fs/xfs", NULL))
> > >> goto out;
> > >>
> > >> - if (!proc_create("fs/xfs/stat", 0, NULL,
> > >> - &xfs_stat_proc_fops))
> > >> + if (!proc_symlink("fs/xfs/stat", NULL,
> > >> + "/sys/fs/xfs/stats/stats"))
> > >
> > > Uh.... is it actually guaranteed that sysfs is mounted on /sys now?
> > >
> > > I sort of recall gregkh grumbling years ago that sysfs can be mounted anywhere,
> > > and that /proc shouldn't hardcode links to it. But that's just handwaving on
> > > my part.
> >
> > You can blame me for that idea. At least one other driver does
> > do it, though; of_core_init():
> >
> > proc_symlink("device-tree", NULL, "/sys/firmware/devicetree/base");
> >
> > worst-case scenario, your "legacy" stats file will be a broken symlink...
> >
> > -Eric
> >
>
> I'm still looking for something in documentation that dictates such a requirement
> regarding symlinks to sysfs elements.
> -Bill
I did find this in: https://www.kernel.org/doc/Documentation/sysfs-rules.txt
--------------snip--------------------------
- sysfs is always at /sys
Parsing /proc/mounts is a waste of time. Other mount points are a
system configuration bug you should not try to solve. For test cases,
possibly support a SYSFS_PATH environment variable to overwrite the
application's behavior, but never try to search for sysfs. Never try
to mount it, if you are not an early boot script.
-------------snip---------------------------
>
> > > --D
> > >
> > >> + {
> > >> + printk(KERN_INFO "failed to created fs/xfs/stat symlink\n");
> > >> goto out_remove_xfs_dir;
> > >> + }
> > >> +
> > >> #ifdef CONFIG_XFS_QUOTA
> > >> if (!proc_create("fs/xfs/xqmstat", 0, NULL,
> > >> &xqmstat_proc_fops))
> > >> --
> > >> 2.4.3
> >
>
> _______________________________________________
> xfs mailing list
> xfs@oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/3] xfs: create symlink proc/fs/xfs/stat to sys/fs/xfs/stats
2015-09-03 19:15 ` Bill O'Donnell
@ 2015-09-03 19:17 ` Darrick J. Wong
0 siblings, 0 replies; 12+ messages in thread
From: Darrick J. Wong @ 2015-09-03 19:17 UTC (permalink / raw)
To: Bill O'Donnell; +Cc: Eric Sandeen, xfs
On Thu, Sep 03, 2015 at 02:15:01PM -0500, Bill O'Donnell wrote:
> On Thu, Sep 03, 2015 at 01:39:53PM -0500, Bill O'Donnell wrote:
> > On Thu, Sep 03, 2015 at 01:32:25PM -0500, Eric Sandeen wrote:
> > > On 9/3/15 12:57 PM, Darrick J. Wong wrote:
> > > > On Thu, Sep 03, 2015 at 11:36:26AM -0500, billodo wrote:
> > > >> As a part of the work to move xfs global stats from procfs to sysfs,
> > > >> this patch creates the symlink from proc/fs/xfs/stat to sys/fs/xfs/stats.
> > > >>
> > > >> Signed-off-by: Bill O'Donnell <billodo@redhat.com>
> > > >> ---
> > > >> fs/xfs/xfs_stats.c | 8 ++++++--
> > > >> 1 file changed, 6 insertions(+), 2 deletions(-)
> > > >>
> > > >> diff --git a/fs/xfs/xfs_stats.c b/fs/xfs/xfs_stats.c
> > > >> index 856cf57..ad435f1 100644
> > > >> --- a/fs/xfs/xfs_stats.c
> > > >> +++ b/fs/xfs/xfs_stats.c
> > > >> @@ -244,9 +244,13 @@ xfs_init_procfs(void)
> > > >> if (!proc_mkdir("fs/xfs", NULL))
> > > >> goto out;
> > > >>
> > > >> - if (!proc_create("fs/xfs/stat", 0, NULL,
> > > >> - &xfs_stat_proc_fops))
> > > >> + if (!proc_symlink("fs/xfs/stat", NULL,
> > > >> + "/sys/fs/xfs/stats/stats"))
> > > >
> > > > Uh.... is it actually guaranteed that sysfs is mounted on /sys now?
> > > >
> > > > I sort of recall gregkh grumbling years ago that sysfs can be mounted anywhere,
> > > > and that /proc shouldn't hardcode links to it. But that's just handwaving on
> > > > my part.
> > >
> > > You can blame me for that idea. At least one other driver does
> > > do it, though; of_core_init():
> > >
> > > proc_symlink("device-tree", NULL, "/sys/firmware/devicetree/base");
> > >
> > > worst-case scenario, your "legacy" stats file will be a broken symlink...
> > >
> > > -Eric
> > >
> >
> > I'm still looking for something in documentation that dictates such a requirement
> > regarding symlinks to sysfs elements.
> > -Bill
>
> I did find this in: https://www.kernel.org/doc/Documentation/sysfs-rules.txt
> --------------snip--------------------------
> - sysfs is always at /sys
> Parsing /proc/mounts is a waste of time. Other mount points are a
> system configuration bug you should not try to solve. For test cases,
> possibly support a SYSFS_PATH environment variable to overwrite the
> application's behavior, but never try to search for sysfs. Never try
> to mount it, if you are not an early boot script.
> -------------snip---------------------------
Ah, ok, sorry for the noise then.
--D
> >
> > > > --D
> > > >
> > > >> + {
> > > >> + printk(KERN_INFO "failed to created fs/xfs/stat symlink\n");
> > > >> goto out_remove_xfs_dir;
> > > >> + }
> > > >> +
> > > >> #ifdef CONFIG_XFS_QUOTA
> > > >> if (!proc_create("fs/xfs/xqmstat", 0, NULL,
> > > >> &xqmstat_proc_fops))
> > > >> --
> > > >> 2.4.3
> > >
> >
> > _______________________________________________
> > xfs mailing list
> > xfs@oss.sgi.com
> > http://oss.sgi.com/mailman/listinfo/xfs
>
> _______________________________________________
> xfs mailing list
> xfs@oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/3] xfs: create symlink proc/fs/xfs/stat to sys/fs/xfs/stats
2015-09-03 16:36 ` [PATCH 2/3] xfs: create symlink proc/fs/xfs/stat to sys/fs/xfs/stats billodo
2015-09-03 17:57 ` Darrick J. Wong
@ 2015-09-03 20:08 ` Eric Sandeen
1 sibling, 0 replies; 12+ messages in thread
From: Eric Sandeen @ 2015-09-03 20:08 UTC (permalink / raw)
To: billodo, xfs
On 9/3/15 11:36 AM, billodo wrote:
> As a part of the work to move xfs global stats from procfs to sysfs,
> this patch creates the symlink from proc/fs/xfs/stat to sys/fs/xfs/stats.
>
> Signed-off-by: Bill O'Donnell <billodo@redhat.com>
> ---
> fs/xfs/xfs_stats.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/fs/xfs/xfs_stats.c b/fs/xfs/xfs_stats.c
> index 856cf57..ad435f1 100644
> --- a/fs/xfs/xfs_stats.c
> +++ b/fs/xfs/xfs_stats.c
> @@ -244,9 +244,13 @@ xfs_init_procfs(void)
> if (!proc_mkdir("fs/xfs", NULL))
> goto out;
>
> - if (!proc_create("fs/xfs/stat", 0, NULL,
> - &xfs_stat_proc_fops))
> + if (!proc_symlink("fs/xfs/stat", NULL,
> + "/sys/fs/xfs/stats/stats"))
> + {
> + printk(KERN_INFO "failed to created fs/xfs/stat symlink\n");
> goto out_remove_xfs_dir;
> + }
> +
I'm not sure we need the printk, we didn't say anything if proc_create(fs/xfs/stat) failed...
I guess the cleanup is fine as it is, right, it can remove a symlink too AFAIK.
-Eric
> #ifdef CONFIG_XFS_QUOTA
> if (!proc_create("fs/xfs/xqmstat", 0, NULL,
> &xqmstat_proc_fops))
>
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 2/3] xfs: create symlink proc/fs/xfs/stat to sys/fs/xfs/stats
2015-09-04 12:55 [PATCH 0/3 V2] xfs: new global stats in sysfs Bill O'Donnell
@ 2015-09-04 12:55 ` Bill O'Donnell
2015-09-04 18:32 ` Eric Sandeen
0 siblings, 1 reply; 12+ messages in thread
From: Bill O'Donnell @ 2015-09-04 12:55 UTC (permalink / raw)
To: xfs
As a part of the work to move xfs global stats from procfs to sysfs,
this patch creates the symlink from proc/fs/xfs/stat to sys/fs/xfs/stats.
Signed-off-by: Bill O'Donnell <billodo@redhat.com>
---
fs/xfs/xfs_stats.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/fs/xfs/xfs_stats.c b/fs/xfs/xfs_stats.c
index 6008e25..734b867 100644
--- a/fs/xfs/xfs_stats.c
+++ b/fs/xfs/xfs_stats.c
@@ -244,9 +244,12 @@ xfs_init_procfs(void)
if (!proc_mkdir("fs/xfs", NULL))
goto out;
- if (!proc_create("fs/xfs/stat", 0, NULL,
- &xfs_stat_proc_fops))
+ if (!proc_symlink("fs/xfs/stat", NULL,
+ "/sys/fs/xfs/stats/stats"))
+ {
goto out_remove_xfs_dir;
+ }
+
#ifdef CONFIG_XFS_QUOTA
if (!proc_create("fs/xfs/xqmstat", 0, NULL,
&xqmstat_proc_fops))
--
2.4.3
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 2/3] xfs: create symlink proc/fs/xfs/stat to sys/fs/xfs/stats
2015-09-04 12:55 ` [PATCH 2/3] xfs: create symlink proc/fs/xfs/stat to sys/fs/xfs/stats Bill O'Donnell
@ 2015-09-04 18:32 ` Eric Sandeen
0 siblings, 0 replies; 12+ messages in thread
From: Eric Sandeen @ 2015-09-04 18:32 UTC (permalink / raw)
To: Bill O'Donnell, xfs
On 9/4/15 7:55 AM, Bill O'Donnell wrote:
> As a part of the work to move xfs global stats from procfs to sysfs,
> this patch creates the symlink from proc/fs/xfs/stat to sys/fs/xfs/stats.
>
> Signed-off-by: Bill O'Donnell <billodo@redhat.com>
> ---
> fs/xfs/xfs_stats.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/fs/xfs/xfs_stats.c b/fs/xfs/xfs_stats.c
> index 6008e25..734b867 100644
> --- a/fs/xfs/xfs_stats.c
> +++ b/fs/xfs/xfs_stats.c
> @@ -244,9 +244,12 @@ xfs_init_procfs(void)
> if (!proc_mkdir("fs/xfs", NULL))
> goto out;
>
> - if (!proc_create("fs/xfs/stat", 0, NULL,
> - &xfs_stat_proc_fops))
> + if (!proc_symlink("fs/xfs/stat", NULL,
> + "/sys/fs/xfs/stats/stats"))
> + {
> goto out_remove_xfs_dir;
> + }
Ok, without the printk, now there's no need for the braces :)
Also, as an aside, the kernel/xfs style is:
if (foo) {
...
}
not:
if (foo)
{
...
}
just FYI...
Thanks,
-Eric
> +
> #ifdef CONFIG_XFS_QUOTA
> if (!proc_create("fs/xfs/xqmstat", 0, NULL,
> &xqmstat_proc_fops))
>
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 2/3] xfs: create symlink proc/fs/xfs/stat to sys/fs/xfs/stats
@ 2015-09-04 20:42 Bill O'Donnell
2015-09-04 20:42 ` [PATCH 3/3] xfs: remove unused procfs code Bill O'Donnell
0 siblings, 1 reply; 12+ messages in thread
From: Bill O'Donnell @ 2015-09-04 20:42 UTC (permalink / raw)
To: xfs
As a part of the work to move xfs global stats from procfs to sysfs,
this patch creates the symlink from proc/fs/xfs/stat to sys/fs/xfs/stats.
Signed-off-by: Bill O'Donnell <billodo@redhat.com>
---
fs/xfs/xfs_stats.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/fs/xfs/xfs_stats.c b/fs/xfs/xfs_stats.c
index 6008e25..a9f05de 100644
--- a/fs/xfs/xfs_stats.c
+++ b/fs/xfs/xfs_stats.c
@@ -244,9 +244,10 @@ xfs_init_procfs(void)
if (!proc_mkdir("fs/xfs", NULL))
goto out;
- if (!proc_create("fs/xfs/stat", 0, NULL,
- &xfs_stat_proc_fops))
+ if (!proc_symlink("fs/xfs/stat", NULL,
+ "/sys/fs/xfs/stats/stats"))
goto out_remove_xfs_dir;
+
#ifdef CONFIG_XFS_QUOTA
if (!proc_create("fs/xfs/xqmstat", 0, NULL,
&xqmstat_proc_fops))
--
2.4.3
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 3/3] xfs: remove unused procfs code
2015-09-04 20:42 [PATCH 2/3] xfs: create symlink proc/fs/xfs/stat to sys/fs/xfs/stats Bill O'Donnell
@ 2015-09-04 20:42 ` Bill O'Donnell
0 siblings, 0 replies; 12+ messages in thread
From: Bill O'Donnell @ 2015-09-04 20:42 UTC (permalink / raw)
To: xfs
As a part of the work to move xfs global stats from procfs to sysfs,
this patch removes the now unused procfs code that was xfs stat specific.
Signed-off-by: Bill O'Donnell <billodo@redhat.com>
---
fs/xfs/xfs_stats.c | 74 ------------------------------------------------------
1 file changed, 74 deletions(-)
diff --git a/fs/xfs/xfs_stats.c b/fs/xfs/xfs_stats.c
index a9f05de..05d5227 100644
--- a/fs/xfs/xfs_stats.c
+++ b/fs/xfs/xfs_stats.c
@@ -112,80 +112,6 @@ void xfs_stats_clearall(void)
}
}
-static int xfs_stat_proc_show(struct seq_file *m, void *v)
-{
- int i, j;
- __uint64_t xs_xstrat_bytes = 0;
- __uint64_t xs_write_bytes = 0;
- __uint64_t xs_read_bytes = 0;
-
- static const struct xstats_entry {
- char *desc;
- int endpoint;
- } xstats[] = {
- { "extent_alloc", XFSSTAT_END_EXTENT_ALLOC },
- { "abt", XFSSTAT_END_ALLOC_BTREE },
- { "blk_map", XFSSTAT_END_BLOCK_MAPPING },
- { "bmbt", XFSSTAT_END_BLOCK_MAP_BTREE },
- { "dir", XFSSTAT_END_DIRECTORY_OPS },
- { "trans", XFSSTAT_END_TRANSACTIONS },
- { "ig", XFSSTAT_END_INODE_OPS },
- { "log", XFSSTAT_END_LOG_OPS },
- { "push_ail", XFSSTAT_END_TAIL_PUSHING },
- { "xstrat", XFSSTAT_END_WRITE_CONVERT },
- { "rw", XFSSTAT_END_READ_WRITE_OPS },
- { "attr", XFSSTAT_END_ATTRIBUTE_OPS },
- { "icluster", XFSSTAT_END_INODE_CLUSTER },
- { "vnodes", XFSSTAT_END_VNODE_OPS },
- { "buf", XFSSTAT_END_BUF },
- { "abtb2", XFSSTAT_END_ABTB_V2 },
- { "abtc2", XFSSTAT_END_ABTC_V2 },
- { "bmbt2", XFSSTAT_END_BMBT_V2 },
- { "ibt2", XFSSTAT_END_IBT_V2 },
- { "fibt2", XFSSTAT_END_FIBT_V2 },
- /* we print both series of quota information together */
- { "qm", XFSSTAT_END_QM },
- };
-
- /* Loop over all stats groups */
- for (i = j = 0; i < ARRAY_SIZE(xstats); i++) {
- seq_printf(m, "%s", xstats[i].desc);
- /* inner loop does each group */
- for (; j < xstats[i].endpoint; j++)
- seq_printf(m, " %u", counter_val(j));
- seq_putc(m, '\n');
- }
- /* extra precision counters */
- for_each_possible_cpu(i) {
- xs_xstrat_bytes += per_cpu(xfsstats, i).xs_xstrat_bytes;
- xs_write_bytes += per_cpu(xfsstats, i).xs_write_bytes;
- xs_read_bytes += per_cpu(xfsstats, i).xs_read_bytes;
- }
-
- seq_printf(m, "xpc %Lu %Lu %Lu\n",
- xs_xstrat_bytes, xs_write_bytes, xs_read_bytes);
- seq_printf(m, "debug %u\n",
-#if defined(DEBUG)
- 1);
-#else
- 0);
-#endif
- return 0;
-}
-
-static int xfs_stat_proc_open(struct inode *inode, struct file *file)
-{
- return single_open(file, xfs_stat_proc_show, NULL);
-}
-
-static const struct file_operations xfs_stat_proc_fops = {
- .owner = THIS_MODULE,
- .open = xfs_stat_proc_open,
- .read = seq_read,
- .llseek = seq_lseek,
- .release = single_release,
-};
-
/* legacy quota interfaces */
#ifdef CONFIG_XFS_QUOTA
static int xqm_proc_show(struct seq_file *m, void *v)
--
2.4.3
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 2/3] xfs: create symlink proc/fs/xfs/stat to sys/fs/xfs/stats
2015-09-04 20:54 [PATCH 0/3 V3] xfs: new global stats in sysfs Bill O'Donnell
@ 2015-09-04 20:54 ` Bill O'Donnell
0 siblings, 0 replies; 12+ messages in thread
From: Bill O'Donnell @ 2015-09-04 20:54 UTC (permalink / raw)
To: xfs
As a part of the work to move xfs global stats from procfs to sysfs,
this patch creates the symlink from proc/fs/xfs/stat to sys/fs/xfs/stats.
Signed-off-by: Bill O'Donnell <billodo@redhat.com>
---
fs/xfs/xfs_stats.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/fs/xfs/xfs_stats.c b/fs/xfs/xfs_stats.c
index 6008e25..a9f05de 100644
--- a/fs/xfs/xfs_stats.c
+++ b/fs/xfs/xfs_stats.c
@@ -244,9 +244,10 @@ xfs_init_procfs(void)
if (!proc_mkdir("fs/xfs", NULL))
goto out;
- if (!proc_create("fs/xfs/stat", 0, NULL,
- &xfs_stat_proc_fops))
+ if (!proc_symlink("fs/xfs/stat", NULL,
+ "/sys/fs/xfs/stats/stats"))
goto out_remove_xfs_dir;
+
#ifdef CONFIG_XFS_QUOTA
if (!proc_create("fs/xfs/xqmstat", 0, NULL,
&xqmstat_proc_fops))
--
2.4.3
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 12+ messages in thread
end of thread, other threads:[~2015-09-04 20:54 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-04 20:42 [PATCH 2/3] xfs: create symlink proc/fs/xfs/stat to sys/fs/xfs/stats Bill O'Donnell
2015-09-04 20:42 ` [PATCH 3/3] xfs: remove unused procfs code Bill O'Donnell
-- strict thread matches above, loose matches on Subject: below --
2015-09-04 20:54 [PATCH 0/3 V3] xfs: new global stats in sysfs Bill O'Donnell
2015-09-04 20:54 ` [PATCH 2/3] xfs: create symlink proc/fs/xfs/stat to sys/fs/xfs/stats Bill O'Donnell
2015-09-04 12:55 [PATCH 0/3 V2] xfs: new global stats in sysfs Bill O'Donnell
2015-09-04 12:55 ` [PATCH 2/3] xfs: create symlink proc/fs/xfs/stat to sys/fs/xfs/stats Bill O'Donnell
2015-09-04 18:32 ` Eric Sandeen
2015-09-03 16:36 [PATCH 0/3] xfs: new global stats in sysfs billodo
2015-09-03 16:36 ` [PATCH 2/3] xfs: create symlink proc/fs/xfs/stat to sys/fs/xfs/stats billodo
2015-09-03 17:57 ` Darrick J. Wong
2015-09-03 18:32 ` Eric Sandeen
2015-09-03 18:39 ` Bill O'Donnell
2015-09-03 19:15 ` Bill O'Donnell
2015-09-03 19:17 ` Darrick J. Wong
2015-09-03 20:08 ` Eric Sandeen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox