All of lore.kernel.org
 help / color / mirror / Atom feed
From: fabbione@sourceware.org <fabbione@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] cluster/gfs-kernel/src/gfs eaops.c inode.c ops ...
Date: 30 Jan 2008 06:37:54 -0000	[thread overview]
Message-ID: <20080130063754.28396.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/cluster
Module name:	cluster
Changes by:	fabbione at sourceware.org	2008-01-30 06:37:53

Modified files:
	gfs-kernel/src/gfs: eaops.c inode.c ops_file.c ops_file.h 

Log message:
	Red Hat bugzilla 244343:
	
	GFS supports two modes of locking - lock_nolock for single node filesystem
	and lock_dlm for cluster mode locking. The gfs 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.
	
	Port forward patch from RHEL5 branch to HEAD.
	
	Original author: Wendy Cheng <wcheng@redhat.com>

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/eaops.c.diff?cvsroot=cluster&r1=1.7&r2=1.8
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/inode.c.diff?cvsroot=cluster&r1=1.26&r2=1.27
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/ops_file.c.diff?cvsroot=cluster&r1=1.38&r2=1.39
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/ops_file.h.diff?cvsroot=cluster&r1=1.2&r2=1.3

--- cluster/gfs-kernel/src/gfs/eaops.c	2007/12/04 19:30:27	1.7
+++ cluster/gfs-kernel/src/gfs/eaops.c	2008/01/30 06:37:53	1.8
@@ -268,4 +268,3 @@
 	&gfs_security_eaops,
 };
 
-
--- cluster/gfs-kernel/src/gfs/inode.c	2006/10/05 16:04:38	1.26
+++ cluster/gfs-kernel/src/gfs/inode.c	2008/01/30 06:37:53	1.27
@@ -170,6 +170,7 @@
 struct inode *
 gfs_iget(struct gfs_inode *ip, int create)
 {
+	struct gfs_sbd *sdp = ip->i_sbd;
 	struct inode *inode = NULL, *tmp;
 
 	spin_lock(&ip->i_spin);
@@ -189,13 +190,19 @@
 	/* Attach GFS-specific ops vectors */
 	if (ip->i_di.di_type == GFS_FILE_REG) {
 		tmp->i_op = &gfs_file_iops;
-		tmp->i_fop = &gfs_file_fops;
 		memcpy(&ip->gfs_file_aops, &gfs_file_aops,
 			   sizeof(struct address_space_operations));
 		tmp->i_mapping->a_ops = &ip->gfs_file_aops;
+		if (sdp->sd_args.ar_localflocks)
+			tmp->i_fop = &gfs_file_fops_nolock;
+		else
+			tmp->i_fop = &gfs_file_fops;
 	} else if (ip->i_di.di_type == GFS_FILE_DIR) {
 		tmp->i_op = &gfs_dir_iops;
-		tmp->i_fop = &gfs_dir_fops;
+		if (sdp->sd_args.ar_localflocks)
+			tmp->i_fop = &gfs_dir_fops_nolock;
+		else
+			tmp->i_fop = &gfs_dir_fops;
 	} else if (ip->i_di.di_type == GFS_FILE_LNK) {
 		tmp->i_op = &gfs_symlink_iops;
 	} else {
--- cluster/gfs-kernel/src/gfs/ops_file.c	2008/01/28 06:36:18	1.38
+++ cluster/gfs-kernel/src/gfs/ops_file.c	2008/01/30 06:37:53	1.39
@@ -1616,15 +1616,6 @@
         if ((ip->i_di.di_mode & (S_ISGID | S_IXGRP)) == S_ISGID)
                 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 (IS_GETLK(cmd))
                 return gfs_lm_plock_get(sdp, &name, file, fl);
         else if (fl->fl_type == F_UNLCK)
@@ -1766,7 +1757,6 @@
 gfs_flock(struct file *file, int cmd, struct file_lock *fl)
 {
         struct gfs_inode *ip = get_v2ip(file->f_mapping->host);
-        struct gfs_sbd *sdp = ip->i_sbd;
 
         atomic_inc(&ip->i_sbd->sd_ops_file);
 
@@ -1775,9 +1765,6 @@
         if ((ip->i_di.di_mode & (S_ISGID | S_IXGRP)) == S_ISGID)
                 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;
@@ -1816,3 +1803,31 @@
         .lock = gfs_lock,
         .flock = gfs_flock,
 };
+
+struct file_operations gfs_file_fops_nolock = {
+	.llseek = gfs_llseek,
+	.read = gfs_read,
+	.write = gfs_write,
+	.aio_read = gfs_aio_read,
+	.aio_write = gfs_aio_write,
+	.ioctl = gfs_ioctl,
+#ifdef CONFIG_COMPAT
+	.compat_ioctl = gfs_compat_ioctl,
+#endif
+	.mmap = gfs_mmap,
+	.open = gfs_open,
+	.release = gfs_close,
+	.fsync = gfs_fsync,
+	.splice_read = gfs_splice_read,
+};
+
+struct file_operations gfs_dir_fops_nolock = {
+	.readdir = gfs_readdir,
+	.ioctl = gfs_ioctl,
+#ifdef CONFIG_COMPAT
+	.compat_ioctl = gfs_compat_ioctl,
+#endif
+	.open = gfs_open,
+	.release = gfs_close,
+	.fsync = gfs_fsync,
+};
--- cluster/gfs-kernel/src/gfs/ops_file.h	2006/07/10 23:22:34	1.2
+++ cluster/gfs-kernel/src/gfs/ops_file.h	2008/01/30 06:37:53	1.3
@@ -16,5 +16,7 @@
 
 extern struct file_operations gfs_file_fops;
 extern struct file_operations gfs_dir_fops;
+extern struct file_operations gfs_file_fops_nolock;
+extern struct file_operations gfs_dir_fops_nolock;
 
 #endif /* __OPS_FILE_DOT_H__ */



                 reply	other threads:[~2008-01-30  6:37 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20080130063754.28396.qmail@sourceware.org \
    --to=fabbione@sourceware.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.