xfs
[Top] [All Lists]

Re: [PATCH 4/6] xfs: add xlog sysfs kobject and attribute handlers

To: Dave Chinner <david@xxxxxxxxxxxxx>
Subject: Re: [PATCH 4/6] xfs: add xlog sysfs kobject and attribute handlers
From: Brian Foster <bfoster@xxxxxxxxxx>
Date: Thu, 26 Jun 2014 09:41:21 -0400
Cc: xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <20140626122854.GA37470@xxxxxxxxxxxxxxx>
References: <1402060414-22075-1-git-send-email-bfoster@xxxxxxxxxx> <1402060414-22075-5-git-send-email-bfoster@xxxxxxxxxx> <20140626044719.GX4453@dastard> <20140626122854.GA37470@xxxxxxxxxxxxxxx>
User-agent: Mutt/1.5.23 (2014-03-12)
On Thu, Jun 26, 2014 at 08:28:55AM -0400, Brian Foster wrote:
> On Thu, Jun 26, 2014 at 02:47:19PM +1000, Dave Chinner wrote:
> > On Fri, Jun 06, 2014 at 09:13:32AM -0400, Brian Foster wrote:
> > > Embed a kobject into the xfs log data structure (xlog). This creates a
> > > 'log' subdirectory for every XFS mount instance in sysfs. The lifecycle
> > > of the log kobject is tied to the lifecycle of the log.
> > > 
> > > Also define a set of generic attribute handlers associated with the log
> > > kobject in preparation for the addition of attributes.
> > 
> > The code works fine, but....
> > > 
> > > Signed-off-by: Brian Foster <bfoster@xxxxxxxxxx>
> > > ---
> > >  fs/xfs/xfs_log.c      |  9 +++++++++
> > >  fs/xfs/xfs_log_priv.h |  3 +++
> > >  fs/xfs/xfs_sysfs.c    | 53 
> > > +++++++++++++++++++++++++++++++++++++++++++++++++++
> > >  fs/xfs/xfs_sysfs.h    |  1 +
> > >  4 files changed, 66 insertions(+)
> > > 
...
> > > diff --git a/fs/xfs/xfs_sysfs.c b/fs/xfs/xfs_sysfs.c
> > > index 41365fe..f837527 100644
> > > --- a/fs/xfs/xfs_sysfs.c
> > > +++ b/fs/xfs/xfs_sysfs.c
...
> > > +
> > > +STATIC void
> > > +xfs_log_release(struct kobject *kobj)
> > > +{
> > > + struct xlog *log = container_of(kobj, struct xlog, l_kobject);
> > > +
> > > + complete(&log->l_kobject_complete);
> > > +}
> > 
> > If the release funtion is common with other types, then the xfs_kobj
> > structure is perfect for this use - it will prevent a heap of
> > duplicated release functions...
> > 
> 
> It's going to look virtually the same for every kobject. Unfortunately,
> it needs to go from kobj->xfs_object->xfs_kobj, so each type requires a
> unique definition. We might be able to just turn it into a macro or
> something that takes the appropriate info and reduces the clutter. I'll
> play around with it. Thanks.
> 

Oops, never mind. I didn't grok what we'd get handed back here,
apparently. We get the kobject, contained by the new xfs_kobj and
already carrying the completion. There's no need to reference the
outermost structure so this can be made generic.

Brian

> Brian
> 
> > Cheers,
> > 
> > Dave.
> > -- 
> > Dave Chinner
> > david@xxxxxxxxxxxxx
> 
> _______________________________________________
> xfs mailing list
> xfs@xxxxxxxxxxx
> http://oss.sgi.com/mailman/listinfo/xfs

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