xfs
[Top] [All Lists]

Re: [PATCH 2/3] xfs: create symlink proc/fs/xfs/stat to sys/fs/xfs/stats

To: Eric Sandeen <sandeen@xxxxxxxxxxx>
Subject: Re: [PATCH 2/3] xfs: create symlink proc/fs/xfs/stat to sys/fs/xfs/stats
From: "Bill O'Donnell" <billodo@xxxxxxxxxx>
Date: Thu, 3 Sep 2015 13:39:53 -0500
Cc: "Darrick J. Wong" <darrick.wong@xxxxxxxxxx>, xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <55E89239.60305@xxxxxxxxxxx>
References: <1441298187-29064-1-git-send-email-billodo@xxxxxxxxxx> <1441298187-29064-3-git-send-email-billodo@xxxxxxxxxx> <20150903175757.GB10397@xxxxxxxxxxxxxxxx> <55E89239.60305@xxxxxxxxxxx>
User-agent: Mutt/1.5.23 (2014-03-12)
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@xxxxxxxxxx>
> >> ---
> >>  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
> 

<Prev in Thread] Current Thread [Next in Thread>