[SSI] openssi/kernel/cluster/ssi/cfs cfsproc.c, 1.31, 1.32 inode.c, 1.58, 1.59 svrcfs.c, 1.22, 1.23
Roger Tsang <[email protected]>
| Newsgroups | gmane.linux.cluster.ssic.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/cfs
In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv20067/cluster/ssi/cfs
Modified Files:
Tag: OPENSSI-FC
cfsproc.c inode.c svrcfs.c
Log Message:
CFS:
- Move redundant struct svrcfstok initialization to kmem cache constructor. (#ifdef SVRCFS_TOKEN_KMEM_CACHE)
SSI:
- Regression:
- real_lookup() possibly returning unreferenced dentry instead of -ENOENT. (#ifndef REAL_LOOKUP_SSI_1_9_3_FIXED_PLS_VERIFY)
VPROC:
- Move redundant struct vproc initialization to kmem cache constructor. (#ifdef VPROC_KMEM_CACHE)
cluster/ssi/cfs/cfsproc.c | 28 ++++-----------
cluster/ssi/cfs/inode.c | 14 +++----
cluster/ssi/cfs/svrcfs.c | 59 +++++++++++++++++++++-----------
cluster/ssi/vproc/dvp_init.c | 59 ++++++++++++++++++++++++++++++--
cluster/ssi/vproc/vp_subr.c | 71 ++++++++++++++++++++++++++-------------
fs/namei.c | 6 +++
include/cluster/ssi/cfs/cfstok.h | 25 ++++++-------
7 files changed, 177 insertions(+), 85 deletions(-)
Index: svrcfs.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/cfs/svrcfs.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- svrcfs.c 19 Feb 2009 08:01:01 -0000 1.22
+++ svrcfs.c 22 Feb 2009 04:15:37 -0000 1.23
@@ -144,6 +144,28 @@
#endif
#ifdef RCU_CFSTOK_TABLE
+#ifdef SVRCFS_TOKEN_KMEM_CACHE
+static void
+svrcfstok_ctor(void * foo, kmem_cache_t * cachep, unsigned long flags)
+{
+ svrcfstok_t *hp = (svrcfstok_t *) foo;
+
+ if ((flags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) ==
+ SLAB_CTOR_CONSTRUCTOR) {
+ INIT_RCU_HEAD(&hp->sct_rcu);
+ INIT_LOCK(&hp->sct_tcblock);
+#ifdef SSI_CFS_FULLTIMES
+ INIT_LOCK(&hp->sct_atlock);
+ INIT_LOCK(&hp->sct_mtlock);
+#endif
+ INIT_COND_LOCK(&hp->sct_statelock);
+ INIT_CONDITION(&hp->sct_cond);
+ INIT_RW_LOCK(&hp->sct_objlock);
+ hp->sct_fp = NULL; /* Allocated on first file lock */
+ }
+}
+#endif /* SVRCFS_TOKEN_KMEM_CACHE */
+
void
svrcfstok_init(void)
{
@@ -176,7 +198,7 @@
svrcfstok_cachep = kmem_cache_create("svrcfstok_struct",
sizeof(svrcfstok_t), 0,
SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT|SLAB_PANIC,
- NULL, NULL);
+ svrcfstok_ctor, NULL);
#endif
}
#endif /* RCU_CFSTOK_TABLE */
@@ -379,15 +401,18 @@
hp->sct_flags = 0;
#ifdef RCU_CFSTOK_TABLE
+#ifndef SVRCFS_TOKEN_KMEM_CACHE
INIT_RCU_HEAD(&hp->sct_rcu);
+#endif
atomic_set(&hp->sct_refcnt, 1);
#ifdef DEBUG
hp->sct_magic = CFSTOK_MAGIC;
#endif
#else
hp->sct_refcnt = 1;
-#endif
+#endif /* !RCU_CFSTOK_TABLE */
+#ifndef SVRCFS_TOKEN_KMEM_CACHE
INIT_LOCK(&hp->sct_tcblock);
#ifdef SSI_CFS_FULLTIMES
INIT_LOCK(&hp->sct_atlock);
@@ -396,6 +421,7 @@
INIT_COND_LOCK(&hp->sct_statelock);
INIT_CONDITION(&hp->sct_cond);
INIT_RW_LOCK(&hp->sct_objlock);
+#endif /* !SVRCFS_TOKEN_KMEM_CACHE */
#if !defined(CFSTOK_TABLE_LOCK_LOCK) || defined(RCU_CFSTOK_TABLE)
INIT_LIST_HEAD(&(hp->sct_prlist));
#endif
@@ -485,30 +511,27 @@
hp->sct_dinext = hp->sct_diprev = NULL;
#endif
+#ifndef RCU_CFSTOK_TABLE
/* Always keep a working dentry (based on dget())
* For performance only, we could scan sct_ip dentry
* list for potential dentry to use. Or create a disconnected
* one if neccesary.
*/
-#ifndef RCU_CFSTOK_TABLE
SSI_ASSERT(atomic_read(&dentry->d_count));
atomic_inc(&dentry->d_count);
hp->sct_dp = dentry;
-#endif
-
-#ifdef RCU_CFSTOK_TABLE
- hp->sct_ip = igrab(dentry->d_inode);
- BUG_ON(hp->sct_ip == NULL);
-
- hp->sct_dp = dget(dentry);
#else
+ hp->sct_dp = dget(dentry);
+#endif /* RCU_CFSTOK_TABLE */
+
/* Keep inode if need a different dentry (based on __iget() */
- SSI_ASSERT(atomic_read(&(dentry->d_inode->i_count)));
+ BUG_ON(!atomic_read(&(dentry->d_inode->i_count)));
atomic_inc(&(dentry->d_inode->i_count));
hp->sct_ip = dentry->d_inode;
-#endif
+#ifndef SVRCFS_TOKEN_KMEM_CACHE
hp->sct_fp = NULL; /* Allocated on first file lock */
+#endif
#ifdef CFS_READAHEAD
memset(&(hp->sct_ra), 0, sizeof(hp->sct_ra));
#endif
@@ -2909,14 +2932,8 @@
/* Must do this before iput/dput below, because they weren't held */
if (hp->sct_fp != NULL) {
fput(hp->sct_fp);
-#if 0
- struct file *filp = hp->sct_fp;
-
- if (filp->f_op && filp->f_op->release)
- filp->f_op->release(hp->sct_ip, filp);
- dput(filp->f_dentry);
- fops_put(filp->f_op);
- kfree(filp);
+#ifdef SVRCFS_TOKEN_KMEM_CACHE
+ hp->sct_fp = NULL;
#endif
}
@@ -2941,6 +2958,7 @@
}
#endif /* __KERNEL__ */
+#ifndef SVRCFS_TOKEN_KMEM_CACHE
DEINIT_LOCK(&hp->sct_tcblock);
#ifdef SSI_CFS_FULLTIMES
DEINIT_LOCK(&hp->sct_atlock);
@@ -2949,6 +2967,7 @@
DEINIT_COND_LOCK(&hp->sct_statelock);
DEINIT_CONDITION(&hp->sct_cond);
DEINIT_RW_LOCK(&hp->sct_objlock);
+#endif /* !SVRCFS_TOKEN_KMEM_CACHE */
#ifdef SSI_CFS_SKIP
/* Track active svrcfstok structures per SB: decrement the counter
Index: inode.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/cfs/inode.c,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -d -r1.58 -r1.59
--- inode.c 19 Feb 2009 08:01:01 -0000 1.58
+++ inode.c 22 Feb 2009 04:15:37 -0000 1.59
@@ -1656,6 +1656,7 @@
if ((flags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) ==
SLAB_CTOR_CONSTRUCTOR) {
memset(cp, 0, sizeof(struct cnode));
+
inode_init_once(&cp->vfs_inode);
spin_lock_init(&cp->req_lock);
INIT_LIST_HEAD(&cp->dirty);
@@ -1666,13 +1667,13 @@
INIT_LIST_HEAD(&cp->open_files);
cp->nread = 0;
#endif
- cp->ndirty = 0;
- cp->ncommit = 0;
- cp->npages = 0;
+ /* cp->ndirty = 0; */
+ /* cp->ncommit = 0; */
+ /* cp->npages = 0; */
#ifdef CFS_ZAP_CACHES
init_waitqueue_head(&cp->c_i_wait);
#endif
- cp->c_hp = NULL;
+ /* cp->c_hp = NULL; */
INIT_CONDITION(&(cp->c_cxlock));
#ifdef CFSTOKHOLD_LINUX_LIST
for(idx = 0; idx < CFSTOK_NTOKS; idx++)
@@ -2062,8 +2063,7 @@
static int
cfs_encode_fh(struct dentry *dentry, __u32 *data, int *max_len, int connectable)
{
- cfhandle_t *fhp = &itoc(dentry->d_inode)->c_fh;
- __u32 *datap = (__u32 *)fhp;
+ __u32 *datap = (__u32 *)CFS_FH(dentry->d_inode);
int fh_size = datap[1] + 1; /* prepend ino */
int fh_type = datap[2];
@@ -2073,7 +2073,7 @@
/* SSI_XXX: datap[4] is not necessarily an ino */
printk(KERN_DEBUG " fhp 0x%p ssidev=%d size=%d type=%d ino=%lu [4]=%lu [5]=%u",
- fhp, (int)datap[0], (int)datap[1], (int)datap[2],
+ CFS_FH(dentry->d_inode), (int)datap[0], (int)datap[1], (int)datap[2],
(ino_t)datap[3], (ino_t)datap[4], datap[5]); // datap[6], ...
#endif
Index: cfsproc.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/cfs/cfsproc.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- cfsproc.c 19 Feb 2009 08:01:01 -0000 1.31
+++ cfsproc.c 22 Feb 2009 04:15:37 -0000 1.32
@@ -107,40 +107,35 @@
if (hp->sct_fp)
return 0; /* Nothing to do */
- error = -ESTALE;
- if (dentry->d_inode == NULL)
+ if (dentry->d_inode == NULL) {
+ error = -ESTALE;
goto out;
+ }
/* Make sure that dentry points at target inode */
SSI_ASSERT(dentry->d_inode == inode);
- error = -ENOMEM;
- //filp = (struct file *) kzmalloc(sizeof(*filp), GFP_KERNEL);
filp = get_empty_filp();
- if (!filp)
+ if (!filp) {
+ error = -ENOMEM;
goto out;
+ }
filp->f_op = fops_get(inode->i_fop);
- //atomic_set(&filp->f_count, 1);
filp->f_dentry = dget(dentry);
/* filp->f_vfsmnt = NULL; */ /* SSI_XXX: Do I need something? */
filp->f_flags = O_RDONLY|O_LARGEFILE;
filp->f_mode = FMODE_READ;
- error = 0;
if (filp->f_op && filp->f_op->open) {
error = filp->f_op->open(inode, filp);
if (error) {
fput(filp);
-#if 0
- dput(filp->f_dentry);
- fops_put(filp->f_op);
- kfree(filp);
-#endif
goto out;
}
- }
+ } else
+ error = 0;
LOCK_COND_LOCK(&hp->sct_statelock);
if (hp->sct_fp != NULL) {
@@ -149,13 +144,6 @@
printk(KERN_WARNING "cfs_setup_sct_fp: Found sct_fp, must undo mine\n");
/* Someone else attached an fp before we could */
fput(filp);
-#if 0
- if (filp->f_op && filp->f_op->release)
- filp->f_op->release(hp->sct_ip, filp);
- dput(filp->f_dentry);
- fops_put(filp->f_op);
- kfree(filp);
-#endif
} else {
hp->sct_fp = filp;
UNLOCK_COND_LOCK(&hp->sct_statelock);
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H