From: viro@parcelfarce.linux.theplanet.co.uk
To: Chris Wright <chrisw@osdl.org>
Cc: James Morris <jmorris@redhat.com>, Andrew Morton <akpm@osdl.org>,
Stephen Smalley <sds@epoch.ncsc.mil>,
neilb@cse.unsw.edu.au, linux-kernel@vger.kernel.org
Subject: Re: [PATCH][LIBFS] Move transaction file ops into libfs + cleanup (update)
Date: Sat, 14 Aug 2004 21:23:43 +0100 [thread overview]
Message-ID: <20040814202343.GA12308@parcelfarce.linux.theplanet.co.uk> (raw)
In-Reply-To: <20040814125501.U1973@build.pdx.osdl.net>
On Sat, Aug 14, 2004 at 12:55:01PM -0700, Chris Wright wrote:
> Looks nice. I didn't realize you were working on this consolidation too.
> I cooked up a similar patch. In this case the user loads its inode
> specific write_ops on open, then just uses the generic helpers. I also
> fully serialized all write/read transactions per inode. It's lightly
> tested. If there's anything you like in there, feel free to use it.
This is *wrong*.
First of all, it ties you to ->i_ino values. Which is OK on a specific
fs, but not in a generic helper functions.
What's more, there is no point in any extra structures here - you are
getting a file-specific method anyway, so you make it ->write() (which
is where behaviour differs) instead of ->open(). Which kills the
need of callbacks.
As a general rule, it's better to provide several helpers and let the
users of interface call them rather than trying to fit everything into
callbacks, flags, etc.
Consider for instance a driver that wants one such request/reply file.
With your scheme it will have to declare two functions - foo_write_op()
and foo_open(), the latter being a boilerplate _and_ declare (for fsck
knows what reason) a single-element array so that foo_open() could pass
array - file->f_dentry->d_inode->i_ino, only to compensate for use of
->i_ino in your helper.
Lots of glue for no good reason _and_ a new function type to deal with.
As opposed to one function (foo_write()) that is a normal instance of
->write() and is actually smaller than your foo_write_op() + foo_open().
No arrays, no magic, no boilerplate code...
next prev parent reply other threads:[~2004-08-14 20:24 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-08-13 16:05 [PATCH][LIBFS] Move transaction file ops into libfs James Morris
2004-08-14 16:44 ` [PATCH][LIBFS] Move transaction file ops into libfs + cleanup (update) James Morris
2004-08-14 18:20 ` Francois Romieu
2004-08-14 19:32 ` James Morris
2004-08-15 22:32 ` Andrew Morton
2004-08-15 23:44 ` James Morris
2004-08-16 0:11 ` James Morris
2004-08-14 19:55 ` Chris Wright
2004-08-14 20:23 ` viro [this message]
2004-08-14 20:41 ` Chris Wright
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=20040814202343.GA12308@parcelfarce.linux.theplanet.co.uk \
--to=viro@parcelfarce.linux.theplanet.co.uk \
--cc=akpm@osdl.org \
--cc=chrisw@osdl.org \
--cc=jmorris@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=neilb@cse.unsw.edu.au \
--cc=sds@epoch.ncsc.mil \
/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®