From: Mark Williamson <mark.williamson@cl.cam.ac.uk>
To: Josef Sipek <jsipek@fsl.cs.sunysb.edu>
Cc: Trond Myklebust <trond.myklebust@fys.uio.no>,
linux-kernel@vger.kernel.org,
Pekka Enberg <penberg@cs.helsinki.fi>,
Michael Halcrow <mhalcrow@us.ibm.com>,
Erez Zadok <ezk@cs.sunysb.edu>,
Christoph Hellwig <hch@infradead.org>,
Al Viro <viro@ftp.linux.org.uk>, Andrew Morton <akpm@osdl.org>,
linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 2/3] fsstack: Generic get/set lower object functions
Date: Fri, 3 Nov 2006 03:45:50 +0000 [thread overview]
Message-ID: <200611030345.51167.mark.williamson@cl.cam.ac.uk> (raw)
In-Reply-To: <20061103032702.GB13499@filer.fsl.cs.sunysb.edu>
> > Why are you defining all these structs that are just wrapping unions?
>
> The reason for the union is simple...
I think the query was more about why you'd need a struct which contains only
an anonymous union - why not just have a named union? Or do you anticipate
adding extra fields to the struct later?
I guess that having a union foo * rather than a struct foo * would be a bit
unconventional in the kernel. The named struct / anonymous union combo does
hide the union as merely an implementation detail, which is nice. Was this
your motivation?
Cheers,
Mark
> 1) if you have a linear stackable filesystem (e.g., ecryptfs), your objects
> need to point to only one lower object (sb -> lower sb, etc.)
>
> 2) if you have a fanout stackable filesystem (e.g., unionfs), your objects
> need to point to n lower objects
>
> Since we don't want to hurt linear stacks by declaring arrays of pointers,
> I think the best way is to have the lower pointer (e.g., *sb) in a union
> with the lower double pointer (e.g., **sbs) - this works simply because
> linear stacks will always
>
> > > +/* get the fs dependent data */
> > > +static inline void * fsstack_inode_data(struct inode *inode)
> > > +{
> > > + return &((struct __fsstack_inode_generic_info*) inode)->info;
> >
> > Please make this wrap container_of() instead of rolling your own.
>
> Will do.
>
> > Also note that the naming convention for such a wrapper in almost all
> > other filesystems would be FSSTACK_I()
>
> Very true, I'll change it to match.
>
> I suppose the function to get the dentry private data should be called
> FSSTACK_D() and for the superblock FSSTACK_SB() ?
>
> > > +static inline struct inode *
> > > +__fsstack_lower_inode(struct inode *inode, unsigned long branch_idx)
> > > +{
> > > + struct fsstack_inode_info *info = fsstack_inode_data(inode);
> > > +
> > > + return info->inodes[branch_idx];
> > > +}
> >
> > What is the value of "functions" like the above? They appear just to
> > obfuscate the code. Unless your aim is to hide the internals of the
> > struct __fsstack_inode_generic_info (sort of futile, since you are
> > asking users to include that structure in their private inode structs
>
> Another idea is to move the fsstack_foo_info structure elsewhere...
>
> For stackable filesystems it makes sense to have the pointers right in the
> inode, but we don't want to penalize the rest if the filesystems. One
> solution would be to have a special stackable_inode which contains the
> lower inode pointers. This would still hide the details from the user...
>
> > )
> > then it is much more obvious to see what is going on when you write
> >
> > inode = FSSTACK_I(inode)->inodes[branch];
> >
> > rather than
> >
> > inode = __fsstack_lower_inode(inode, branch);
>
> Point taken. You need to know what's going to anyway, so we might as well
> make it painfully obvious.
>
> Josef "Jeff" Sipek.
--
Dave: Just a question. What use is a unicyle with no seat? And no pedals!
Mark: To answer a question with a question: What use is a skateboard?
Dave: Skateboards have wheels.
Mark: My wheel has a wheel!
next prev parent reply other threads:[~2006-11-03 3:45 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-02 3:59 [PATCH 0/3] fsstack updates Josef Jeff Sipek
2006-11-02 3:59 ` [PATCH 1/3] fsstack: Make fsstack_copy_attr_all copy inode size Josef Jeff Sipek
2006-11-02 3:59 ` [PATCH 2/3] fsstack: Generic get/set lower object functions Josef Jeff Sipek
2006-11-02 16:06 ` Trond Myklebust
2006-11-03 3:27 ` Josef Sipek
2006-11-03 3:45 ` Mark Williamson [this message]
2006-11-03 3:51 ` Josef Sipek
2006-11-03 6:25 ` Trond Myklebust
2006-11-03 9:13 ` Pekka Enberg
2006-11-03 16:36 ` Jan Engelhardt
2006-11-03 20:47 ` Josef Sipek
2006-11-03 21:22 ` Trond Myklebust
2006-11-02 3:59 ` [PATCH 3/3] fsstack: Make ecryptfs a user of new fsstack_* functions Josef Jeff Sipek
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=200611030345.51167.mark.williamson@cl.cam.ac.uk \
--to=mark.williamson@cl.cam.ac.uk \
--cc=akpm@osdl.org \
--cc=ezk@cs.sunysb.edu \
--cc=hch@infradead.org \
--cc=jsipek@fsl.cs.sunysb.edu \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mhalcrow@us.ibm.com \
--cc=penberg@cs.helsinki.fi \
--cc=trond.myklebust@fys.uio.no \
--cc=viro@ftp.linux.org.uk \
/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
all inboxes | Powered by JetHome®