mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chris Wright <chrisw@osdl.org>
To: viro@parcelfarce.linux.theplanet.co.uk
Cc: Chris Wright <chrisw@osdl.org>, 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 13:41:37 -0700	[thread overview]
Message-ID: <20040814134137.Y1924@build.pdx.osdl.net> (raw)
In-Reply-To: <20040814202343.GA12308@parcelfarce.linux.theplanet.co.uk>; from viro@parcelfarce.linux.theplanet.co.uk on Sat, Aug 14, 2004 at 09:23:43PM +0100

* viro@parcelfarce.linux.theplanet.co.uk (viro@parcelfarce.linux.theplanet.co.uk) wrote:
> 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*.

Thanks for peeking at it.

> First of all, it ties you to ->i_ino values.  Which is OK on a specific
> fs, but not in a generic helper functions.

Good point.

> 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.

Yes, I took too simplistic a view on moving the common code over to
generic.

> 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...

Agreed.  Thanks for the feedback.
-chris

      reply	other threads:[~2004-08-14 20:41 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
2004-08-14 20:41       ` Chris Wright [this message]

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=20040814134137.Y1924@build.pdx.osdl.net \
    --to=chrisw@osdl.org \
    --cc=akpm@osdl.org \
    --cc=jmorris@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=neilb@cse.unsw.edu.au \
    --cc=sds@epoch.ncsc.mil \
    --cc=viro@parcelfarce.linux.theplanet.co.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®