[PATCH 4/6] xfs: add xlog sysfs kobject and attribute handlers
Brian Foster
bfoster at redhat.com
Thu Jun 26 08:41:21 CDT 2014
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 at redhat.com>
> > > ---
> > > 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 at fromorbit.com
>
> _______________________________________________
> xfs mailing list
> xfs at oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs
More information about the xfs
mailing list