Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=c97bfe4351771675963e02f34d31e206fd2d7150
Commit:     c97bfe4351771675963e02f34d31e206fd2d7150
Parent:     bcd405599faa16cf32a3d3f1ce6a1e12cb37fede
Author:     Wendy Cheng <[EMAIL PROTECTED]>
AuthorDate: Thu Nov 29 17:56:51 2007 -0500
Committer:  Steven Whitehouse <[EMAIL PROTECTED]>
CommitDate: Fri Jan 25 08:08:15 2008 +0000

    [GFS2] Remove lock methods for lock_nolock protocol
    
    GFS2 supports two modes of locking - lock_nolock for single node filesystem
    and lock_dlm for cluster mode locking. The gfs2 lock methods are removed 
from
    file operation table for lock_nolock protocol. This would allow VFS to 
handle
    posix lock and flock logics just like other in-tree filesystems without
    duplication.
    
    Signed-off-by: S. Wendy Cheng <[EMAIL PROTECTED]>
    Signed-off-by: Steven Whitehouse <[EMAIL PROTECTED]>
---
 fs/gfs2/inode.c     |   11 +++++++++--
 fs/gfs2/ops_file.c  |   36 ++++++++++++++++++++++++------------
 fs/gfs2/ops_inode.h |    2 ++
 3 files changed, 35 insertions(+), 14 deletions(-)

diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index 92959d0..53bca99 100644
--- a/fs/gfs2/inode.c
+++ b/fs/gfs2/inode.c
@@ -131,14 +131,21 @@ static struct inode *gfs2_iget_skip(struct super_block 
*sb,
 
 void gfs2_set_iop(struct inode *inode)
 {
+       struct gfs2_sbd *sdp = GFS2_SB(inode);
        umode_t mode = inode->i_mode;
 
        if (S_ISREG(mode)) {
                inode->i_op = &gfs2_file_iops;
-               inode->i_fop = &gfs2_file_fops;
+               if (sdp->sd_args.ar_localflocks)
+                       inode->i_fop = &gfs2_file_fops_nolock;
+               else
+                       inode->i_fop = &gfs2_file_fops;
        } else if (S_ISDIR(mode)) {
                inode->i_op = &gfs2_dir_iops;
-               inode->i_fop = &gfs2_dir_fops;
+               if (sdp->sd_args.ar_localflocks)
+                       inode->i_fop = &gfs2_dir_fops_nolock;
+               else
+                       inode->i_fop = &gfs2_dir_fops;
        } else if (S_ISLNK(mode)) {
                inode->i_op = &gfs2_symlink_iops;
        } else {
diff --git a/fs/gfs2/ops_file.c b/fs/gfs2/ops_file.c
index ad5daaa..db76ac1 100644
--- a/fs/gfs2/ops_file.c
+++ b/fs/gfs2/ops_file.c
@@ -615,15 +615,6 @@ static int gfs2_lock(struct file *file, int cmd, struct 
file_lock *fl)
        if (__mandatory_lock(&ip->i_inode))
                return -ENOLCK;
 
-       if (sdp->sd_args.ar_localflocks) {
-               if (IS_GETLK(cmd)) {
-                       posix_test_lock(file, fl);
-                       return 0;
-               } else {
-                       return posix_lock_file_wait(file, fl);
-               }
-       }
-
        if (cmd == F_CANCELLK) {
                /* Hack: */
                cmd = F_SETLK;
@@ -716,9 +707,6 @@ static int gfs2_flock(struct file *file, int cmd, struct 
file_lock *fl)
        if (__mandatory_lock(&ip->i_inode))
                return -ENOLCK;
 
-       if (sdp->sd_args.ar_localflocks)
-               return flock_lock_file_wait(file, fl);
-
        if (fl->fl_type == F_UNLCK) {
                do_unflock(file, fl);
                return 0;
@@ -755,3 +743,27 @@ const struct file_operations gfs2_dir_fops = {
        .flock          = gfs2_flock,
 };
 
+const struct file_operations gfs2_file_fops_nolock = {
+       .llseek         = gfs2_llseek,
+       .read           = do_sync_read,
+       .aio_read       = generic_file_aio_read,
+       .write          = do_sync_write,
+       .aio_write      = generic_file_aio_write,
+       .unlocked_ioctl = gfs2_ioctl,
+       .mmap           = gfs2_mmap,
+       .open           = gfs2_open,
+       .release        = gfs2_close,
+       .fsync          = gfs2_fsync,
+       .splice_read    = generic_file_splice_read,
+       .splice_write   = generic_file_splice_write,
+       .setlease       = gfs2_setlease,
+};
+
+const struct file_operations gfs2_dir_fops_nolock = {
+       .readdir        = gfs2_readdir,
+       .unlocked_ioctl = gfs2_ioctl,
+       .open           = gfs2_open,
+       .release        = gfs2_close,
+       .fsync          = gfs2_fsync,
+};
+
diff --git a/fs/gfs2/ops_inode.h b/fs/gfs2/ops_inode.h
index edb519c..fd8cee2 100644
--- a/fs/gfs2/ops_inode.h
+++ b/fs/gfs2/ops_inode.h
@@ -18,6 +18,8 @@ extern const struct inode_operations gfs2_symlink_iops;
 extern const struct inode_operations gfs2_dev_iops;
 extern const struct file_operations gfs2_file_fops;
 extern const struct file_operations gfs2_dir_fops;
+extern const struct file_operations gfs2_file_fops_nolock;
+extern const struct file_operations gfs2_dir_fops_nolock;
 
 extern void gfs2_set_inode_flags(struct inode *inode);
 
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to