summaryrefslogtreecommitdiffstats
path: root/drivers/mtd/ubi/build.c
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2007-12-16 12:49:01 +0200
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2007-12-26 19:15:14 +0200
commit06b68ba15671f32a3aa3bbddf04b0d2dd7fbf902 (patch)
tree67024857173069023835148077775e8c9e381d8a /drivers/mtd/ubi/build.c
parent3a8d4642861fb69b62401949e490c0bcb19ceb40 (diff)
UBI: create ubi_wl_entry slab on initialization
Similarly to ltree_entry_slab, it makes more sense to create and destroy ubi_wl_entry slab on module initialization/exit. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'drivers/mtd/ubi/build.c')
-rw-r--r--drivers/mtd/ubi/build.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c
index 44c852144a9..7f6820becf1 100644
--- a/drivers/mtd/ubi/build.c
+++ b/drivers/mtd/ubi/build.c
@@ -70,6 +70,10 @@ 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;
+
+
/* "Show" method for files in '/<sysfs>/class/ubi/' */
static ssize_t ubi_version_show(struct class *class, char *buf)
{
@@ -732,6 +736,12 @@ static int __init ubi_init(void)
if (!ubi_ltree_slab)
goto out_version;
+ 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;
+
/* Attach MTD devices */
for (i = 0; i < mtd_devs; i++) {
struct mtd_dev_param *p = &mtd_dev_param[i];
@@ -747,6 +757,8 @@ static int __init ubi_init(void)
out_detach:
for (k = 0; k < i; k++)
detach_mtd_dev(ubi_devices[k]);
+ kmem_cache_destroy(ubi_wl_entry_slab);
+out_ltree:
kmem_cache_destroy(ubi_ltree_slab);
out_version:
class_remove_file(ubi_class, &ubi_version);
@@ -762,6 +774,7 @@ static void __exit ubi_exit(void)
for (i = 0; i < n; i++)
detach_mtd_dev(ubi_devices[i]);
+ kmem_cache_destroy(ubi_wl_entry_slab);
kmem_cache_destroy(ubi_ltree_slab);
class_remove_file(ubi_class, &ubi_version);
class_destroy(ubi_class);