linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Robert S Peterson <rpeterso@redhat.com>
To: Anton Altaparmakov <aia21@cam.ac.uk>
Cc: Andrew Morton <akpm@osdl.org>, linux-fsdevel@vger.kernel.org
Subject: [patch 2.6.16] loop.c to use write ops for fs requiring special locking [try #2]
Date: Fri, 24 Mar 2006 11:07:31 -0600	[thread overview]
Message-ID: <1143220052.12806.27.camel@technetium.msp.redhat.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0603110025510.24189@hermes-2.csi.cam.ac.uk>

On Sat, 2006-03-11 at 00:36 +0000, Anton Altaparmakov wrote:
> On Fri, 10 Mar 2006, Andrew Morton wrote:
> > When we've remembered what Al's statement meant in
> > http://marc.theaimsgroup.com/?t=102129995600002&r=1&w=2
> This is no longer relevant because my patch which is in current 2.6 
> kernels (can't remember when I wrote it/when it got put into 2.6) did the 
> conversion from prepare_write/commit_write to file ->write correctly so 
> the data transformation still happens so that crypto still works with the 
> loop driver.
> 
> To get back to Robert's patch that he is requesting to be included.  I 
> think it is fine but the flag name could perhaps be better.  Perhaps 
> "FS_AOPS_PRIVATE" or "FS_AOPS_SPECIAL" or "FS_AOPS_NEED_LOCKING" or 
> even "FS_AOPS_REQUIRE_LOCKING" or something.  "FS_REQUIRES_LOCKING" just 
> does not mean much and certainly would not suggest to me that no-one 
> outside the file system should use the address space operations of the 
> file system...  But maybe I am just bein picky.  (-:

Here is a resubmission of my patch to loop.c, this time against the
2.6.16 kernel.

Andrew: Sounds like Anton answered your concerns.
Anton:  As per your suggestion, I changed the constant to your suggested
FS_AOPS_NEED_LOCKING.

Regards,

Bob Peterson
rpeterso@redhat.com

diff -pur linux-2.6.16/drivers/block/loop.c linux-2.6.16.patched/drivers/block/loop.c
--- linux-2.6.16/drivers/block/loop.c   2006-03-19 23:53:29.000000000 -0600
+++ linux-2.6.16.patched/drivers/block/loop.c   2006-03-24 10:49:10.000000000 -0600
@@ -44,6 +44,11 @@
  * backing filesystem.
  * Anton Altaparmakov, 16 Feb 2005
  *
+ * Extension of Anton's idea: Use normal write file operations rather than
+ * prepare_write and commit_write when the backing filesystem requires
+ * special locking.
+ * Robert Peterson <rpeterso@redhat.com>, 01 Mar 2006
+ *
  * Still To Fix:
  * - Advisory locking is ignored here.
  * - Should use an own CAP_* category instead of CAP_SYS_ADMIN
@@ -74,6 +79,7 @@
 #include <linux/completion.h>
 #include <linux/highmem.h>
 #include <linux/gfp.h>
+#include <linux/mount.h>

 #include <asm/uaccess.h>

@@ -791,7 +797,8 @@ static int loop_set_fd(struct loop_devic
                 */
                if (!file->f_op->sendfile)
                        goto out_putf;
-               if (aops->prepare_write && aops->commit_write)
+               if (!(file->f_vfsmnt->mnt_sb->s_type->fs_flags & FS_AOPS_NEED_LOCKING) &&
+                       aops->prepare_write && aops->commit_write)
                        lo_flags |= LO_FLAGS_USE_AOPS;
                if (!(lo_flags & LO_FLAGS_USE_AOPS) && !file->f_op->write)
                        lo_flags |= LO_FLAGS_READ_ONLY;
diff -pur linux-2.6.16/include/linux/fs.h linux-2.6.16.patched/include/linux/fs.h
--- linux-2.6.16/include/linux/fs.h     2006-03-19 23:53:29.000000000 -0600
+++ linux-2.6.16.patched/include/linux/fs.h     2006-03-24 10:27:20.000000000 -0600
@@ -83,6 +83,7 @@ extern int dir_notify_enable;
 /* public flags for file_system_type */
 #define FS_REQUIRES_DEV 1
 #define FS_BINARY_MOUNTDATA 2
+#define FS_AOPS_NEED_LOCKING 4 /* Filesystem aops have special locking needs */
 #define FS_REVAL_DOT   16384   /* Check the paths ".", ".." for staleness */
 #define FS_ODD_RENAME  32768   /* Temporary stuff; will go away as soon
                                  * as nfs_rename() will be cleaned up



  reply	other threads:[~2006-03-24 17:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-01 16:48 [patch] loop.c to use write ops for fs requiring special locking 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
2006-03-24 17:07           ` Robert S Peterson [this message]
2006-03-24 19:46             ` [patch 2.6.16] loop.c to use write ops for fs requiring special locking [try #2] 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=1143220052.12806.27.camel@technetium.msp.redhat.com \
    --to=rpeterso@redhat.com \
    --cc=aia21@cam.ac.uk \
    --cc=akpm@osdl.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).