{
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);
/* 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;
}
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;
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);
}
{
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);
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);
}
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);
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
return;
}
+#include <linux/module.h>
+
+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);
+