libata: test major version in ata_id_is_sata()
[powerpc.git] / fs / dlm / memory.c
index 0b9851d..f858fef 100644 (file)
@@ -15,7 +15,7 @@
 #include "config.h"
 #include "memory.h"
 
-static kmem_cache_t *lkb_cache;
+static struct kmem_cache *lkb_cache;
 
 
 int dlm_memory_init(void)
@@ -50,22 +50,6 @@ void free_lvb(char *p)
        kfree(p);
 }
 
-uint64_t *allocate_range(struct dlm_ls *ls)
-{
-       int ralen = 4*sizeof(uint64_t);
-       uint64_t *p;
-
-       p = kmalloc(ralen, GFP_KERNEL);
-       if (p)
-               memset(p, 0, ralen);
-       return p;
-}
-
-void free_range(uint64_t *p)
-{
-       kfree(p);
-}
-
 /* FIXME: have some minimal space built-in to rsb for the name and
    kmalloc a separate name if needed, like dentries are done */
 
@@ -92,14 +76,21 @@ struct dlm_lkb *allocate_lkb(struct dlm_ls *ls)
 {
        struct dlm_lkb *lkb;
 
-       lkb = kmem_cache_alloc(lkb_cache, GFP_KERNEL);
-       if (lkb)
-               memset(lkb, 0, sizeof(*lkb));
+       lkb = kmem_cache_zalloc(lkb_cache, GFP_KERNEL);
        return lkb;
 }
 
 void free_lkb(struct dlm_lkb *lkb)
 {
+       if (lkb->lkb_flags & DLM_IFL_USER) {
+               struct dlm_user_args *ua;
+               ua = (struct dlm_user_args *)lkb->lkb_astparam;
+               if (ua) {
+                       if (ua->lksb.sb_lvbptr)
+                               kfree(ua->lksb.sb_lvbptr);
+                       kfree(ua);
+               }
+       }
        kmem_cache_free(lkb_cache, lkb);
 }
 
@@ -107,7 +98,8 @@ struct dlm_direntry *allocate_direntry(struct dlm_ls *ls, int namelen)
 {
        struct dlm_direntry *de;
 
-       DLM_ASSERT(namelen <= DLM_RESNAME_MAXLEN,);
+       DLM_ASSERT(namelen <= DLM_RESNAME_MAXLEN,
+                  printk("namelen = %d\n", namelen););
 
        de = kmalloc(sizeof(*de) + namelen, GFP_KERNEL);
        if (de)