tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CHFS in -current



Hiya,

I have been playing a bit around with CHFS from CVS MAIN, and I have
run into two build issues and a missing base-struct.
The first build problem is gcc complaining about old-style function definitions:

/usr/local/src/netbsd-current/src-orig/sys/ufs/chfs/chfs_malloc.c: In
function 'chfs_alloc_pool_caches':
/usr/local/src/netbsd-current/src-orig/sys/ufs/chfs/chfs_malloc.c:48:1:
error: old-style function definition
[8 more of those]

This is easily fixed by adding void to the appropriate function definitions.

Next, in chfs_pool.c, pool_page_alloc_nointr() and
pool_page_free_nointr() are used. As far as I can see, these functions
have been removed, and replacing the calls with pool_get() and
pool_put(), respectively, seems to work.

Finally, struct chfs_inode seems to be lacking the struct genfs_node
base structure leading to unpredictable behaviour.

The attached patch addresses all three issues. Can anyone verify that
the above-mentioned fixes are indeed correct?

Cheers,
Paul
diff -N -u -r -x CVS -x '.#*' -x '*.swp' src-orig/sys/ufs/chfs/chfs_inode.h 
src/sys/ufs/chfs/chfs_inode.h
--- src-orig/sys/ufs/chfs/chfs_inode.h  2012-01-11 20:26:24.000000000 +0100
+++ src/sys/ufs/chfs/chfs_inode.h       2012-02-27 21:57:16.000000000 +0100
@@ -42,6 +42,7 @@
 
 struct chfs_inode
 {
+       struct genfs_node       gnode;
        kmutex_t inode_lock;    /* lock the fields of chfs_inode */
 
        LIST_ENTRY(chfs_inode) hash_entry;      /* Hash chain. */
diff -N -u -r -x CVS -x '.#*' -x '*.swp' src-orig/sys/ufs/chfs/chfs_malloc.c 
src/sys/ufs/chfs/chfs_malloc.c
--- src-orig/sys/ufs/chfs/chfs_malloc.c 2012-01-11 20:26:24.000000000 +0100
+++ src/sys/ufs/chfs/chfs_malloc.c      2012-02-27 21:22:17.000000000 +0100
@@ -45,7 +45,7 @@
 pool_cache_t chfs_tmp_dnode_info_cache;
 
 int
-chfs_alloc_pool_caches()
+chfs_alloc_pool_caches(void)
 {
        chfs_vnode_cache = pool_cache_init(
                sizeof(struct chfs_vnode_cache),
@@ -118,7 +118,7 @@
 }
 
 void
-chfs_destroy_pool_caches()
+chfs_destroy_pool_caches(void)
 {
        if (chfs_vnode_cache)
                pool_cache_destroy(chfs_vnode_cache);
@@ -293,7 +293,7 @@
 }
 
 struct chfs_full_dnode*
-chfs_alloc_full_dnode()
+chfs_alloc_full_dnode(void)
 {
        struct chfs_full_dnode *ret;
        ret = kmem_alloc(sizeof(struct chfs_full_dnode), KM_SLEEP);
@@ -307,7 +307,7 @@
 }
 
 struct chfs_flash_vnode*
-chfs_alloc_flash_vnode()
+chfs_alloc_flash_vnode(void)
 {
        struct chfs_flash_vnode *ret;
        ret = pool_cache_get(chfs_flash_vnode_cache, 0);
@@ -321,7 +321,7 @@
 }
 
 struct chfs_flash_dirent_node*
-chfs_alloc_flash_dirent()
+chfs_alloc_flash_dirent(void)
 {
        struct chfs_flash_dirent_node *ret;
        ret = pool_cache_get(chfs_flash_dirent_cache, 0);
@@ -335,7 +335,7 @@
 }
 
 struct chfs_flash_data_node*
-chfs_alloc_flash_dnode()
+chfs_alloc_flash_dnode(void)
 {
        struct chfs_flash_data_node *ret;
        ret = pool_cache_get(chfs_flash_dnode_cache, 0);
@@ -350,7 +350,7 @@
 
 
 struct chfs_node_frag*
-chfs_alloc_node_frag()
+chfs_alloc_node_frag(void)
 {
        struct chfs_node_frag *ret;
        ret = pool_cache_get(chfs_node_frag_cache, 0);
@@ -365,7 +365,7 @@
 }
 
 struct chfs_tmp_dnode *
-chfs_alloc_tmp_dnode()
+chfs_alloc_tmp_dnode(void)
 {
        struct chfs_tmp_dnode *ret;
        ret = pool_cache_get(chfs_tmp_dnode_cache, 0);
@@ -380,7 +380,7 @@
 }
 
 struct chfs_tmp_dnode_info *
-chfs_alloc_tmp_dnode_info()
+chfs_alloc_tmp_dnode_info(void)
 {
        struct chfs_tmp_dnode_info *ret;
        ret = pool_cache_get(chfs_tmp_dnode_info_cache, 0);
diff -N -u -r -x CVS -x '.#*' -x '*.swp' src-orig/sys/ufs/chfs/chfs_pool.c 
src/sys/ufs/chfs/chfs_pool.c
--- src-orig/sys/ufs/chfs/chfs_pool.c   2012-01-11 20:26:24.000000000 +0100
+++ src/sys/ufs/chfs/chfs_pool.c        2012-02-27 21:34:12.000000000 +0100
@@ -50,9 +50,6 @@
 void * chfs_pool_page_alloc(struct pool *, int);
 void   chfs_pool_page_free(struct pool *, void *);
 
-extern void*   pool_page_alloc_nointr(struct pool *, int);
-extern void    pool_page_free_nointr(struct pool *, void *);
-
 /* --------------------------------------------------------------------- */
 
 struct pool_allocator chfs_pool_allocator = {
@@ -104,7 +101,7 @@
                atomic_dec_uint(&chmp->chm_pages_used);
                return NULL;
        }
-       page = pool_page_alloc_nointr(pp, flags | PR_WAITOK);
+       page = pool_get(pp, flags | PR_WAITOK);
        if (page == NULL) {
                atomic_dec_uint(&chmp->chm_pages_used);
        }
@@ -125,7 +122,7 @@
        chmp = chpp->chp_mount;
 
        atomic_dec_uint(&chmp->chm_pages_used);
-       pool_page_free_nointr(pp, v);
+       pool_put(pp,v);
 }
 
 /* --------------------------------------------------------------------- */


Home | Main Index | Thread Index | Old Index