X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=kernel%2Fvserver%2Fdlimit.c;h=d9478ddd887bf0fd7cde84cc313eb102d80f9d69;hb=9bf4aaab3e101692164d49b7ca357651eb691cb6;hp=eb9282f9f1f3feec425a1275e2b763dd5833cd5b;hpb=c449269f45c2cdf53af08c8d0af37472f66539d9;p=linux-2.6.git diff --git a/kernel/vserver/dlimit.c b/kernel/vserver/dlimit.c index eb9282f9f..d9478ddd8 100644 --- a/kernel/vserver/dlimit.c +++ b/kernel/vserver/dlimit.c @@ -31,7 +31,8 @@ static struct dl_info *__alloc_dl_info(struct super_block *sb, xid_t xid) { struct dl_info *new = NULL; - vxdprintk("alloc_dl_info(%p,%d)\n", sb, xid); + vxdprintk(VXD_CBIT(dlim, 5), + "alloc_dl_info(%p,%d)*", sb, xid); /* would this benefit from a slab cache? */ new = kmalloc(sizeof(struct dl_info), GFP_KERNEL); @@ -49,7 +50,8 @@ static struct dl_info *__alloc_dl_info(struct super_block *sb, xid_t xid) /* rest of init goes here */ - vxdprintk("alloc_dl_info(%p,%d) = %p\n", sb, xid, new); + vxdprintk(VXD_CBIT(dlim, 4), + "alloc_dl_info(%p,%d) = %p", sb, xid, new); return new; } @@ -59,7 +61,8 @@ static struct dl_info *__alloc_dl_info(struct super_block *sb, xid_t xid) static void __dealloc_dl_info(struct dl_info *dli) { - vxdprintk("dealloc_dl_info(%p)\n", dli); + vxdprintk(VXD_CBIT(dlim, 4), + "dealloc_dl_info(%p)", dli); dli->dl_hlist.next = LIST_POISON1; dli->dl_xid = -1; @@ -83,7 +86,7 @@ static spinlock_t dl_info_hash_lock = SPIN_LOCK_UNLOCKED; static inline unsigned int __hashval(struct super_block *sb, xid_t xid) { - return ((xid ^ (unsigned int)sb) % DL_HASH_SIZE); + return ((xid ^ (unsigned long)sb) % DL_HASH_SIZE); } @@ -97,7 +100,8 @@ static inline void __hash_dl_info(struct dl_info *dli) { struct hlist_head *head; - vxdprintk("__hash_dl_info: %p[#%d]\n", dli, dli->dl_xid); + vxdprintk(VXD_CBIT(dlim, 6), + "__hash_dl_info: %p[#%d]", dli, dli->dl_xid); get_dl_info(dli); head = &dl_info_hash[__hashval(dli->dl_sb, dli->dl_xid)]; hlist_add_head_rcu(&dli->dl_hlist, head); @@ -110,7 +114,8 @@ static inline void __hash_dl_info(struct dl_info *dli) static inline void __unhash_dl_info(struct dl_info *dli) { - vxdprintk("__unhash_dl_info: %p[#%d]\n", dli, dli->dl_xid); + vxdprintk(VXD_CBIT(dlim, 6), + "__unhash_dl_info: %p[#%d]", dli, dli->dl_xid); hlist_del_rcu(&dli->dl_hlist); put_dl_info(dli); } @@ -149,16 +154,18 @@ struct dl_info *locate_dl_info(struct super_block *sb, xid_t xid) rcu_read_lock(); dli = get_dl_info(__lookup_dl_info(sb, xid)); + vxdprintk(VXD_CBIT(dlim, 7), + "locate_dl_info(%p,#%d) = %p", sb, xid, dli); rcu_read_unlock(); return dli; } -void rcu_free_dl_info(void *obj) +void rcu_free_dl_info(struct rcu_head *head) { - struct dl_info *dli = obj; + struct dl_info *dli = container_of(head, struct dl_info, dl_rcu); int usecnt, refcnt; - BUG_ON(!dli); + BUG_ON(!dli || !head); usecnt = atomic_read(&dli->dl_usecnt); BUG_ON(usecnt < 0); @@ -166,6 +173,8 @@ void rcu_free_dl_info(void *obj) refcnt = atomic_read(&dli->dl_refcnt); BUG_ON(refcnt < 0); + vxdprintk(VXD_CBIT(dlim, 3), + "rcu_free_dl_info(%p)", dli); if (!usecnt) __dealloc_dl_info(dli); else @@ -437,3 +446,10 @@ no_blim: return; } +#include + +EXPORT_SYMBOL_GPL(locate_dl_info); +EXPORT_SYMBOL_GPL(rcu_free_dl_info); +// EXPORT_SYMBOL_GPL(dl_info_hash_lock); +// EXPORT_SYMBOL_GPL(unhash_dl_info); +