[SSI] openssi/kernel/cluster/ssi/cfs dir.c,1.35,1.36

Roger Tsang <[email protected]> Wed, 15 Dec 2010 08:08:09 +0000
Newsgroups gmane.linux.cluster.ssic.cvs
Message-ID <[email protected]>
Update of /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/cfs
In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv25982/kernel/cluster/ssi/cfs

Modified Files:
      Tag: OPENSSI-FC
	dir.c 
Log Message:
- cfs_renew_times: skip d_time. not used since we have directory versioning.
- cfs_lookup_revalidate: set CFSTOK_DELAY flag since another file operation is likely to occur.
- cfs_lookup_revalidate: no need to acquire CFSTOK_ATTR token for revalidate() since results are only valid at time of lookup.
- cfs_lookup: no need to acquire CFSTOK_ATTR token. permissions will be checked server-side anyway.


Index: dir.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/cfs/dir.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- dir.c	15 Dec 2010 07:32:21 -0000	1.35
+++ dir.c	15 Dec 2010 08:08:07 -0000	1.36
@@ -679,8 +679,10 @@
  */
 static inline void cfs_renew_times(struct dentry * dentry)
 {
+#ifdef SSI_CFS_SKIP
 	/* SSI_XXX: Not sure if we need this from NFS. */
 	dentry->d_time = jiffies;
+#endif
 }
 
 #if defined(CFS_ZAP_CACHES) //&& defined(CFS_FILE_RW_NOLOCK)
@@ -808,6 +810,8 @@
 	if (d_unhashed(dentry))
 		goto out_valid;
 
+#ifdef SSI_CFS_SKIP
+	/* SSI: No point holding token. results only valid at time of lookup */
 	error = cfstok_req(dir, CFSTOK_ATTR, CFSTOK_READ,
 		CFSTOK_HOLD|CFSTOK_BLOCK, NON_RANGE, NULL);
 #ifdef CFSTOK_INTR
@@ -815,6 +819,7 @@
 #endif
 	SSI_ASSERT(error == CFSTOK_HELD);
 	lock = TRUE;
+#endif /* SSI_CFS_SKIP */
 
 #ifdef SSI_CFS_NEGDCACHE
 	dcd = vdc2dcd(dentry);
@@ -858,7 +863,9 @@
 	cfs_renew_times(dentry);
 out_valid:
 	if (lock)
-		cfstok_relse(dir, CFSTOK_ATTR, CFSTOK_READ, NON_RANGE);
+		/* SSI: another CFS file operation likely to follow */
+		cfstok_relsex(dir, CFSTOK_ATTR, CFSTOK_READ,
+					NON_RANGE, CFSTOK_DELAY, 0);
 #ifdef SSI_CFS_SKIP
 	unlock_kernel();
 #endif
@@ -996,6 +1003,8 @@
 	}
 #endif /* SSI_CFS_NEGDCACHE */
 
+#if 0
+	/* SSI: No need to hold token. server will re-check permissions */
 	error = cfstok_req(dir, CFSTOK_ATTR, CFSTOK_READ,
 		CFSTOK_HOLD|CFSTOK_BLOCK, NON_RANGE, NULL);
 #ifdef CFSTOK_INTR
@@ -1013,6 +1022,7 @@
 		res = ERR_PTR(error);
 		goto release_out;
 	}
+#endif
 #ifdef KERNEL2616_53
 	/*
 	 * If we're doing an exclusive create, optimize away the lookup
@@ -1059,7 +1069,9 @@
 		res = ERR_PTR(error);
 
 release_out:
+#if 0
 	cfstok_relse(dir, CFSTOK_ATTR, CFSTOK_READ, NON_RANGE);
+#endif
 out:
 #ifdef SSI_CFS_NEGDCACHE
 	if (dcd)
@@ -1251,10 +1263,10 @@
 
 static int cfs_rmdir(struct inode *dir, struct dentry *dentry)
 {
-	int error;
-	struct inode *ip = dentry->d_inode;
 	cfs_lockop_t lock[2];
 	hold_list_t held;
+	struct inode *ip = dentry->d_inode;
+	int error;
 
 	dfprintk(VFS, "CFS: rmdir(%x/%ld, %s\n",
 		dir->i_sb->s_dev, dir->i_ino, dentry->d_name.name);
@@ -1289,7 +1301,7 @@
 	 */
 	cfs_begin_data_update(dir);
 	error = CFS_PROTO(dir)->rmdir(dir, &dentry->d_name, ip);
-#ifdef SSI_CFS_SKIP
+#ifdef SSI_EXNFS
 	/* Ensure the VFS deletes this inode */
 	if (error == 0 && dentry->d_inode != NULL)
 		dentry->d_inode->i_nlink = 0;
@@ -1304,16 +1316,15 @@
 		/* Done in base */
 		d_delete(dentry);
 #endif
-
 fail:
 	return error;
 }
 
 static int cfs_unlink(struct inode *dir, struct dentry *dentry)
 {
-	struct inode *inode = dentry->d_inode;
 	cfs_lockop_t lock[2];
 	hold_list_t held;
+	struct inode *inode = dentry->d_inode;
 	int error;
 
 	dfprintk(VFS, "CFS: unlink(%x/%ld, %s)\n",
@@ -1349,7 +1360,7 @@
 	cfs_begin_data_update(dir);
 	cfs_begin_data_update(inode);
 	error = CFS_PROTO(dir)->remove(dir, &dentry->d_name, inode);
-#ifdef SSI_CFS_SKIP
+#ifdef SSI_EXNFS
 	/* The VFS may want to delete this inode */
 	if (error == 0)
 		inode->i_nlink--;
@@ -1369,7 +1380,6 @@
 		/* Still need? done in ->delete_inode */
 		(void)cfs_wb_all(inode);
 #endif
-
 fail:
 	return error;
 }
@@ -1438,10 +1448,10 @@
 static int
 cfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry)
 {
+	cfs_lockop_t lock[2];
+	hold_list_t held;
 	struct inode *inode = old_dentry->d_inode;
 	int error;
-	hold_list_t held;
-	cfs_lockop_t lock[2];
 
 	dfprintk(VFS, "CFS: link(%s/%s -> %s/%s)\n",
 		old_dentry->d_parent->d_name.name, old_dentry->d_name.name,
@@ -1555,12 +1565,12 @@
 cfs_rename(struct inode *odir, struct dentry *odentry,
 		struct inode *ndir, struct dentry *ndentry)
 {
-	struct inode *ip = odentry->d_inode, *nip = ndentry->d_inode;
 	cfs_lockop_t lock[4];
-	int num_lock;
+	hold_list_t held;
+	struct inode *ip = odentry->d_inode, *nip = ndentry->d_inode;
 	int dir_rename = FALSE;
 	int error;
-	hold_list_t held;
+	int num_lock;
 
 	dfprintk(VFS, "CFS: rename(%s/%s -> %s/%s, ct=%d)\n",
 		 odentry->d_parent->d_name.name, odentry->d_name.name,


------------------------------------------------------------------------------
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d