VServer 1.9.2 (patch-2.6.8.1-vs1.9.2.diff)
[linux-2.6.git] / kernel / vserver / network.c
index b9b9327..a62d1c4 100644 (file)
@@ -31,7 +31,7 @@ static struct nx_info *__alloc_nx_info(nid_t nid)
 {
        struct nx_info *new = NULL;
        
-       nxdprintk("alloc_nx_info()\n");
+       vxdprintk(VXD_CBIT(nid, 1), "alloc_nx_info(%d)*", nid);
 
        /* would this benefit from a slab cache? */
        new = kmalloc(sizeof(struct nx_info), GFP_KERNEL);
@@ -47,7 +47,8 @@ static struct nx_info *__alloc_nx_info(nid_t nid)
 
        /* rest of init goes here */
        
-       nxdprintk("alloc_nx_info() = %p\n", new);
+       vxdprintk(VXD_CBIT(nid, 0),
+               "alloc_nx_info() = %p", new);
        return new;
 }
 
@@ -57,7 +58,8 @@ static struct nx_info *__alloc_nx_info(nid_t nid)
 
 static void __dealloc_nx_info(struct nx_info *nxi)
 {
-       nxdprintk("dealloc_nx_info(%p)\n", nxi);
+       vxdprintk(VXD_CBIT(nid, 0),
+               "dealloc_nx_info(%p)", nxi);
 
        nxi->nx_hlist.next = LIST_POISON1;
        nxi->nx_id = -1;
@@ -94,7 +96,8 @@ static inline void __hash_nx_info(struct nx_info *nxi)
 {
        struct hlist_head *head;
        
-       nxdprintk("__hash_nx_info: %p[#%d]\n", nxi, nxi->nx_id);
+       vxdprintk(VXD_CBIT(nid, 4),
+               "__hash_nx_info: %p[#%d]", nxi, nxi->nx_id);
        get_nx_info(nxi);
        head = &nx_info_hash[__hashval(nxi->nx_id)];
        hlist_add_head_rcu(&nxi->nx_hlist, head);
@@ -107,7 +110,8 @@ static inline void __hash_nx_info(struct nx_info *nxi)
 
 static inline void __unhash_nx_info(struct nx_info *nxi)
 {
-       nxdprintk("__unhash_nx_info: %p[#%d]\n", nxi, nxi->nx_id);
+       vxdprintk(VXD_CBIT(nid, 4),
+               "__unhash_nx_info: %p[#%d]", nxi, nxi->nx_id);
        hlist_del_rcu(&nxi->nx_hlist);
        put_nx_info(nxi);
 }
@@ -148,8 +152,11 @@ static inline nid_t __nx_dynamic_id(void)
        do {
                if (++seq > MAX_N_CONTEXT)
                        seq = MIN_D_CONTEXT;
-               if (!__lookup_nx_info(seq))
+               if (!__lookup_nx_info(seq)) {
+                       vxdprintk(VXD_CBIT(nid, 4),
+                               "__nx_dynamic_id: [#%d]", seq);
                        return seq;
+               }
        } while (barrier != seq);
        return 0;
 }
@@ -163,7 +170,7 @@ static struct nx_info * __loc_nx_info(int id, int *err)
 {
        struct nx_info *new, *nxi = NULL;
        
-       nxdprintk("loc_nx_info(%d)\n", id);
+       vxdprintk(VXD_CBIT(nid, 1), "loc_nx_info(%d)*", id);
 
        if (!(new = __alloc_nx_info(id))) {
                *err = -ENOMEM;
@@ -185,11 +192,13 @@ static struct nx_info * __loc_nx_info(int id, int *err)
        else if ((nxi = __lookup_nx_info(id))) {
                /* context in setup is not available */
                if (nxi->nx_flags & VXF_STATE_SETUP) {
-                       nxdprintk("loc_nx_info(%d) = %p (not available)\n", id, nxi);
+                       vxdprintk(VXD_CBIT(nid, 0),
+                               "loc_nx_info(%d) = %p (not available)", id, nxi);
                        nxi = NULL;
                        *err = -EBUSY;
                } else {
-                       nxdprintk("loc_nx_info(%d) = %p (found)\n", id, nxi);
+                       vxdprintk(VXD_CBIT(nid, 0),
+                               "loc_nx_info(%d) = %p (found)", id, nxi);
                        get_nx_info(nxi);
                        *err = 0;
                }
@@ -197,7 +206,8 @@ static struct nx_info * __loc_nx_info(int id, int *err)
        }
 
        /* new context requested */
-       nxdprintk("loc_nx_info(%d) = %p (new)\n", id, new);
+       vxdprintk(VXD_CBIT(nid, 0),
+               "loc_nx_info(%d) = %p (new)", id, new);
        __hash_nx_info(get_nx_info(new));
        nxi = new, new = NULL;
        *err = 1;
@@ -216,17 +226,21 @@ out_unlock:
 
 
 
-void rcu_free_nx_info(void *obj)
+void rcu_free_nx_info(struct rcu_head *head)
 {
-       struct nx_info *nxi = obj;
+       struct nx_info *nxi = container_of(head, struct nx_info, nx_rcu);
        int usecnt, refcnt;
 
+       BUG_ON(!nxi || !head);
+
        usecnt = atomic_read(&nxi->nx_usecnt);
        BUG_ON(usecnt < 0);
 
        refcnt = atomic_read(&nxi->nx_refcnt);
        BUG_ON(refcnt < 0);
 
+       vxdprintk(VXD_CBIT(nid, 3),
+               "rcu_free_nx_info(%p): uc=%d", nxi, usecnt);
        if (!usecnt)
                __dealloc_nx_info(nxi);
        else
@@ -287,7 +301,7 @@ struct nx_info *create_nx_info(void)
        struct nx_info *new;
        int err;
        
-       nxdprintk("create_nx_info()\n");
+       vxdprintk(VXD_CBIT(nid, 5), "create_nx_info(%s)", "void");
        if (!(new = __loc_nx_info(NX_DYNAMIC_ID, &err)))
                return NULL;
        return new;
@@ -342,7 +356,8 @@ int nx_migrate_task(struct task_struct *p, struct nx_info *nxi)
        if (!p || !nxi)
                BUG();
 
-       nxdprintk("nx_migrate_task(%p,%p[#%d.%d.%d])\n",
+       vxdprintk(VXD_CBIT(nid, 5),
+               "nx_migrate_task(%p,%p[#%d.%d.%d])",
                p, nxi, nxi->nx_id,
                atomic_read(&nxi->nx_usecnt),
                atomic_read(&nxi->nx_refcnt));