X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=kernel%2Fvserver%2Fnetwork.c;h=a62d1c435add7b13c483ac8014568ab9ada8c17c;hb=9bf4aaab3e101692164d49b7ca357651eb691cb6;hp=b9b9327e84063a9cbf28b481a16dc4951d58a9e2;hpb=9213980e6a70d8473e0ffd4b39ab5b6caaba9ff5;p=linux-2.6.git diff --git a/kernel/vserver/network.c b/kernel/vserver/network.c index b9b9327e8..a62d1c435 100644 --- a/kernel/vserver/network.c +++ b/kernel/vserver/network.c @@ -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));