/* Root UBI "class" object (corresponds to '/<sysfs>/class/ubi/') */
struct class *ubi_class;
-/* Slab cache for lock-tree entries */
-struct kmem_cache *ubi_ltree_slab;
-
/* Slab cache for wear-leveling entries */
struct kmem_cache *ubi_wl_entry_slab;
return 0;
}
-/**
- * ltree_entry_ctor - lock tree entries slab cache constructor.
- * @obj: the lock-tree entry to construct
- * @cache: the lock tree entry slab cache
- * @flags: constructor flags
- */
-static void ltree_entry_ctor(struct kmem_cache *cache, void *obj)
-{
- struct ubi_ltree_entry *le = obj;
-
- le->users = 0;
- init_rwsem(&le->mutex);
-}
-
/**
* find_mtd_device - open an MTD device by its name or number.
* @mtd_dev: name or number of the device
goto out_version;
}
- ubi_ltree_slab = kmem_cache_create("ubi_ltree_slab",
- sizeof(struct ubi_ltree_entry), 0,
- 0, <ree_entry_ctor);
- if (!ubi_ltree_slab)
- goto out_dev_unreg;
-
ubi_wl_entry_slab = kmem_cache_create("ubi_wl_entry_slab",
sizeof(struct ubi_wl_entry),
0, 0, NULL);
if (!ubi_wl_entry_slab)
- goto out_ltree;
+ goto out_dev_unreg;
/* Attach MTD devices */
for (i = 0; i < mtd_devs; i++) {
mutex_unlock(&ubi_devices_mutex);
}
kmem_cache_destroy(ubi_wl_entry_slab);
-out_ltree:
- kmem_cache_destroy(ubi_ltree_slab);
out_dev_unreg:
misc_deregister(&ubi_ctrl_cdev);
out_version:
mutex_unlock(&ubi_devices_mutex);
}
kmem_cache_destroy(ubi_wl_entry_slab);
- kmem_cache_destroy(ubi_ltree_slab);
misc_deregister(&ubi_ctrl_cdev);
class_remove_file(ubi_class, &ubi_version);
class_destroy(ubi_class);
{
struct ubi_ltree_entry *le, *le1, *le_free;
- le = kmem_cache_alloc(ubi_ltree_slab, GFP_NOFS);
+ le = kmalloc(sizeof(struct ubi_ltree_entry), GFP_NOFS);
if (!le)
return ERR_PTR(-ENOMEM);
+ le->users = 0;
+ init_rwsem(&le->mutex);
le->vol_id = vol_id;
le->lnum = lnum;
spin_unlock(&ubi->ltree_lock);
if (le_free)
- kmem_cache_free(ubi_ltree_slab, le_free);
+ kfree(le_free);
return le;
}
up_read(&le->mutex);
if (free)
- kmem_cache_free(ubi_ltree_slab, le);
+ kfree(le);
}
/**
free = 0;
spin_unlock(&ubi->ltree_lock);
if (free)
- kmem_cache_free(ubi_ltree_slab, le);
+ kfree(le);
return 1;
}
up_write(&le->mutex);
if (free)
- kmem_cache_free(ubi_ltree_slab, le);
+ kfree(le);
}
/**