[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] cluster/gfs-kernel/src/gfs inode.c ops_file.c ...



CVSROOT:	/cvs/cluster
Module name:	cluster
Branch: 	RHEL5
Changes by:	wcheng sourceware org	2007-11-30 21:48:54

Modified files:
	gfs-kernel/src/gfs: 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.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/inode.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.26&r2=1.26.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/ops_file.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.28.2.2&r2=1.28.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/ops_file.h.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.2&r2=1.2.2.1

--- cluster/gfs-kernel/src/gfs/inode.c	2006/10/05 16:04:38	1.26
+++ cluster/gfs-kernel/src/gfs/inode.c	2007/11/30 21:48:54	1.26.2.1
@@ -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	2007/06/17 02:56:43	1.28.2.2
+++ cluster/gfs-kernel/src/gfs/ops_file.c	2007/11/30 21:48:54	1.28.2.3
@@ -1566,21 +1566,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)) {
-			int conflict;
-			struct file_lock tmp;
-
-			conflict = posix_test_lock(file, fl, &tmp);
-			fl->fl_type = F_UNLCK;
-			if (conflict)
-				memcpy(fl, &tmp, sizeof(struct file_lock));
-			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)
@@ -1722,7 +1707,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);
 
@@ -1731,9 +1715,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;
@@ -1766,3 +1747,25 @@
 	.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,
+	.mmap = gfs_mmap,
+	.open = gfs_open,
+	.release = gfs_close,
+	.fsync = gfs_fsync,
+	.sendfile = gfs_sendfile,
+};
+
+struct file_operations gfs_dir_fops_nolock = {
+	.readdir = gfs_readdir,
+	.ioctl = gfs_ioctl,
+	.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	2007/11/30 21:48:54	1.2.2.1
@@ -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__ */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]