From mboxrd@z Thu Jan 1 00:00:00 1970 From: Robert S Peterson Subject: [PATCH] loop.c to use write ops for fs requiring special locking Date: Mon, 27 Mar 2006 15:52:02 -0600 Message-ID: <1143496322.10856.22.camel@technetium.msp.redhat.com> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Return-path: Received: from mx1.redhat.com ([66.187.233.31]:16848 "EHLO mx1.redhat.com") by vger.kernel.org with ESMTP id S1750750AbWC0VtQ (ORCPT ); Mon, 27 Mar 2006 16:49:16 -0500 To: Anton Altaparmakov , Andrew Morton , fs-devel mailing list Sender: linux-fsdevel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org Use normal write file operations rather than AOPS prepare_write and commit_write when the backing filesystem requires special locking. Signed-off-by: Robert Peterson --- drivers/block/loop.c | 9 ++++++++- include/linux/fs.h | 1 + 2 files changed, 9 insertions(+), 1 deletions(-) 121d2e76ae4b3f7ca3741e410664e138db5e1b13 diff --git a/drivers/block/loop.c b/drivers/block/loop.c index 9c3b94e..c762e76 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c @@ -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 , 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 #include #include +#include #include @@ -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 --git a/include/linux/fs.h b/include/linux/fs.h index 9d96749..3def72e 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -88,6 +88,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 -- 1.2.4