[SSI] openssi/kernel/cluster/ssi/cfs dir.c, 1.30, 1.31 inode.c, 1.64, 1.65
Roger Tsang <[email protected]> Fri, 05 Mar 2010 06:15:06 +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-serv5782/kernel/cluster/ssi/cfs
Modified Files:
Tag: OPENSSI-FC
dir.c inode.c
Log Message:
CFS (#ifdef CFS_DCACHE_KMEM_CACHE):
- Allocate cfs_dcached struct from kmem_cache.
cluster/ssi/cfs/dir.c | 141 +++++++++++++++++------------
cluster/ssi/cfs/inode.c | 8 +
include/cluster/ssi/cfs/cfs_clnt.h | 2
include/linux/config.h | 4
4 files changed, 98 insertions(+), 57 deletions(-)
Index: inode.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/cfs/inode.c,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -d -r1.64 -r1.65
--- inode.c 5 Mar 2010 05:23:57 -0000 1.64
+++ inode.c 5 Mar 2010 06:15:04 -0000 1.65
@@ -72,6 +72,9 @@
#define CFS_PARANOIA 1
+#ifdef CFS_DCACHE_KMEM_CACHE
+extern void cfs_dcached_init(void);
+#endif
#ifdef CFS_PAGES_CACHE
extern void cfs_pagevec_init(void);
#endif
@@ -1869,7 +1872,10 @@
sb_nblks = (struct sb_nblks *)kmem_zalloc(MAX_SB_NBLKS_ENTRY * sizeof(struct sb_nblks), KM_SLEEP);
#endif
#ifdef CFS_PAGES_CACHE
- cfs_pagevec_init();
+ cfs_pagevec_init(); /* initialize internal page cache pool */
+#endif
+#ifdef CFS_DCACHE_KMEM_CACHE
+ cfs_dcached_init(); /* initialize negative dcache support */
#endif
/*
Index: dir.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/cfs/dir.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- dir.c 17 Dec 2009 06:43:50 -0000 1.30
+++ dir.c 5 Mar 2010 06:15:04 -0000 1.31
@@ -65,6 +65,10 @@
#define CFS_PARANOIA 1
/* #define CFS_DEBUG_VERBOSE 1 */
+#ifdef CFS_DCACHE_KMEM_CACHE
+static kmem_cache_t *cfs_dcached_cachep;
+#endif
+
static int cfs_readdir(struct file *, void *, filldir_t);
static struct dentry *cfs_lookup(struct inode *, struct dentry *, struct nameidata *);
static int cfs_create(struct inode *, struct dentry *, int, struct nameidata *);
@@ -389,9 +393,9 @@
loff_t *offset)
{
struct inode *inode;
- int err;
struct file *file;
loff_t origoffset = *offset;
+ int err;
err = cfsd_open(hp, S_IFDIR, MAY_READ, &file);
if (err)
@@ -463,19 +467,18 @@
*desc = &my_desc;
struct cfs_entry my_entry;
int res;
- enum cfstok_res result;
- result = cfstok_req(inode, CFSTOK_ATTR, CFSTOK_READ,
+ res = cfstok_req(inode, CFSTOK_ATTR, CFSTOK_READ,
CFSTOK_HOLD|CFSTOK_BLOCK, NON_RANGE, NULL);
#ifdef CFSTOK_INTR
- if (result == CFSTOK_INTERRUPTED) {
+ if (res == CFSTOK_INTERRUPTED) {
#ifdef DEBUG
printk(KERN_DEBUG "%s: Interrupted\n", __FUNCTION__);
#endif
return -EINTR;
}
#endif
- SSI_ASSERT(result == CFSTOK_HELD);
+ SSI_ASSERT(res == CFSTOK_HELD);
#ifdef CFS_ZAP_CACHES
res = cfs_revalidate_inode(inode);
@@ -616,6 +619,16 @@
return error;
}
+#ifdef CFS_DCACHE_KMEM_CACHE
+void cfs_dcached_init(void)
+{
+ cfs_dcached_cachep = kmem_cache_create("cfs_dcached",
+ sizeof(cfs_dcached_t), 0,
+ SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT|SLAB_PANIC,
+ NULL, NULL);
+}
+#endif /* CFS_DCACHE_KMEM_CACHE */
+
#ifdef CFS_ZAP_CACHES
/*
* A check for whether or not the parent directory has changed.
@@ -696,17 +709,12 @@
static int cfs_lookup_revalidate(struct dentry * dentry, struct nameidata *nd)
{
struct dentry *parent;
- struct inode *dir;
- struct inode *inode;
-#ifndef CFS_FILE_RW_NOLOCK
- int error, result, lock = FALSE;
-#else
- int error, lock = FALSE;
-#endif
- unsigned long inum;
+ struct inode *dir, *inode;
#ifdef SSI_CFS_NEGDCACHE
cfs_dcached_t *dcd;
#endif
+ unsigned long inum;
+ int error, lock = FALSE;
parent = dget_parent(dentry);
#ifdef SSI_CFS_SKIP
@@ -744,10 +752,10 @@
if (IS_ROOT(dentry))
goto out_valid;
- result = cfstok_req(dir, CFSTOK_ATTR, CFSTOK_READ,
+ error = cfstok_req(dir, CFSTOK_ATTR, CFSTOK_READ,
CFSTOK_HOLD|CFSTOK_BLOCK, NON_RANGE, NULL);
#ifdef CFSTOK_INTR
- if (result == CFSTOK_INTERRUPTED) {
+ if (error == CFSTOK_INTERRUPTED) {
dput(parent);
#ifdef DEBUG
printk(KERN_DEBUG "%s: Interrupted\n", __FUNCTION__);
@@ -755,7 +763,7 @@
return 0;
}
#endif
- SSI_ASSERT(result == CFSTOK_HELD);
+ SSI_ASSERT(error == CFSTOK_HELD);
lock = TRUE;
#endif /* !CFS_FILE_RW_NOLOCK */
@@ -794,12 +802,12 @@
if (d_unhashed(dentry))
goto out_valid;
- result = cfstok_req(dir, CFSTOK_ATTR, CFSTOK_READ,
+ error = cfstok_req(dir, CFSTOK_ATTR, CFSTOK_READ,
CFSTOK_HOLD|CFSTOK_BLOCK, NON_RANGE, NULL);
#ifdef CFSTOK_INTR
#error CFSTOK_INTERRUPTED not supported
#endif
- SSI_ASSERT(result == CFSTOK_HELD);
+ SSI_ASSERT(error == CFSTOK_HELD);
lock = TRUE;
#ifdef SSI_CFS_NEGDCACHE
@@ -908,21 +916,29 @@
return 0;
}
+#ifdef SSI_CFS_NEGDCACHE
void
cfs_drelease(struct dentry *dentry)
{
cfs_dcached_t *dcd = vdc2dcd(dentry);
+ dentry->d_fsdata = NULL;
+
if (dcd)
+#ifdef CFS_DCACHE_KMEM_CACHE
+ kmem_cache_free(cfs_dcached_cachep, dcd);
+#else
kfree(dcd);
-
- dentry->d_fsdata = NULL;
+#endif
}
+#endif /* SSI_CFS_NEGDCACHE */
struct dentry_operations cfs_dentry_operations = {
d_revalidate: cfs_lookup_revalidate,
d_delete: cfs_dentry_delete,
+#ifdef SSI_CFS_NEGDCACHE
d_release: cfs_drelease,
+#endif
};
#ifdef KERNEL2616_53
@@ -944,30 +960,40 @@
{
struct dentry *res;
struct inode *inode;
- int error, result;
- cfs_dcached_t *dcd = NULL;
+#ifdef SSI_CFS_NEGDCACHE
+ cfs_dcached_t *dcd;
+#endif
+ int error;
dfprintk(VFS, "CFS: lookup(%s/%s)\n",
dentry->d_parent->d_name.name, dentry->d_name.name);
if (dentry->d_name.len > (CFS_MAXPATHLEN -1)) {
res = ERR_PTR(-ENAMETOOLONG);
+#ifdef SSI_CFS_NEGDCACHE
+ dcd = NULL;
+#endif
goto out;
}
dentry->d_op = &cfs_dentry_operations;
- /* TODO: allocate from kmem_cache */
+#ifdef SSI_CFS_NEGDCACHE
+#ifdef CFS_DCACHE_KMEM_CACHE
+ dcd = kmem_cache_alloc(cfs_dcached_cachep, GFP_KERNEL);
+#else
dcd = (cfs_dcached_t *) kzmalloc(sizeof(cfs_dcached_t), GFP_KERNEL);
+#endif
if (!dcd) {
res = ERR_PTR(-ENOMEM);
goto out;
}
+#endif /* SSI_CFS_NEGDCACHE */
- result = cfstok_req(dir, CFSTOK_ATTR, CFSTOK_READ,
+ error = cfstok_req(dir, CFSTOK_ATTR, CFSTOK_READ,
CFSTOK_HOLD|CFSTOK_BLOCK, NON_RANGE, NULL);
#ifdef CFSTOK_INTR
- if (result == CFSTOK_INTERRUPTED) {
+ if (error == CFSTOK_INTERRUPTED) {
res = ERR_PTR(-EINTR);
#ifdef DEBUG
printk(KERN_DEBUG "%s: Interrupted\n", __FUNCTION__);
@@ -975,7 +1001,7 @@
goto out;
}
#endif
- SSI_ASSERT(result == CFSTOK_HELD);
+ SSI_ASSERT(error == CFSTOK_HELD);
if ((error = _cfs_permission(dir, MAY_EXEC))) {
res = ERR_PTR(error);
@@ -1015,30 +1041,36 @@
dentry = res;
cfs_renew_times(dentry);
+#ifdef SSI_CFS_NEGDCACHE
/* Set up the dcache data */
if (!vdc2dcd(dentry)) {
dcd->dc_vn = itoc(dir)->c_vn;
vdc2dcd(dentry) = dcd;
dcd = NULL; /* So it won't be free'd */
}
+#endif
} else
res = ERR_PTR(error);
release_out:
cfstok_relse(dir, CFSTOK_ATTR, CFSTOK_READ, NON_RANGE);
out:
+#ifdef SSI_CFS_NEGDCACHE
if (dcd)
+#ifdef CFS_DCACHE_KMEM_CACHE
+ kmem_cache_free(cfs_dcached_cachep, dcd);
+#else
kfree(dcd);
+#endif
+#endif /* SSI_CFS_NEGDCACHE */
return res;
}
static int cfs_create(struct inode *dir, struct dentry *dentry, int mode,
struct nameidata *nd)
{
- int error;
- int result;
struct inode *inode;
- int flags = 0;
+ int error, flags = 0;
dfprintk(VFS, "CFS: create(%x/%ld, %s\n",
dir->i_sb->s_dev, dir->i_ino, dentry->d_name.name);
@@ -1048,21 +1080,21 @@
flags = nd->intent.open.flags;
#ifdef SSI_CFSTOK_SU
- result = cfstok_req(dir, CFSTOK_ATTR, CFSTOK_SU,
+ error = cfstok_req(dir, CFSTOK_ATTR, CFSTOK_SU,
CFSTOK_HOLD|CFSTOK_BLOCK, NON_RANGE, NULL);
#else
- result = cfstok_req(dir, CFSTOK_ATTR, CFSTOK_EXCL,
+ error = cfstok_req(dir, CFSTOK_ATTR, CFSTOK_EXCL,
CFSTOK_HOLD|CFSTOK_BLOCK, NON_RANGE, NULL);
#endif
#ifdef CFSTOK_INTR
- if (result == CFSTOK_INTERRUPTED) {
+ if (error == CFSTOK_INTERRUPTED) {
#ifdef DEBUG
printk(KERN_DEBUG "%s: Interrupted\n", __FUNCTION__);
#endif
return -EINTR;
}
#endif
- SSI_ASSERT(result == CFSTOK_HELD);
+ SSI_ASSERT(error == CFSTOK_HELD);
/* Re-check directory permission with token held */
if ((error = _cfs_permission(dir, MAY_WRITE|MAY_EXEC)))
@@ -1099,29 +1131,28 @@
static int cfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev)
{
- int error;
- int result;
struct inode *inode;
+ int error;
dfprintk(VFS, "CFS: mknod(%x/%ld, %s\n",
dir->i_sb->s_dev, dir->i_ino, dentry->d_name.name);
#ifdef SSI_CFSTOK_SU
- result = cfstok_req(dir, CFSTOK_ATTR, CFSTOK_SU,
+ error = cfstok_req(dir, CFSTOK_ATTR, CFSTOK_SU,
CFSTOK_HOLD|CFSTOK_BLOCK, NON_RANGE, NULL);
#else
- result = cfstok_req(dir, CFSTOK_ATTR, CFSTOK_EXCL,
+ error = cfstok_req(dir, CFSTOK_ATTR, CFSTOK_EXCL,
CFSTOK_HOLD|CFSTOK_BLOCK, NON_RANGE, NULL);
#endif
#ifdef CFSTOK_INTR
- if (result == CFSTOK_INTERRUPTED) {
+ if (error == CFSTOK_INTERRUPTED) {
#ifdef DEBUG
printk(KERN_DEBUG "%s: Interrupted\n", __FUNCTION__);
#endif
return -EINTR;
}
#endif
- SSI_ASSERT(result == CFSTOK_HELD);
+ SSI_ASSERT(error == CFSTOK_HELD);
/* Re-check directory permission with token held */
if ((error = _cfs_permission(dir, MAY_WRITE|MAY_EXEC)))
@@ -1158,27 +1189,27 @@
static int cfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
{
struct inode *inode;
- int error, result;
+ int error;
dfprintk(VFS, "CFS: mkdir(%x/%ld, %s\n",
dir->i_sb->s_dev, dir->i_ino, dentry->d_name.name);
#ifdef SSI_CFSTOK_SU
- result = cfstok_req(dir, CFSTOK_ATTR, CFSTOK_SU,
+ error = cfstok_req(dir, CFSTOK_ATTR, CFSTOK_SU,
CFSTOK_HOLD|CFSTOK_BLOCK, NON_RANGE, NULL);
#else
- result = cfstok_req(dir, CFSTOK_ATTR, CFSTOK_EXCL,
+ error = cfstok_req(dir, CFSTOK_ATTR, CFSTOK_EXCL,
CFSTOK_HOLD|CFSTOK_BLOCK, NON_RANGE, NULL);
#endif
#ifdef CFSTOK_INTR
- if (result == CFSTOK_INTERRUPTED) {
+ if (error == CFSTOK_INTERRUPTED) {
#ifdef DEBUG
printk(KERN_DEBUG "%s: Interrupted\n", __FUNCTION__);
#endif
return -EINTR;
}
#endif
- SSI_ASSERT(result == CFSTOK_HELD);
+ SSI_ASSERT(error == CFSTOK_HELD);
/* Re-check directory permission with token held */
if ((error = _cfs_permission(dir, MAY_WRITE|MAY_EXEC)))
@@ -1343,7 +1374,6 @@
struct inode *inode;
unsigned int maxlen;
int error;
- int result;
dfprintk(VFS, "CFS: symlink(%x/%ld, %s, %s)\n",
dir->i_sb->s_dev, dir->i_ino, dentry->d_name.name, symname);
@@ -1356,21 +1386,21 @@
return error;
#ifdef SSI_CFSTOK_SU
- result = cfstok_req(dir, CFSTOK_ATTR, CFSTOK_SU,
+ error = cfstok_req(dir, CFSTOK_ATTR, CFSTOK_SU,
CFSTOK_HOLD|CFSTOK_BLOCK, NON_RANGE, NULL);
#else
- result = cfstok_req(dir, CFSTOK_ATTR, CFSTOK_EXCL,
+ error = cfstok_req(dir, CFSTOK_ATTR, CFSTOK_EXCL,
CFSTOK_HOLD|CFSTOK_BLOCK, NON_RANGE, NULL);
#endif
#ifdef CFSTOK_INTR
- if (result == CFSTOK_INTERRUPTED) {
+ if (error == CFSTOK_INTERRUPTED) {
#ifdef DEBUG
printk(KERN_DEBUG "%s: Interrupted\n", __FUNCTION__);
#endif
return -EINTR;
}
#endif
- SSI_ASSERT(result == CFSTOK_HELD);
+ SSI_ASSERT(error == CFSTOK_HELD);
/* Re-check directory permission with token held */
if ((error = _cfs_permission(dir, MAY_WRITE|MAY_EXEC)))
@@ -1733,7 +1763,6 @@
int
cfs_permission(struct inode *inode, int mask, struct nameidata *nd)
{
- int result;
#ifdef KERNEL2616_53
int res = 0;
@@ -1766,7 +1795,7 @@
force_lookup:
#else /* !KERNEL2616_53 */
- int error;
+ int res;
/* Are we checking permissions on anything other than lookup/execute? */
if ((mask & MAY_EXEC) == 0) {
@@ -1785,17 +1814,17 @@
* update the attributes under tokens. This function is called
* with tokens held.
*/
- result = cfstok_req(inode, CFSTOK_ATTR, CFSTOK_READ,
+ res = cfstok_req(inode, CFSTOK_ATTR, CFSTOK_READ,
CFSTOK_HOLD|CFSTOK_BLOCK, NON_RANGE, NULL);
#ifdef CFSTOK_INTR
- if (result == CFSTOK_INTERRUPTED) {
+ if (res == CFSTOK_INTERRUPTED) {
#ifdef DEBUG
printk(KERN_DEBUG "%s: Interrupted\n", __FUNCTION__);
#endif
return -EINTR;
}
#endif
- SSI_ASSERT(result == CFSTOK_HELD);
+ SSI_ASSERT(res == CFSTOK_HELD);
#ifdef KERNEL2616_53
res = cfs_revalidate_inode(inode);
if (res == 0)
@@ -1806,11 +1835,11 @@
return res;
#else
//(void)cfs_revalidate_inode(inode, 1);
- error = _cfs_permission(inode, mask);
+ res = _cfs_permission(inode, mask);
cfstok_relse(inode, CFSTOK_ATTR, CFSTOK_READ, NON_RANGE);
- return error;
+ return res;
#endif
}
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev