[PVFS2-CVS] commit by wujs in pvfs2-1/src/io/buffer: internal.c ncac-init.c internal.h

CVS commit program cvs at parl.clemson.edu
Mon Mar 22 23:07:15 EST 2004


Update of /projects/cvsroot/pvfs2-1/src/io/buffer
In directory parlweb:/tmp/cvs-serv1970/pvfs2/src/io/buffer

Modified Files:
	internal.c ncac-init.c internal.h 
Log Message:
(1) Cleanup code;
(2) Begin to reduce the concurrency control.



Index: internal.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/io/buffer/internal.c,v
diff -p -u -r1.1 -r1.2
--- internal.c	21 Aug 2003 18:57:27 -0000	1.1
+++ internal.c	23 Mar 2004 04:07:15 -0000	1.2
@@ -30,21 +30,25 @@ static inline int NCAC_rwjob_prepare_one
 static inline struct NCAC_req * get_internal_req_lock( PVFS_fs_id fsid, PVFS_handle hndl)
 {
 
-    NCAC_req_t *req=NULL;
+	NCAC_req_t *req=NULL;
 	struct list_head *new;
 
-	list_lock(&NCAC_dev.req_list_lock); 
+	//list_lock(&NCAC_dev.req_list_lock); 
 
 	if ( list_empty(&NCAC_dev.free_req_list) ) return NULL;
 
 	new = NCAC_dev.free_req_list.next;
+	if ( !new ) {
+		fprintf(stderr, "there is no entry in the free req list\n");
+		return NULL;
+	}
 	list_del_init(new);
 
-	list_unlock(&NCAC_dev.req_list_lock); 
+	//list_unlock(&NCAC_dev.req_list_lock); 
 
 	req = list_entry(new->prev, NCAC_req_t, list);
 
-    return req;  
+	return req;  
 }
 
 

Index: ncac-init.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/io/buffer/ncac-init.c,v
diff -p -u -r1.2 -r1.3
--- ncac-init.c	7 Oct 2003 14:19:04 -0000	1.2
+++ ncac-init.c	23 Mar 2004 04:07:15 -0000	1.3
@@ -23,13 +23,18 @@ static inline void init_cache_stack_list
 
 unsigned long radix_get_value(const void *item);
 
+/* TODO: */
+static int extlog2(int extsize)
+{
+	return 15;
+}
+
 
 /* cache_init(): initiate cache. */
 
 int cache_init(NCAC_info_t *info)
 {
     int reqnum;
-    void *tmp;
 
     if ( info->max_req_num == -1 ) reqnum = MAX_DELT_REQ_NUM;
     else reqnum = info->max_req_num;
@@ -42,18 +47,15 @@ int cache_init(NCAC_info_t *info)
     memset( NCAC_dev.free_req_src, 0, reqnum*sizeof(struct NCAC_req) );
     init_free_req_list(reqnum);
 
-    NCAC_dev.extsize = 32768;
-    NCAC_dev.extlog2 = 15;
+    NCAC_dev.extsize = info->extsize;
+    NCAC_dev.extlog2 = extlog2(info->extsize);
 
     NCAC_dev.cachesize = info->cachesize;
-    //NCAC_dev.cachemem  = (char *) malloc(NCAC_dev.cachesize);
-
-    posix_memalign( &tmp, getpagesize(), NCAC_dev.cachesize);
-    if ( tmp == NULL ) {
-        fprintf(stderr, "cache_init: cannot allocate cache buffers.\n");
-        return -ENOMEM;
+    NCAC_dev.cachemem  = (char *) info->cachespace;
+    if ( !info->cachespace )
+    {
+         fprintf(stderr, "cache space is NULL\n");
     }
-    NCAC_dev.cachemem = tmp;
 
     /* we expect extcnt is a power of two number */
     NCAC_dev.extcnt = (NCAC_dev.cachesize/NCAC_dev.extsize);

Index: internal.h
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/io/buffer/internal.h,v
diff -p -u -r1.1 -r1.2
--- internal.h	21 Aug 2003 18:57:27 -0000	1.1
+++ internal.h	23 Mar 2004 04:07:15 -0000	1.2
@@ -21,6 +21,7 @@ struct NCAC_cache_info{
     int max_req_num;
     int extsize;
     int cachesize;
+    void *cachespace;
 };
 
 struct cache_stack {



More information about the PVFS2-CVS mailing list