aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/ubi/build.c
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2008-01-16 05:11:54 -0500
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2008-01-25 09:41:24 -0500
commitb9a06623d9d0c6dff758d525ceb0d9e2bba8f7d6 (patch)
tree9107daa5cf1aa527603c7d33d55ca45dbe760d5a /drivers/mtd/ubi/build.c
parent4fac9f698404a5cd50b978fbdb7e54235353c215 (diff)
UBI: get rid of ubi_ltree_slab
This slab cache is not really needed since the number of objects is low and the constructor does not make much sense because we allocate oblects when doint I/O, which is way slower then allocation. Suggested-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'drivers/mtd/ubi/build.c')
-rw-r--r--drivers/mtd/ubi/build.c28
1 files changed, 1 insertions, 27 deletions
diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c
index 8f1f9feb2d60..8b4573559dfe 100644
--- a/drivers/mtd/ubi/build.c
+++ b/drivers/mtd/ubi/build.c
@@ -66,9 +66,6 @@ static struct mtd_dev_param mtd_dev_param[UBI_MAX_DEVICES];
66/* Root UBI "class" object (corresponds to '/<sysfs>/class/ubi/') */ 66/* Root UBI "class" object (corresponds to '/<sysfs>/class/ubi/') */
67struct class *ubi_class; 67struct class *ubi_class;
68 68
69/* Slab cache for lock-tree entries */
70struct kmem_cache *ubi_ltree_slab;
71
72/* Slab cache for wear-leveling entries */ 69/* Slab cache for wear-leveling entries */
73struct kmem_cache *ubi_wl_entry_slab; 70struct kmem_cache *ubi_wl_entry_slab;
74 71
@@ -858,20 +855,6 @@ int ubi_detach_mtd_dev(int ubi_num, int anyway)
858} 855}
859 856
860/** 857/**
861 * ltree_entry_ctor - lock tree entries slab cache constructor.
862 * @obj: the lock-tree entry to construct
863 * @cache: the lock tree entry slab cache
864 * @flags: constructor flags
865 */
866static void ltree_entry_ctor(struct kmem_cache *cache, void *obj)
867{
868 struct ubi_ltree_entry *le = obj;
869
870 le->users = 0;
871 init_rwsem(&le->mutex);
872}
873
874/**
875 * find_mtd_device - open an MTD device by its name or number. 858 * find_mtd_device - open an MTD device by its name or number.
876 * @mtd_dev: name or number of the device 859 * @mtd_dev: name or number of the device
877 * 860 *
@@ -933,17 +916,11 @@ static int __init ubi_init(void)
933 goto out_version; 916 goto out_version;
934 } 917 }
935 918
936 ubi_ltree_slab = kmem_cache_create("ubi_ltree_slab",
937 sizeof(struct ubi_ltree_entry), 0,
938 0, &ltree_entry_ctor);
939 if (!ubi_ltree_slab)
940 goto out_dev_unreg;
941
942 ubi_wl_entry_slab = kmem_cache_create("ubi_wl_entry_slab", 919 ubi_wl_entry_slab = kmem_cache_create("ubi_wl_entry_slab",
943 sizeof(struct ubi_wl_entry), 920 sizeof(struct ubi_wl_entry),
944 0, 0, NULL); 921 0, 0, NULL);
945 if (!ubi_wl_entry_slab) 922 if (!ubi_wl_entry_slab)
946 goto out_ltree; 923 goto out_dev_unreg;
947 924
948 /* Attach MTD devices */ 925 /* Attach MTD devices */
949 for (i = 0; i < mtd_devs; i++) { 926 for (i = 0; i < mtd_devs; i++) {
@@ -980,8 +957,6 @@ out_detach:
980 mutex_unlock(&ubi_devices_mutex); 957 mutex_unlock(&ubi_devices_mutex);
981 } 958 }
982 kmem_cache_destroy(ubi_wl_entry_slab); 959 kmem_cache_destroy(ubi_wl_entry_slab);
983out_ltree:
984 kmem_cache_destroy(ubi_ltree_slab);
985out_dev_unreg: 960out_dev_unreg:
986 misc_deregister(&ubi_ctrl_cdev); 961 misc_deregister(&ubi_ctrl_cdev);
987out_version: 962out_version:
@@ -1005,7 +980,6 @@ static void __exit ubi_exit(void)
1005 mutex_unlock(&ubi_devices_mutex); 980 mutex_unlock(&ubi_devices_mutex);
1006 } 981 }
1007 kmem_cache_destroy(ubi_wl_entry_slab); 982 kmem_cache_destroy(ubi_wl_entry_slab);
1008 kmem_cache_destroy(ubi_ltree_slab);
1009 misc_deregister(&ubi_ctrl_cdev); 983 misc_deregister(&ubi_ctrl_cdev);
1010 class_remove_file(ubi_class, &ubi_version); 984 class_remove_file(ubi_class, &ubi_version);
1011 class_destroy(ubi_class); 985 class_destroy(ubi_class);