linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Robert S Peterson <rpeterso@redhat.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: Anton Altaparmakov <aia21@cam.ac.uk>,
	Andrew Morton <akpm@osdl.org>,
	fs-devel mailing list <linux-fsdevel@vger.kernel.org>
Subject: Re: [PATCH] loop.c to use write ops for fs requiring special locking
Date: Tue, 28 Mar 2006 09:59:17 -0600	[thread overview]
Message-ID: <1143561557.10856.92.camel@technetium.msp.redhat.com> (raw)
In-Reply-To: <20060328144018.GA17080@infradead.org>

On Tue, 2006-03-28 at 15:40 +0100, Christoph Hellwig wrote:
> NACK.  Adding random flags just makes the kernel unmaintainble.  The

Wrong on two accounts:  (1) This is NOT a random flag and (2) Adding
flags in fact can increase the maintainability of the kernel.  
With this new flag, other kernel drivers may now be written that
better understand the special needs of the underlying filesystem
and act accordingly.  Would you rather have modules like loop.c
special-case each underlying fs?  That's just plain ugly.  As in:

if underlying == ext2 { do this }
else if underlying == vfat { do that }
else if underlying == reiserfs { do the other }
etc.

> right thing is to define a proper highlevel interface that can be
> implemented properly on all filesystems plus a library helper for
> normal pagecache-based filesystems using the aops.  There's already
> various in-kernel filesystems that would require additional locking
> or that aren't pagecache-based at all, please fix them up as part
> of the patch(-series).

This is way out of the scope of the problem.  The problem is that
loop.c circumvents proper locking by going directly to prepare_write
rather than following the normal process.  If I added some kind of
library callbacks to allow cluster locking, it would break the
normal locking sequence of an ordinary write.

The normal sequence of an ordinary write typically looks like:

1. write
2.   (Take care of cluster locking if necessary)
3.   generic_file_write_nolock
4.      generic_file_aio_write_nolock
5.         generic_file_buffered_write
6.            a_ops->prepare_write
etc.

Right now, loop.c is circumventing step 2 (optional cluster locking
if needed by the underlying fs) by bypassing the "write" op.  If I 
added callbacks to prepare_write at (7) as you suggest, it would either
(a) introduce deadlocks conflicting with step 2 above or
(b) require the underlying fs to use its own versions of 3,4,5, and 6,
thus bypassing a great deal of vfs, which is not good for anyone.

Some could argue that loop.c should always use write rather than
prepare_write/commit_write, but most fs's don't have special
locking needs and therefore using them is a performance boost.
So why punish all fs's because of special locking needs require by
a few when we can simply communicate this need with a constant?

Bob Peterson
Red Hat Cluster Suite



  reply	other threads:[~2006-03-28 15:56 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-27 21:52 [PATCH] loop.c to use write ops for fs requiring special locking Robert S Peterson
2006-03-28  0:44 ` Andrew Morton
2006-03-28 15:33   ` Robert S Peterson
2006-03-28 19:27     ` Andrew Morton
2006-03-28 14:40 ` Christoph Hellwig
2006-03-28 15:59   ` Robert S Peterson [this message]
2006-03-29  9:05     ` Christoph Hellwig
2006-03-30  0:10       ` Robert S Peterson
2006-03-30 14:15         ` Christoph Hellwig
  -- strict thread matches above, loose matches on Subject: below --
2006-03-01 16:48 [patch] " Robert S Peterson
2006-03-01 22:09 ` Andrew Morton
2006-03-02 10:16   ` Anton Altaparmakov
2006-03-10 23:04     ` Robert S Peterson
2006-03-10 23:13       ` Andrew Morton
2006-03-11  0:36         ` Anton Altaparmakov

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=1143561557.10856.92.camel@technetium.msp.redhat.com \
    --to=rpeterso@redhat.com \
    --cc=aia21@cam.ac.uk \
    --cc=akpm@osdl.org \
    --cc=hch@infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).